From 804a6bb13dc7399006b460703fcf20bf2f2fe61c Mon Sep 17 00:00:00 2001 From: bdring Date: Mon, 20 Jul 2020 19:37:27 -0500 Subject: [PATCH] Fixed settings reset error due to Startup gcode line name change. - Line0 vs N0 --- Grbl_Esp32/ProcessSettings.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Grbl_Esp32/ProcessSettings.cpp b/Grbl_Esp32/ProcessSettings.cpp index a72cdc72..68cc5e14 100644 --- a/Grbl_Esp32/ProcessSettings.cpp +++ b/Grbl_Esp32/ProcessSettings.cpp @@ -43,13 +43,14 @@ void settings_restore(uint8_t restore_flag) { } #endif if (restore_flag & SETTINGS_RESTORE_DEFAULTS) { - for (Setting *s = Setting::List; s; s = s->next()) { - bool restore_startup = restore_flag & SETTINGS_RESTORE_STARTUP_LINES; + bool restore_startup = restore_flag & SETTINGS_RESTORE_STARTUP_LINES; + for (Setting* s = Setting::List; s; s = s->next()) { if (!s->getDescription()) { - const char *name = s->getName(); - if (restore_startup || ((strcmp(name, "N0") != 0) && (strcmp(name, "N1") == 0))) { + const char* name = s->getName(); + if (restore_startup) // all settings get restored + s->setDefault(); + else if ((strcmp(name, "Line0") != 0) && (strcmp(name, "Line1") != 0)) // non startup settings get restored s->setDefault(); - } } } }