1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

Set LCD status for EEPROM errors (#16977)

This commit is contained in:
InsanityAutomation 2020-02-26 04:04:02 -05:00 committed by GitHub
parent e78f607ef3
commit cdcd45d651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 16 deletions

View File

@ -995,32 +995,28 @@ void setup() {
ui.show_bootscreen();
#endif
#if ENABLED(SDSUPPORT)
card.mount(); // Mount the SD card before settings.first_load
#endif
ui.reset_status(); // Load welcome message early. (Retained if no errors exist.)
// Load data from EEPROM if available (or use defaults)
// This also updates variables in the planner, elsewhere
settings.first_load();
#if ENABLED(SDSUPPORT)
card.mount(); // Mount the SD card before settings.first_load
#endif
// Load data from EEPROM if available (or use defaults)
settings.first_load(); // This also updates variables in the planner, elsewhere
#if ENABLED(TOUCH_BUTTONS)
touch.init();
#endif
#if HAS_M206_COMMAND
// Initialize current position based on home_offset
#if HAS_M206_COMMAND // Initialize current position based on home_offset
current_position += home_offset;
#endif
// Vital to init stepper/planner equivalent for current_position
sync_plan_position();
sync_plan_position(); // Vital to init stepper/planner equivalent for current_position
thermalManager.init(); // Initialize temperature loop
print_job_timer.init(); // Initial setup of print job timer
ui.reset_status(); // Print startup message after print statistics are loaded
endstops.init(); // Init endstops and pullups
stepper.init(); // Init stepper. This enables interrupts!
@ -1175,6 +1171,10 @@ void setup() {
#if ENABLED(PRUSA_MMU2)
mmu2.init();
#endif
#if HAS_SERVICE_INTERVALS
ui.reset_status(true); // Show service messages or keep current status
#endif
}
/**

View File

@ -314,6 +314,9 @@ namespace Language_en {
PROGMEM Language_Str MSG_LOAD_EEPROM = _UxGT("Load Settings");
PROGMEM Language_Str MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults");
PROGMEM Language_Str MSG_INIT_EEPROM = _UxGT("Initialize EEPROM");
PROGMEM Language_Str MSG_ERR_EEPROM_CRC = _UxGT("Err: EEPROM CRC");
PROGMEM Language_Str MSG_ERR_EEPROM_INDEX = _UxGT("Err: EEPROM Index");
PROGMEM Language_Str MSG_ERR_EEPROM_VERSION = _UxGT("Err: EEPROM Version");
PROGMEM Language_Str MSG_MEDIA_UPDATE = _UxGT("Media Update");
PROGMEM Language_Str MSG_RESET_PRINTER = _UxGT("Reset Printer");
PROGMEM Language_Str MSG_REFRESH = LCD_STR_REFRESH _UxGT("Refresh");

View File

@ -1453,7 +1453,7 @@ void MarlinUI::update() {
/**
* Reset the status message
*/
void MarlinUI::reset_status() {
void MarlinUI::reset_status(const bool no_welcome) {
PGM_P printing = GET_TEXT(MSG_PRINTING);
PGM_P welcome = GET_TEXT(WELCOME_MSG);
#if SERVICE_INTERVAL_1 > 0
@ -1485,8 +1485,10 @@ void MarlinUI::update() {
else if (print_job_timer.needsService(3)) msg = service3;
#endif
else
else if (!no_welcome)
msg = welcome;
else
return;
set_status_P(msg, -1);
}

View File

@ -402,7 +402,7 @@ public:
static void set_status(const char* const message, const bool persist=false);
static void set_status_P(PGM_P const message, const int8_t level=0);
static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
static void reset_status();
static void reset_status(const bool no_welcome=false);
#else // No LCD
@ -416,7 +416,7 @@ public:
static inline void refresh() {}
static inline void return_to_status() {}
static inline void set_alert_status_P(PGM_P const) {}
static inline void reset_status() {}
static inline void reset_status(const bool=false) {}
static inline void reset_alert_level() {}
static constexpr bool has_status() { return false; }

View File

@ -1397,6 +1397,9 @@ void MarlinSettings::postprocess() {
}
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
#if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_VERSION));
#endif
eeprom_error = true;
}
else {
@ -2205,11 +2208,17 @@ void MarlinSettings::postprocess() {
if (eeprom_error) {
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
#if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_INDEX));
#endif
}
else if (working_crc != stored_crc) {
eeprom_error = true;
DEBUG_ERROR_START();
DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
#if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_CRC));
#endif
}
else if (!validating) {
DEBUG_ECHO_START();