Browse Source

[2.0.x] EEPROM code cleanup (#10710)

Giuliano 6 years ago
parent
commit
d99f1b2245

+ 4
- 7
Marlin/src/module/configuration_store.cpp View File

@@ -954,7 +954,6 @@ void MarlinSettings::postprocess() {
954 954
         SERIAL_ECHOPAIR_P(port, "(EEPROM=", stored_ver);
955 955
         SERIAL_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")");
956 956
       #endif
957
-      if (!validating) reset();
958 957
       eeprom_error = true;
959 958
     }
960 959
     else {
@@ -1511,15 +1510,13 @@ void MarlinSettings::postprocess() {
1511 1510
         #endif
1512 1511
       }
1513 1512
 
1514
-      if (!validating) {
1515
-        if (eeprom_error) reset(); else postprocess();
1516
-      }
1513
+      if (!validating && !eeprom_error) postprocess();
1517 1514
 
1518 1515
       #if ENABLED(AUTO_BED_LEVELING_UBL)
1519
-        ubl.report_state();
1520
-
1521 1516
         if (!validating) {
1522
-          if (!ubl.sanity_check()) {
1517
+            ubl.report_state();
1518
+
1519
+            if (!ubl.sanity_check()) {
1523 1520
             SERIAL_EOL_P(port);
1524 1521
             #if ENABLED(EEPROM_CHITCHAT)
1525 1522
               ubl.echo_name();

+ 4
- 3
Marlin/src/module/configuration_store.h View File

@@ -45,15 +45,16 @@ class MarlinSettings {
45 45
     static bool save(PORTINIT_SOLO);    // Return 'true' if data was saved
46 46
 
47 47
     FORCE_INLINE static bool init_eeprom() {
48
-      bool success = true;
49 48
       reset();
50 49
       #if ENABLED(EEPROM_SETTINGS)
51
-        success = save();
50
+        const bool success = save();
52 51
         #if ENABLED(EEPROM_CHITCHAT)
53 52
           if (success) report();
54 53
         #endif
54
+        return success;
55
+      #else
56
+        return true;
55 57
       #endif
56
-      return success;
57 58
     }
58 59
 
59 60
     #if ENABLED(EEPROM_SETTINGS)

Loading…
Cancel
Save