From d3139e47f8bae8c0e02540d08581890a1e2a2e0e Mon Sep 17 00:00:00 2001 From: Tannoo Date: Wed, 3 Jan 2018 03:28:15 -0700 Subject: [PATCH] [1.1.x] EEPROM init fix (#9002) --- Marlin/configuration_store.h | 15 +++++++++++++++ Marlin/ultralcd.cpp | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Marlin/configuration_store.h b/Marlin/configuration_store.h index e152e48f761..aa25115eb28 100644 --- a/Marlin/configuration_store.h +++ b/Marlin/configuration_store.h @@ -32,6 +32,21 @@ class MarlinSettings { static void reset(); static bool save(); + FORCE_INLINE static bool init_eeprom() { + bool success = true; + reset(); + #if ENABLED(EEPROM_SETTINGS) + if ((success = save())) { + #if ENABLED(AUTO_BED_LEVELING_UBL) + success = load(); // UBL uses load() to know the end of EEPROM + #elif ENABLED(EEPROM_CHITCHAT) + report(); + #endif + } + #endif + return success; + } + #if ENABLED(EEPROM_SETTINGS) static bool load(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 96bbcee61a4..2ee381ab718 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -3127,8 +3127,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(EEPROM_SETTINGS) static void lcd_init_eeprom() { - lcd_factory_settings(); - settings.save(); + lcd_completion_feedback(settings.init_eeprom()); lcd_goto_previous_menu(); }