tabs
This commit is contained in:
		| @@ -60,60 +60,60 @@ void dispSetDigit(uint8_t digit, uint8_t value) { | ||||
|  | ||||
|  | ||||
| void dispSetFloat(uint8_t unit, float value) { | ||||
| 	  if ((value < -99) || (value > 999)) { | ||||
| 	    dispSetError(); | ||||
| 	  } else { | ||||
| 	    bool neg = value < 0; | ||||
| 			value = (value < 0) ? -1 * value : value; | ||||
| 	    uint16_t preComma = (uint16_t)value; | ||||
| 	    uint16_t postComma = round16((value - (float)preComma) * 10); | ||||
| 	    if (postComma == 10) { | ||||
| 	      postComma = 0; | ||||
| 	      preComma += 1; | ||||
| 	    } | ||||
| 	    if ((preComma == 0) && (postComma == 0)) { | ||||
| 	      neg = false; | ||||
| 	    } | ||||
| 	if ((value < -99) || (value > 999)) { | ||||
| 		dispSetError(); | ||||
| 	} else { | ||||
| 		bool neg = value < 0; | ||||
| 		value = (value < 0) ? -1 * value : value; | ||||
| 		uint16_t preComma = (uint16_t)value; | ||||
| 		uint16_t postComma = round16((value - (float)preComma) * 10); | ||||
| 		if (postComma == 10) { | ||||
| 			postComma = 0; | ||||
| 			preComma += 1; | ||||
| 		} | ||||
| 		if ((preComma == 0) && (postComma == 0)) { | ||||
| 			neg = false; | ||||
| 		} | ||||
|  | ||||
|       uint8_t digit1 = postComma; | ||||
| 		uint8_t digit1 = postComma; | ||||
|  | ||||
| 	    uint8_t digit4 = preComma / 100; | ||||
| 	    uint8_t remVal = preComma - (digit4 * 100); | ||||
| 	    uint8_t digit3 = remVal / 10; | ||||
| 	    remVal = remVal - (digit3 * 10); | ||||
| 	    uint8_t digit2 = remVal; | ||||
| 		uint8_t digit4 = preComma / 100; | ||||
| 		uint8_t remVal = preComma - (digit4 * 100); | ||||
| 		uint8_t digit3 = remVal / 10; | ||||
| 		remVal = remVal - (digit3 * 10); | ||||
| 		uint8_t digit2 = remVal; | ||||
|  | ||||
| 	    if (digit4 == 0) { | ||||
| 	      if (neg) { | ||||
| 	        digit4 = 0x0a; | ||||
| 	      } else { | ||||
| 	        digit4 = 0x0f; | ||||
| 	      } | ||||
| 	    } | ||||
| 	 | ||||
| 	    if (digit4 > 0x09 && digit3 == 0) { | ||||
| 	      if (neg) { | ||||
| 	        digit3 = 0x0a; | ||||
| 	        digit4 = 0x0f; | ||||
| 	      } else { | ||||
| 	        digit3 = 0x0f; | ||||
| 	      } | ||||
| 	    } | ||||
| 	 | ||||
| 	    digit2 |= 0x80; | ||||
| 	 | ||||
| 			if (unit == 0) { | ||||
| 				spiXfer16(0x0100 | digit1); | ||||
| 				spiXfer16(0x0200 | digit2); | ||||
| 				spiXfer16(0x0300 | digit3); | ||||
| 				spiXfer16(0x0400 | digit4); | ||||
| 		if (digit4 == 0) { | ||||
| 			if (neg) { | ||||
| 				digit4 = 0x0a; | ||||
| 			} else { | ||||
| 				spiXfer16(0x0500 | digit1); | ||||
| 				spiXfer16(0x0600 | digit2); | ||||
| 				spiXfer16(0x0700 | digit3); | ||||
| 				spiXfer16(0x0800 | digit4); | ||||
| 				digit4 = 0x0f; | ||||
| 			} | ||||
| 	  } | ||||
| 		} | ||||
|  | ||||
| 		if (digit4 > 0x09 && digit3 == 0) { | ||||
| 			if (neg) { | ||||
| 				digit3 = 0x0a; | ||||
| 				digit4 = 0x0f; | ||||
| 			} else { | ||||
| 				digit3 = 0x0f; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		digit2 |= 0x80; | ||||
|  | ||||
| 		if (unit == 0) { | ||||
| 			spiXfer16(0x0100 | digit1); | ||||
| 			spiXfer16(0x0200 | digit2); | ||||
| 			spiXfer16(0x0300 | digit3); | ||||
| 			spiXfer16(0x0400 | digit4); | ||||
| 		} else { | ||||
| 			spiXfer16(0x0500 | digit1); | ||||
| 			spiXfer16(0x0600 | digit2); | ||||
| 			spiXfer16(0x0700 | digit3); | ||||
| 			spiXfer16(0x0800 | digit4); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void dispSet(uint8_t unit, int16_t value) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hg
					hg