[1.1.x] EEPROM code cleanup (#10711)

This commit is contained in:
Giuliano 2018-05-12 01:06:36 +02:00 committed by Scott Lahteine
parent ef9617fe44
commit 02a79cc030
2 changed files with 7 additions and 9 deletions

View File

@ -968,7 +968,6 @@ void MarlinSettings::postprocess() {
SERIAL_ECHOPAIR("(EEPROM=", stored_ver); SERIAL_ECHOPAIR("(EEPROM=", stored_ver);
SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")"); SERIAL_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")");
#endif #endif
if (!validating) reset();
eeprom_error = true; eeprom_error = true;
} }
else { else {
@ -1523,14 +1522,12 @@ void MarlinSettings::postprocess() {
#endif #endif
} }
if (!validating) { if (!validating && !eeprom_error) postprocess();
if (eeprom_error) reset(); else postprocess();
}
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.report_state();
if (!validating) { if (!validating) {
ubl.report_state();
if (!ubl.sanity_check()) { if (!ubl.sanity_check()) {
SERIAL_EOL(); SERIAL_EOL();
#if ENABLED(EEPROM_CHITCHAT) #if ENABLED(EEPROM_CHITCHAT)

View File

@ -35,15 +35,16 @@ class MarlinSettings {
static bool save(); // Return 'true' if data was saved static bool save(); // Return 'true' if data was saved
FORCE_INLINE static bool init_eeprom() { FORCE_INLINE static bool init_eeprom() {
bool success = true;
reset(); reset();
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
success = save(); const bool success = save();
#if ENABLED(EEPROM_CHITCHAT) #if ENABLED(EEPROM_CHITCHAT)
if (success) report(); if (success) report();
#endif #endif
return success;
#else
return true;
#endif #endif
return success;
} }
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)