Browse Source

Blink the value for unhomed/unknown axes (#10670)

Scott Lahteine 7 years ago
parent
commit
265161ba30
No account linked to committer's email address
2 changed files with 30 additions and 29 deletions
  1. 16
    15
      Marlin/src/lcd/dogm/status_screen_DOGM.h
  2. 14
    14
      Marlin/src/lcd/ultralcd_impl_HD44780.h

+ 16
- 15
Marlin/src/lcd/dogm/status_screen_DOGM.h View File

98
   }
98
   }
99
 }
99
 }
100
 
100
 
101
-FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
101
+//
102
+// Before homing, blink '123' <-> '???'.
103
+// Homed but unknown... '123' <-> '   '.
104
+// Homed and known, display constantly.
105
+//
106
+FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
102
   if (blink)
107
   if (blink)
103
-    lcd_put_u8str_rom(pstr);
108
+    lcd_put_u8str(value);
104
   else {
109
   else {
105
     if (!axis_homed[axis])
110
     if (!axis_homed[axis])
106
-      lcd_put_wchar('?');
111
+      while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
107
     else {
112
     else {
108
       #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
113
       #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
109
         if (!axis_known_position[axis])
114
         if (!axis_known_position[axis])
110
-          lcd_put_wchar(' ');
115
+          lcd_put_u8str_rom(axis == Z_AXIS ? PSTR("      ") : PSTR("    "));
111
         else
116
         else
112
       #endif
117
       #endif
113
-          lcd_put_u8str_rom(pstr);
118
+          lcd_put_u8str(value);
114
     }
119
     }
115
   }
120
   }
116
 }
121
 }
330
     #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1
335
     #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1
331
   #endif
336
   #endif
332
 
337
 
333
-  // Before homing the axis letters are blinking 'X' <-> '?'.
334
-  // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
335
-  // When everything is ok you see a constant 'X'.
336
-
337
   static char xstring[5], ystring[5], zstring[7];
338
   static char xstring[5], ystring[5], zstring[7];
338
   #if ENABLED(FILAMENT_LCD_DISPLAY)
339
   #if ENABLED(FILAMENT_LCD_DISPLAY)
339
     static char wstring[5], mstring[4];
340
     static char wstring[5], mstring[4];
370
       #endif
371
       #endif
371
 
372
 
372
       lcd_moveto(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
373
       lcd_moveto(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
373
-      _draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
374
+      lcd_put_wchar('X');
374
       lcd_moveto(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
375
       lcd_moveto(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
375
-      lcd_put_u8str(xstring);
376
+      _draw_axis_value(X_AXIS, xstring, blink);
376
 
377
 
377
       lcd_moveto(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
378
       lcd_moveto(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
378
-      _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
379
+      lcd_put_wchar('Y');
379
       lcd_moveto(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
380
       lcd_moveto(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
380
-      lcd_put_u8str(ystring);
381
+      _draw_axis_value(Y_AXIS, ystring, blink);
381
 
382
 
382
       lcd_moveto(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
383
       lcd_moveto(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
383
-      _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
384
+      lcd_put_wchar('Z');
384
       lcd_moveto(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
385
       lcd_moveto(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
385
-      lcd_put_u8str(zstring);
386
+      _draw_axis_value(Z_AXIS, zstring, blink);
386
 
387
 
387
       #if DISABLED(XYZ_HOLLOW_FRAME)
388
       #if DISABLED(XYZ_HOLLOW_FRAME)
388
         u8g.setColorIndex(1); // black on white
389
         u8g.setColorIndex(1); // black on white

+ 14
- 14
Marlin/src/lcd/ultralcd_impl_HD44780.h View File

458
   lcd_put_u8str_rom(PSTR(MSG_PLEASE_RESET));
458
   lcd_put_u8str_rom(PSTR(MSG_PLEASE_RESET));
459
 }
459
 }
460
 
460
 
461
-FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
461
+//
462
+// Before homing, blink '123' <-> '???'.
463
+// Homed but unknown... '123' <-> '   '.
464
+// Homed and known, display constantly.
465
+//
466
+FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
467
+  lcd_put_wchar('X' + uint8_t(axis));
462
   if (blink)
468
   if (blink)
463
-    lcd_put_u8str_rom(pstr);
469
+    lcd_put_u8str(value);
464
   else {
470
   else {
465
     if (!axis_homed[axis])
471
     if (!axis_homed[axis])
466
-      lcd_put_wchar('?');
472
+      while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
467
     else {
473
     else {
468
       #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
474
       #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
469
         if (!axis_known_position[axis])
475
         if (!axis_known_position[axis])
470
-          lcd_put_wchar(' ');
476
+          lcd_put_u8str_rom(axis == Z_AXIS ? PSTR("      ") : PSTR("    "));
471
         else
477
         else
472
       #endif
478
       #endif
473
-          lcd_put_u8str_rom(pstr);
479
+          lcd_put_u8str(value);
474
     }
480
     }
475
   }
481
   }
476
 }
482
 }
658
         ), blink);
664
         ), blink);
659
 
665
 
660
       #else // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
666
       #else // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
661
-        // Before homing the axis letters are blinking 'X' <-> '?'.
662
-        // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
663
-        // When everything is ok you see a constant 'X'.
664
 
667
 
665
-        _draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
666
-        lcd_put_u8str(ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
668
+        _draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink);
667
 
669
 
668
         lcd_put_wchar(' ');
670
         lcd_put_wchar(' ');
669
 
671
 
670
-        _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
671
-        lcd_put_u8str(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
672
+        _draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink);
672
 
673
 
673
       #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
674
       #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
674
 
675
 
675
     #endif // LCD_WIDTH >= 20
676
     #endif // LCD_WIDTH >= 20
676
 
677
 
677
     lcd_moveto(LCD_WIDTH - 8, 1);
678
     lcd_moveto(LCD_WIDTH - 8, 1);
678
-    _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
679
-    lcd_put_u8str(ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])));
679
+    _draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
680
 
680
 
681
     #if HAS_LEVELING && !TEMP_SENSOR_BED
681
     #if HAS_LEVELING && !TEMP_SENSOR_BED
682
       lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
682
       lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');

Loading…
Cancel
Save