Better display handling

This commit is contained in:
vintagepc 2020-02-11 19:44:26 -05:00
parent 278bb032d7
commit 5abee3d3e5
1 changed files with 20 additions and 22 deletions

View File

@ -7439,39 +7439,37 @@ static void lcd_belttest_v()
void lcd_belttest() void lcd_belttest()
{ {
bool _result = true; lcd_clear();
// Belttest requires high power mode. Enable it. // Belttest requires high power mode. Enable it.
FORCE_HIGH_POWER_START; FORCE_HIGH_POWER_START;
uint16_t X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)); uint16_t X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
uint16_t Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y)); uint16_t Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
lcd_puts_at_P(0,0,_i("Checking X...")); lcd_puts_at_P(0,0,_i("Checking X axis ")); // share message with selftest
lcd_set_cursor(0,1), lcd_printf_P(PSTR("X: %d "),X);
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
_result = lcd_selfcheck_axis_sg(X_AXIS); // N.B: it doesn't make sense to handle !lcd_selfcheck...() because selftest_sg throws its own error screen
X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)); // that clobbers ours, with more info than we could provide. So on fail we just fall through to take us back to status.
lcd_set_cursor(0,1), lcd_printf_P(PSTR("X: %d "),X); // Trailing space for done/error spacing if !_result if (lcd_selfcheck_axis_sg(X_AXIS)){
if (_result){ X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
lcd_printf_P(_i("Done")); lcd_printf_P(PSTR("-> %d"),X); // Show new X value next to old one.
lcd_puts_at_P(0,2,_i("Checking Y...")); lcd_puts_at_P(0,2,_i("Checking Y axis "));
_result = lcd_selfcheck_axis_sg(Y_AXIS);
Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
lcd_set_cursor(0,3), lcd_printf_P(PSTR("Y: %d "),Y); lcd_set_cursor(0,3), lcd_printf_P(PSTR("Y: %d "),Y);
if (lcd_selfcheck_axis_sg(Y_AXIS))
{
Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
lcd_printf_P(PSTR("-> %d"),Y);
lcd_set_custom_characters_nextpage();
lcd_set_cursor(19, 3);
lcd_print(char(2));
lcd_wait_for_click_delay(10);
}
} }
if (!_result) { // If error on X, error appears after X measurement, else done or error after Y measurement.
lcd_printf_P(_i("Error"));
} else {
lcd_printf_P(_i("Done"));
}
lcd_puts_at_P(19,3,char(2)); // Checkmark
FORCE_HIGH_POWER_END; FORCE_HIGH_POWER_END;
KEEPALIVE_STATE(NOT_BUSY); KEEPALIVE_STATE(NOT_BUSY);
_delay(3000); lcd_set_custom_characters(); // restore status screen chars.
} }
#endif //TMC2130 #endif //TMC2130