From 269a0680324f2607b2e864abaee70290aaf46a3a Mon Sep 17 00:00:00 2001 From: Oskar Linde Date: Tue, 24 Jun 2014 14:31:15 +0200 Subject: [PATCH] Fix lcd itostr3() to handle negative numbers --- Marlin/ultralcd.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index f09dd410d..39fcee80d 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1489,9 +1489,13 @@ char *itostr31(const int &xx) return conv; } -char *itostr3(const int &xx) +char *itostr3(const int &x) { - if (xx >= 100) + int xx = x; + if (xx < 0) { + conv[0]='-'; + xx = -xx; + } else if (xx >= 100) conv[0]=(xx/100)%10+'0'; else conv[0]=' ';