negative numbers are displayed correctly too

This commit is contained in:
hg 2015-03-03 21:56:18 +01:00
parent 7f7df544e2
commit 32f9365ee3
2 changed files with 3 additions and 2 deletions

View File

@ -117,6 +117,7 @@ void dispSet(uint8_t unit, int16_t value) {
dispSetError();
} else {
uint8_t neg = (value < 0) ? 1 : 0;
value = (value < 0) ? -1 * value : value;
// value = abs(value);
uint8_t digit3 = value / 1000;

View File

@ -35,8 +35,8 @@ int main() {
spiInit();
dispInit();
dispSet(0, 12);
dispSet(1, 437);
dispSet(0, -12);
dispSet(1, -990);
__enable_interrupt();