From e43f3ac989973825b35af8f897f3c9c7e6533185 Mon Sep 17 00:00:00 2001 From: Tannoo Date: Mon, 1 Jan 2018 14:18:25 -0700 Subject: [PATCH] EEPROM init fix --- Marlin/src/lcd/ultralcd.cpp | 3 +-- Marlin/src/module/configuration_store.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f7cf9594f5..28f80c5056 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -3209,8 +3209,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(); } diff --git a/Marlin/src/module/configuration_store.h b/Marlin/src/module/configuration_store.h index bee11f0c81..d27f374f93 100644 --- a/Marlin/src/module/configuration_store.h +++ b/Marlin/src/module/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();