Browse Source

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

Scott Lahteine 10 years ago
parent
commit
a2109cb492
3 changed files with 16 additions and 2 deletions
  1. 14
    1
      Marlin/ultralcd.cpp
  2. 1
    0
      Marlin/ultralcd.h
  3. 1
    1
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 14
- 1
Marlin/ultralcd.cpp View File

1496
   return conv;
1496
   return conv;
1497
 }
1497
 }
1498
 
1498
 
1499
-// Convert int to lj string with +123.0 format
1499
+//  convert float to space-padded string with -_23.4_ format
1500
+char *ftostr32np(const float &x) {
1501
+  char *c = ftostr32(x);
1502
+  if (c[0] == '0' || c[0] == '-') {
1503
+    if (c[0] == '0') c[0] = ' ';
1504
+    if (c[1] == '0') c[1] = ' ';
1505
+  }
1506
+  if (c[5] == '0') {
1507
+    c[5] = ' ';
1508
+    if (c[4] == '0') c[4] = c[3] = ' ';
1509
+  }
1510
+  return c;
1511
+}
1512
+
1500
 char *itostr31(const int &xx)
1513
 char *itostr31(const int &xx)
1501
 {
1514
 {
1502
   conv[0]=(xx>=0)?'+':'-';
1515
   conv[0]=(xx>=0)?'+':'-';

+ 1
- 0
Marlin/ultralcd.h View File

119
 char *ftostr31(const float &x);
119
 char *ftostr31(const float &x);
120
 char *ftostr32(const float &x);
120
 char *ftostr32(const float &x);
121
 char *ftostr12ns(const float &x); 
121
 char *ftostr12ns(const float &x); 
122
+char *ftostr32np(const float &x); // remove zero-padding from ftostr32
122
 char *ftostr5(const float &x);
123
 char *ftostr5(const float &x);
123
 char *ftostr51(const float &x);
124
 char *ftostr51(const float &x);
124
 char *ftostr52(const float &x);
125
 char *ftostr52(const float &x);

+ 1
- 1
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

548
 # endif//LCD_WIDTH > 19
548
 # endif//LCD_WIDTH > 19
549
     lcd.setCursor(LCD_WIDTH - 8, 1);
549
     lcd.setCursor(LCD_WIDTH - 8, 1);
550
     lcd.print('Z');
550
     lcd.print('Z');
551
-    lcd.print(ftostr32(current_position[Z_AXIS] + 0.00001));
551
+    lcd.print(ftostr32np(current_position[Z_AXIS] + 0.00001));
552
 #endif//LCD_HEIGHT > 2
552
 #endif//LCD_HEIGHT > 2
553
 
553
 
554
 #if LCD_HEIGHT > 3
554
 #if LCD_HEIGHT > 3

Loading…
Cancel
Save