abs and round problem

This commit is contained in:
hg 2015-03-04 19:50:26 +01:00
parent 540ebbab25
commit ed03619da3

View File

@ -105,12 +105,12 @@ void dispSetFloat(uint8_t unit, float value) {
spiXfer16(0x0100 | digit1);
spiXfer16(0x0200 | digit2);
spiXfer16(0x0300 | digit3);
spiXfer16(0x0400 | postComma);
spiXfer16(0x0400 | digit4);
} else {
spiXfer16(0x0500 | digit1);
spiXfer16(0x0600 | digit2);
spiXfer16(0x0700 | digit3);
spiXfer16(0x0800 | postComma);
spiXfer16(0x0800 | digit4);
}
}
}
@ -124,6 +124,7 @@ void dispSet(uint8_t unit, int16_t value) {
} else {
bool neg = value < 0;
value = (value < 0) ? -1 * value : value;
// value = abs(value);
uint8_t digit3 = value / 1000;
uint16_t remVal = value - (digit3 * 1000);