浏览代码

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

Tanguy Pruvot 5 年前
父节点
当前提交
108d0df565

+ 2
- 2
Marlin/src/HAL/HAL_ESP32/persistent_store_spiffs.cpp 查看文件

24
 
24
 
25
 #include "../../inc/MarlinConfig.h"
25
 #include "../../inc/MarlinConfig.h"
26
 
26
 
27
-#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
27
+#if ENABLED(SD_EEPROM_EMULATION)
28
 
28
 
29
 #include "../shared/persistent_store_api.h"
29
 #include "../shared/persistent_store_api.h"
30
 
30
 
102
 
102
 
103
 size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
103
 size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
104
 
104
 
105
-#endif // EEPROM_SETTINGS
105
+#endif // SD_EEPROM_EMULATION
106
 #endif // ARDUINO_ARCH_ESP32
106
 #endif // ARDUINO_ARCH_ESP32

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp 查看文件

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

+ 14
- 3
Marlin/src/Marlin.cpp 查看文件

941
 
941
 
942
   // Load data from EEPROM if available (or use defaults)
942
   // Load data from EEPROM if available (or use defaults)
943
   // This also updates variables in the planner, elsewhere
943
   // This also updates variables in the planner, elsewhere
944
-  (void)settings.load();
944
+  #if DISABLED(SD_EEPROM_EMULATION)
945
+    (void)settings.load();
946
+  #endif
945
 
947
 
946
   #if HAS_M206_COMMAND
948
   #if HAS_M206_COMMAND
947
     // Initialize current position based on home_offset
949
     // Initialize current position based on home_offset
1094
     init_closedloop();
1096
     init_closedloop();
1095
   #endif
1097
   #endif
1096
 
1098
 
1097
-  #if ENABLED(INIT_SDCARD_ON_BOOT) && !HAS_SPI_LCD
1098
-    card.beginautostart();
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
+
1099
   #endif
1110
   #endif
1100
 
1111
 
1101
   #if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)
1112
   #if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)

+ 4
- 0
Marlin/src/inc/Conditionals_post.h 查看文件

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

+ 10
- 1
Marlin/src/lcd/ultralcd.cpp 查看文件

81
 
81
 
82
 #include "../Marlin.h"
82
 #include "../Marlin.h"
83
 
83
 
84
+#if ENABLED(SD_EEPROM_EMULATION)
85
+  #include "../module/configuration_store.h"
86
+#endif
87
+
84
 #if ENABLED(POWER_LOSS_RECOVERY)
88
 #if ENABLED(POWER_LOSS_RECOVERY)
85
   #include "../feature/power_loss_recovery.h"
89
   #include "../feature/power_loss_recovery.h"
86
 #endif
90
 #endif
783
       if (sd_status) {
787
       if (sd_status) {
784
         safe_delay(500); // Some boards need a delay to get settled
788
         safe_delay(500); // Some boards need a delay to get settled
785
         card.initsd();
789
         card.initsd();
786
-        if (old_sd_status == 2)
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
787
           card.beginautostart();  // Initial boot
795
           card.beginautostart();  // Initial boot
796
+        }
788
         else
797
         else
789
           set_status_P(PSTR(MSG_SD_INSERTED));
798
           set_status_P(PSTR(MSG_SD_INSERTED));
790
       }
799
       }

+ 0
- 8
Marlin/src/sd/cardreader.cpp 查看文件

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

正在加载...
取消
保存