Deprecate EEPROM support (compile time option).

This commit is contained in:
Blaz Kristan 2022-07-30 11:04:04 +02:00
parent b0ba1b2ecc
commit 1abf0fc134
7 changed files with 21 additions and 4 deletions

View File

@ -265,7 +265,9 @@ void handleButton()
if (b == 0 && dur > WLED_LONG_AP) { // long press on button 0 (when released)
if (dur > WLED_LONG_FACTORY_RESET) { // factory reset if pressed > 10 seconds
WLED_FS.format();
#ifdef WLED_ADD_EEPROM_SUPPORT
clearEEPROM();
#endif
doReboot = true;
} else {
WLED::instance().initAP(true);

View File

@ -507,7 +507,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
void deserializeConfigFromFS() {
bool success = deserializeConfigSec();
if (!success) { //if file does not exist, try reading from EEPROM
#ifdef WLED_ADD_EEPROM_SUPPORT
deEEPSettings();
#endif
return;
}
@ -517,7 +519,9 @@ void deserializeConfigFromFS() {
success = readObjectFromFile("/cfg.json", nullptr, &doc);
if (!success) { //if file does not exist, try reading from EEPROM
#ifdef WLED_ADD_EEPROM_SUPPORT
deEEPSettings();
#endif
releaseJSONBufferLock();
return;
}

View File

@ -329,11 +329,13 @@ int16_t extractModeDefaults(uint8_t mode, const char *segVar);
uint16_t crc16(const unsigned char* data_p, size_t length);
um_data_t* simulateSound(uint8_t simulationId);
#ifdef WLED_ADD_EEPROM_SUPPORT
//wled_eeprom.cpp
void applyMacro(byte index);
void deEEP();
void deEEPSettings();
void clearEEPROM();
#endif
//wled_math.cpp
#ifndef WLED_USE_REAL_MATH

View File

@ -398,7 +398,9 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (request->hasArg(F("RS"))) //complete factory reset
{
WLED_FS.format();
#ifdef WLED_ADD_EEPROM_SUPPORT
clearEEPROM();
#endif
serveMessage(request, 200, F("All Settings erased."), F("Connect to WLED-AP to setup again"),255);
doReboot = true;
}

View File

@ -314,7 +314,10 @@ void WLED::setup()
if (!fsinit) {
DEBUGFS_PRINTLN(F("FS failed!"));
errorFlag = ERR_FS_BEGIN;
} else deEEP();
}
#ifdef WLED_ADD_EEPROM_SUPPORT
else deEEP();
#endif
updateFSInfo();
DEBUG_PRINTLN(F("Reading config"));

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2207293
#define VERSION 2207301
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG
@ -94,7 +94,9 @@
#endif
#include <ESPAsyncWebServer.h>
#include <EEPROM.h>
#ifdef WLED_ADD_EEPROM_SUPPORT
#include <EEPROM.h>
#endif
#include <WiFiUdp.h>
#include <DNSServer.h>
#ifndef WLED_DISABLE_OTA

View File

@ -1,3 +1,4 @@
#ifdef WLED_ADD_EEPROM_SUPPORT
#include <EEPROM.h>
#include "wled.h"
@ -472,4 +473,5 @@ void deEEPSettings() {
usermods.readFromConfig(empty);
serializeConfig();
}
}
#endif