Bläddra i källkod

Patch to make Z look more like X and Y on UltraLCD

Scott Lahteine 10 år sedan
förälder
incheckning
f390b3f314
3 ändrade filer med 16 tillägg och 1 borttagningar
  1. 14
    0
      Marlin/ultralcd.cpp
  2. 1
    0
      Marlin/ultralcd.h
  3. 1
    1
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 14
- 0
Marlin/ultralcd.cpp Visa fil

@@ -1443,6 +1443,20 @@ char *ftostr12ns(const float &x)
1443 1443
   return conv;
1444 1444
 }
1445 1445
 
1446
+//  convert float to space-padded string with -_23.4_ format
1447
+char *ftostr32np(const float &x) {
1448
+  char *c = ftostr32(x);
1449
+  if (c[0] == '0' || c[0] == '-') {
1450
+    if (c[0] == '0') c[0] = ' ';
1451
+    if (c[1] == '0') c[1] = ' ';
1452
+  }
1453
+  if (c[5] == '0') {
1454
+    c[5] = ' ';
1455
+    if (c[4] == '0') c[4] = c[3] = ' ';
1456
+  }
1457
+  return c;
1458
+}
1459
+
1446 1460
 char *itostr31(const int &xx)
1447 1461
 {
1448 1462
   conv[0]=(xx>=0)?'+':'-';

+ 1
- 0
Marlin/ultralcd.h Visa fil

@@ -119,6 +119,7 @@ char *ftostr31ns(const float &x); // float to string without sign character
119 119
 char *ftostr31(const float &x);
120 120
 char *ftostr32(const float &x);
121 121
 char *ftostr12ns(const float &x); 
122
+char *ftostr32np(const float &x); // remove zero-padding from ftostr32
122 123
 char *ftostr5(const float &x);
123 124
 char *ftostr51(const float &x);
124 125
 char *ftostr52(const float &x);

+ 1
- 1
Marlin/ultralcd_implementation_hitachi_HD44780.h Visa fil

@@ -475,7 +475,7 @@ static void lcd_implementation_status_screen()
475 475
 # endif//LCD_WIDTH > 19
476 476
     lcd.setCursor(LCD_WIDTH - 8, 1);
477 477
     lcd.print('Z');
478
-    lcd.print(ftostr32(current_position[Z_AXIS] + 0.00001));
478
+    lcd.print(ftostr32np(current_position[Z_AXIS] + 0.00001));
479 479
 #endif//LCD_HEIGHT > 2
480 480
 
481 481
 #if LCD_HEIGHT > 3

Laddar…
Avbryt
Spara