Browse Source

Fix lcd itostr3() to handle negative numbers

Oskar Linde 11 years ago
parent
commit
269a068032
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      Marlin/ultralcd.cpp

+ 6
- 2
Marlin/ultralcd.cpp View File

@@ -1489,9 +1489,13 @@ char *itostr31(const int &xx)
1489 1489
   return conv;
1490 1490
 }
1491 1491
 
1492
-char *itostr3(const int &xx)
1492
+char *itostr3(const int &x)
1493 1493
 {
1494
-  if (xx >= 100)
1494
+  int xx = x;
1495
+  if (xx < 0) {
1496
+     conv[0]='-';
1497
+     xx = -xx;
1498
+  } else if (xx >= 100)
1495 1499
     conv[0]=(xx/100)%10+'0';
1496 1500
   else
1497 1501
     conv[0]=' ';

Loading…
Cancel
Save