Browse Source

Revert "Sort out settings.load with SD EEPROM emulation (#14458)"

This reverts commit 108d0df565.
Scott Lahteine 5 years ago
parent
commit
de462f2b8a

+ 2
- 2
Marlin/src/HAL/HAL_ESP32/persistent_store_spiffs.cpp View File

@@ -24,7 +24,7 @@
24 24
 
25 25
 #include "../../inc/MarlinConfig.h"
26 26
 
27
-#if ENABLED(SD_EEPROM_EMULATION)
27
+#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
28 28
 
29 29
 #include "../shared/persistent_store_api.h"
30 30
 
@@ -102,5 +102,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
102 102
 
103 103
 size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
104 104
 
105
-#endif // SD_EEPROM_EMULATION
105
+#endif // EEPROM_SETTINGS
106 106
 #endif // ARDUINO_ARCH_ESP32

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp View File

@@ -28,7 +28,7 @@
28 28
 
29 29
 #include "../../inc/MarlinConfig.h"
30 30
 
31
-#if ENABLED(SD_EEPROM_EMULATION)
31
+#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
32 32
 
33 33
 #include "../shared/persistent_store_api.h"
34 34
 

+ 3
- 14
Marlin/src/Marlin.cpp View File

@@ -941,9 +941,7 @@ void setup() {
941 941
 
942 942
   // Load data from EEPROM if available (or use defaults)
943 943
   // This also updates variables in the planner, elsewhere
944
-  #if DISABLED(SD_EEPROM_EMULATION)
945
-    (void)settings.load();
946
-  #endif
944
+  (void)settings.load();
947 945
 
948 946
   #if HAS_M206_COMMAND
949 947
     // Initialize current position based on home_offset
@@ -1096,17 +1094,8 @@ void setup() {
1096 1094
     init_closedloop();
1097 1095
   #endif
1098 1096
 
1099
-  #if !HAS_SPI_LCD
1100
-
1101
-    #if ENABLED(SD_EEPROM_EMULATION)
1102
-      SERIAL_ECHOLNPGM("Loading settings from SD");
1103
-      (void)settings.load();
1104
-    #endif
1105
-
1106
-    #if ENABLED(INIT_SDCARD_ON_BOOT)
1107
-      card.beginautostart();
1108
-    #endif
1109
-
1097
+  #if ENABLED(INIT_SDCARD_ON_BOOT) && !HAS_SPI_LCD
1098
+    card.beginautostart();
1110 1099
   #endif
1111 1100
 
1112 1101
   #if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)

+ 0
- 4
Marlin/src/inc/Conditionals_post.h View File

@@ -1734,7 +1734,3 @@
1734 1734
     #define INIT_SDCARD_ON_BOOT
1735 1735
   #endif
1736 1736
 #endif
1737
-
1738
-#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
1739
-  #define SD_EEPROM_EMULATION
1740
-#endif

+ 1
- 10
Marlin/src/lcd/ultralcd.cpp View File

@@ -81,10 +81,6 @@
81 81
 
82 82
 #include "../Marlin.h"
83 83
 
84
-#if ENABLED(SD_EEPROM_EMULATION)
85
-  #include "../module/configuration_store.h"
86
-#endif
87
-
88 84
 #if ENABLED(POWER_LOSS_RECOVERY)
89 85
   #include "../feature/power_loss_recovery.h"
90 86
 #endif
@@ -787,13 +783,8 @@ void MarlinUI::update() {
787 783
       if (sd_status) {
788 784
         safe_delay(500); // Some boards need a delay to get settled
789 785
         card.initsd();
790
-        if (old_sd_status == 2) {
791
-          #if ENABLED(SD_EEPROM_EMULATION)
792
-            SERIAL_ECHOLNPGM("Loading settings from SD");
793
-            (void)settings.load();
794
-          #endif
786
+        if (old_sd_status == 2)
795 787
           card.beginautostart();  // Initial boot
796
-        }
797 788
         else
798 789
           set_status_P(PSTR(MSG_SD_INSERTED));
799 790
       }

+ 8
- 0
Marlin/src/sd/cardreader.cpp View File

@@ -353,6 +353,9 @@ void CardReader::initsd() {
353 353
   else {
354 354
     flag.detected = true;
355 355
     SERIAL_ECHO_MSG(MSG_SD_CARD_OK);
356
+    #if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
357
+      (void)settings.load();
358
+    #endif
356 359
   }
357 360
   setroot();
358 361
 
@@ -558,6 +561,11 @@ void CardReader::checkautostart() {
558 561
 
559 562
   if (!isDetected()) initsd();
560 563
 
564
+  #if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
565
+    SERIAL_ECHOLNPGM("Loading settings from SD");
566
+    (void)settings.load();
567
+  #endif
568
+
561 569
   if (isDetected()
562 570
     #if ENABLED(POWER_LOSS_RECOVERY)
563 571
       && !recovery.valid() // Don't run auto#.g when a resume file exists

Loading…
Cancel
Save