negative numbers are displayed correctly too
This commit is contained in:
parent
7f7df544e2
commit
32f9365ee3
@ -117,6 +117,7 @@ void dispSet(uint8_t unit, int16_t value) {
|
|||||||
dispSetError();
|
dispSetError();
|
||||||
} else {
|
} else {
|
||||||
uint8_t neg = (value < 0) ? 1 : 0;
|
uint8_t neg = (value < 0) ? 1 : 0;
|
||||||
|
value = (value < 0) ? -1 * value : value;
|
||||||
// value = abs(value);
|
// value = abs(value);
|
||||||
|
|
||||||
uint8_t digit3 = value / 1000;
|
uint8_t digit3 = value / 1000;
|
||||||
|
@ -35,8 +35,8 @@ int main() {
|
|||||||
spiInit();
|
spiInit();
|
||||||
dispInit();
|
dispInit();
|
||||||
|
|
||||||
dispSet(0, 12);
|
dispSet(0, -12);
|
||||||
dispSet(1, 437);
|
dispSet(1, -990);
|
||||||
|
|
||||||
__enable_interrupt();
|
__enable_interrupt();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user