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 (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 if (dur > WLED_LONG_FACTORY_RESET) { // factory reset if pressed > 10 seconds
WLED_FS.format(); WLED_FS.format();
#ifdef WLED_ADD_EEPROM_SUPPORT
clearEEPROM(); clearEEPROM();
#endif
doReboot = true; doReboot = true;
} else { } else {
WLED::instance().initAP(true); WLED::instance().initAP(true);

View File

@ -507,7 +507,9 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
void deserializeConfigFromFS() { void deserializeConfigFromFS() {
bool success = deserializeConfigSec(); bool success = deserializeConfigSec();
if (!success) { //if file does not exist, try reading from EEPROM if (!success) { //if file does not exist, try reading from EEPROM
#ifdef WLED_ADD_EEPROM_SUPPORT
deEEPSettings(); deEEPSettings();
#endif
return; return;
} }
@ -517,7 +519,9 @@ void deserializeConfigFromFS() {
success = readObjectFromFile("/cfg.json", nullptr, &doc); success = readObjectFromFile("/cfg.json", nullptr, &doc);
if (!success) { //if file does not exist, try reading from EEPROM if (!success) { //if file does not exist, try reading from EEPROM
#ifdef WLED_ADD_EEPROM_SUPPORT
deEEPSettings(); deEEPSettings();
#endif
releaseJSONBufferLock(); releaseJSONBufferLock();
return; 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); uint16_t crc16(const unsigned char* data_p, size_t length);
um_data_t* simulateSound(uint8_t simulationId); um_data_t* simulateSound(uint8_t simulationId);
#ifdef WLED_ADD_EEPROM_SUPPORT
//wled_eeprom.cpp //wled_eeprom.cpp
void applyMacro(byte index); void applyMacro(byte index);
void deEEP(); void deEEP();
void deEEPSettings(); void deEEPSettings();
void clearEEPROM(); void clearEEPROM();
#endif
//wled_math.cpp //wled_math.cpp
#ifndef WLED_USE_REAL_MATH #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 if (request->hasArg(F("RS"))) //complete factory reset
{ {
WLED_FS.format(); WLED_FS.format();
#ifdef WLED_ADD_EEPROM_SUPPORT
clearEEPROM(); clearEEPROM();
#endif
serveMessage(request, 200, F("All Settings erased."), F("Connect to WLED-AP to setup again"),255); serveMessage(request, 200, F("All Settings erased."), F("Connect to WLED-AP to setup again"),255);
doReboot = true; doReboot = true;
} }

View File

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

View File

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

View File

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