Skip to content

Commit

Permalink
🚸 EEPROM reset messages
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 14, 2024
1 parent 282f90c commit 81760d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
#define STR_ERR_HOTEND_TOO_COLD "Hotend too cold"
#define STR_ERR_EEPROM_WRITE "Error writing to EEPROM!"
#define STR_ERR_EEPROM_CORRUPT "EEPROM Corrupt"
#define STR_EEPROM_INITIALIZED "EEPROM Initialized"

#define STR_FILAMENT_CHANGE_HEAT_LCD "Press button to heat nozzle"
#define STR_FILAMENT_CHANGE_INSERT_LCD "Insert filament and press button"
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/language/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ namespace LanguageNarrow_en {
LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings");
LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults");
LSTR MSG_INIT_EEPROM = _UxGT("Initialize EEPROM");
LSTR MSG_EEPROM_INITIALIZED = _UxGT("EEPROM Initialized");
LSTR MSG_ERR_EEPROM_CRC = _UxGT("Err: EEPROM CRC");
LSTR MSG_ERR_EEPROM_SIZE = _UxGT("Err: EEPROM Size");
LSTR MSG_ERR_EEPROM_VERSION = _UxGT("Err: EEPROM Version");
Expand Down Expand Up @@ -1098,6 +1099,7 @@ namespace LanguageWide_en {
LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Longest Job Time");
LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Extruded Total");
LSTR MSG_HOMING_FEEDRATE_N = _UxGT("@ Homing Feedrate");
LSTR MSG_EEPROM_INITIALIZED = _UxGT("Default Settings Restored");
#endif
}

Expand Down
11 changes: 9 additions & 2 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3100,17 +3100,24 @@ void MarlinSettings::postprocess() {
#endif // HAS_EARLY_LCD_SETTINGS

bool MarlinSettings::load() {
// If the EEPROM data is valid load it
if (validate()) {
const EEPROM_Error err = _load();
const bool success = (err == ERR_EEPROM_NOERR);
TERN_(EXTENSIBLE_UI, ExtUI::onSettingsLoaded(success));
return success;
}

// Otherwise reset settings to default "factory settings"
reset();

// Options to overwrite the EEPROM on error
#if ANY(EEPROM_AUTO_INIT, EEPROM_INIT_NOW)
(void)save();
SERIAL_ECHO_MSG("EEPROM Initialized");
(void)init_eeprom();
LCD_MESSAGE(MSG_EEPROM_INITIALIZED);
SERIAL_ECHO_MSG(STR_EEPROM_INITIALIZED);
#endif

return false;
}

Expand Down

0 comments on commit 81760d6

Please sign in to comment.