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

This reverts commit 108d0df565.
This commit is contained in:
Scott Lahteine 2019-07-03 19:11:30 -05:00
parent b7573c6e69
commit de462f2b8a
6 changed files with 15 additions and 31 deletions

View File

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

View File

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

View File

@ -941,9 +941,7 @@ void setup() {
// Load data from EEPROM if available (or use defaults) // Load data from EEPROM if available (or use defaults)
// This also updates variables in the planner, elsewhere // This also updates variables in the planner, elsewhere
#if DISABLED(SD_EEPROM_EMULATION)
(void)settings.load(); (void)settings.load();
#endif
#if HAS_M206_COMMAND #if HAS_M206_COMMAND
// Initialize current position based on home_offset // Initialize current position based on home_offset
@ -1096,19 +1094,10 @@ void setup() {
init_closedloop(); init_closedloop();
#endif #endif
#if !HAS_SPI_LCD #if ENABLED(INIT_SDCARD_ON_BOOT) && !HAS_SPI_LCD
#if ENABLED(SD_EEPROM_EMULATION)
SERIAL_ECHOLNPGM("Loading settings from SD");
(void)settings.load();
#endif
#if ENABLED(INIT_SDCARD_ON_BOOT)
card.beginautostart(); card.beginautostart();
#endif #endif
#endif
#if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF) #if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF)
test_tmc_connection(true, true, true, true); test_tmc_connection(true, true, true, true);
#endif #endif

View File

@ -1734,7 +1734,3 @@
#define INIT_SDCARD_ON_BOOT #define INIT_SDCARD_ON_BOOT
#endif #endif
#endif #endif
#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
#define SD_EEPROM_EMULATION
#endif

View File

@ -81,10 +81,6 @@
#include "../Marlin.h" #include "../Marlin.h"
#if ENABLED(SD_EEPROM_EMULATION)
#include "../module/configuration_store.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
#include "../feature/power_loss_recovery.h" #include "../feature/power_loss_recovery.h"
#endif #endif
@ -787,13 +783,8 @@ void MarlinUI::update() {
if (sd_status) { if (sd_status) {
safe_delay(500); // Some boards need a delay to get settled safe_delay(500); // Some boards need a delay to get settled
card.initsd(); card.initsd();
if (old_sd_status == 2) { if (old_sd_status == 2)
#if ENABLED(SD_EEPROM_EMULATION)
SERIAL_ECHOLNPGM("Loading settings from SD");
(void)settings.load();
#endif
card.beginautostart(); // Initial boot card.beginautostart(); // Initial boot
}
else else
set_status_P(PSTR(MSG_SD_INSERTED)); set_status_P(PSTR(MSG_SD_INSERTED));
} }

View File

@ -353,6 +353,9 @@ void CardReader::initsd() {
else { else {
flag.detected = true; flag.detected = true;
SERIAL_ECHO_MSG(MSG_SD_CARD_OK); SERIAL_ECHO_MSG(MSG_SD_CARD_OK);
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
(void)settings.load();
#endif
} }
setroot(); setroot();
@ -558,6 +561,11 @@ void CardReader::checkautostart() {
if (!isDetected()) initsd(); if (!isDetected()) initsd();
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
SERIAL_ECHOLNPGM("Loading settings from SD");
(void)settings.load();
#endif
if (isDetected() if (isDetected()
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
&& !recovery.valid() // Don't run auto#.g when a resume file exists && !recovery.valid() // Don't run auto#.g when a resume file exists