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

2.0.x
Scott Lahteine 7 years ago committed by GitHub
parent 57c2f8d2f6
commit 265161ba30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -98,19 +98,24 @@ FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, cons
}
}
FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
//
// Before homing, blink '123' <-> '???'.
// Homed but unknown... '123' <-> ' '.
// Homed and known, display constantly.
//
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
if (blink)
lcd_put_u8str_rom(pstr);
lcd_put_u8str(value);
else {
if (!axis_homed[axis])
lcd_put_wchar('?');
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
else {
#if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
if (!axis_known_position[axis])
lcd_put_wchar(' ');
lcd_put_u8str_rom(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
else
#endif
lcd_put_u8str_rom(pstr);
lcd_put_u8str(value);
}
}
}
@ -330,10 +335,6 @@ static void lcd_implementation_status_screen() {
#define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1
#endif
// Before homing the axis letters are blinking 'X' <-> '?'.
// When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
// When everything is ok you see a constant 'X'.
static char xstring[5], ystring[5], zstring[7];
#if ENABLED(FILAMENT_LCD_DISPLAY)
static char wstring[5], mstring[4];
@ -370,19 +371,19 @@ static void lcd_implementation_status_screen() {
#endif
lcd_moveto(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
lcd_put_wchar('X');
lcd_moveto(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
lcd_put_u8str(xstring);
_draw_axis_value(X_AXIS, xstring, blink);
lcd_moveto(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
lcd_put_wchar('Y');
lcd_moveto(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
lcd_put_u8str(ystring);
_draw_axis_value(Y_AXIS, ystring, blink);
lcd_moveto(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
_draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
lcd_put_wchar('Z');
lcd_moveto(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
lcd_put_u8str(zstring);
_draw_axis_value(Z_AXIS, zstring, blink);
#if DISABLED(XYZ_HOLLOW_FRAME)
u8g.setColorIndex(1); // black on white

@ -458,19 +458,25 @@ void lcd_kill_screen() {
lcd_put_u8str_rom(PSTR(MSG_PLEASE_RESET));
}
FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
//
// Before homing, blink '123' <-> '???'.
// Homed but unknown... '123' <-> ' '.
// Homed and known, display constantly.
//
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
lcd_put_wchar('X' + uint8_t(axis));
if (blink)
lcd_put_u8str_rom(pstr);
lcd_put_u8str(value);
else {
if (!axis_homed[axis])
lcd_put_wchar('?');
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
else {
#if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
if (!axis_known_position[axis])
lcd_put_wchar(' ');
lcd_put_u8str_rom(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
else
#endif
lcd_put_u8str_rom(pstr);
lcd_put_u8str(value);
}
}
}
@ -658,25 +664,19 @@ static void lcd_implementation_status_screen() {
), blink);
#else // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
// Before homing the axis letters are blinking 'X' <-> '?'.
// When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
// When everything is ok you see a constant 'X'.
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
lcd_put_u8str(ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
_draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink);
lcd_put_wchar(' ');
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
lcd_put_u8str(ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
_draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink);
#endif // HOTENDS <= 2 && (HOTENDS <= 1 || !TEMP_SENSOR_BED)
#endif // LCD_WIDTH >= 20
lcd_moveto(LCD_WIDTH - 8, 1);
_draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
lcd_put_u8str(ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])));
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
#if HAS_LEVELING && !TEMP_SENSOR_BED
lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');

Loading…
Cancel
Save