From 723a34d9c746d3cd971e6b9912168ec81547ac5e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Sep 2017 11:27:47 -0500 Subject: [PATCH] Add confirmation to Init EEPROM command --- Marlin/ultralcd.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index d6a9bde7b..e870fc8af 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -868,6 +868,9 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK) lcd_completion_feedback(); #endif + #if ENABLED(USER_SCRIPT_RETURN) + lcd_return_to_status(); + #endif } #if defined(USER_DESC_1) && defined(USER_GCODE_1) @@ -2998,6 +3001,23 @@ void kill_screen(const char* lcd_msg) { lcd_completion_feedback(); } + #if ENABLED(EEPROM_SETTINGS) + + static void lcd_init_eeprom() { + lcd_factory_settings(); + settings.save(); + lcd_goto_previous_menu(); + } + + static void lcd_init_eeprom_confirm() { + START_MENU(); + MENU_BACK(MSG_CONTROL); + MENU_ITEM(function, MSG_INIT_EEPROM, lcd_init_eeprom); + END_MENU(); + } + + #endif + void lcd_control_menu() { START_MENU(); MENU_BACK(MSG_MAIN); @@ -3028,7 +3048,7 @@ void kill_screen(const char* lcd_msg) { #endif MENU_ITEM(function, MSG_RESTORE_FAILSAFE, lcd_factory_settings); #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(gcode, MSG_INIT_EEPROM, PSTR("M502\nM500\nM501")); // TODO: Add "Are You Sure?" step + MENU_ITEM(submenu, MSG_INIT_EEPROM, lcd_init_eeprom_confirm); #endif END_MENU();