From d99f1b22455e21cd21744baff27f30d7964783a8 Mon Sep 17 00:00:00 2001 From: Giuliano <3684609+GMagician@users.noreply.github.com> Date: Sat, 12 May 2018 01:06:04 +0200 Subject: [PATCH] [2.0.x] EEPROM code cleanup (#10710) --- Marlin/src/module/configuration_store.cpp | 11 ++++------- Marlin/src/module/configuration_store.h | 7 ++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 2cb4c5fdc3..b0ac1fc2a0 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -954,7 +954,6 @@ void MarlinSettings::postprocess() { SERIAL_ECHOPAIR_P(port, "(EEPROM=", stored_ver); SERIAL_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")"); #endif - if (!validating) reset(); eeprom_error = true; } else { @@ -1511,15 +1510,13 @@ void MarlinSettings::postprocess() { #endif } - if (!validating) { - if (eeprom_error) reset(); else postprocess(); - } + if (!validating && !eeprom_error) postprocess(); #if ENABLED(AUTO_BED_LEVELING_UBL) - ubl.report_state(); - if (!validating) { - if (!ubl.sanity_check()) { + ubl.report_state(); + + if (!ubl.sanity_check()) { SERIAL_EOL_P(port); #if ENABLED(EEPROM_CHITCHAT) ubl.echo_name(); diff --git a/Marlin/src/module/configuration_store.h b/Marlin/src/module/configuration_store.h index 0a8ca90f1f..6ae756f48f 100644 --- a/Marlin/src/module/configuration_store.h +++ b/Marlin/src/module/configuration_store.h @@ -45,15 +45,16 @@ class MarlinSettings { static bool save(PORTINIT_SOLO); // Return 'true' if data was saved FORCE_INLINE static bool init_eeprom() { - bool success = true; reset(); #if ENABLED(EEPROM_SETTINGS) - success = save(); + const bool success = save(); #if ENABLED(EEPROM_CHITCHAT) if (success) report(); #endif + return success; + #else + return true; #endif - return success; } #if ENABLED(EEPROM_SETTINGS)