diff --git a/Arduino/McLighting/McLighting.ino b/Arduino/McLighting/McLighting.ino index 9d913c1..b4142a2 100644 --- a/Arduino/McLighting/McLighting.ino +++ b/Arduino/McLighting/McLighting.ino @@ -24,6 +24,11 @@ #include #endif +//SPIFFS Save +#if !defined(ENABLE_HOMEASSISTANT) and defined(ENABLE_STATE_SAVE_SPIFFS) + #include // +#endif + // MQTT #ifdef ENABLE_MQTT #include @@ -264,7 +269,7 @@ void setup() { // After connecting, parameter.getValue() will get you the configured value // id/name placeholder/prompt default length #if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT) - #if defined(ENABLE_STATE_SAVE_SPIFFS) + #if defined(ENABLE_STATE_SAVE_SPIFFS) and (defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)) (readConfigFS()) ? DBG_OUTPUT_PORT.println("WiFiManager config FS Read success!"): DBG_OUTPUT_PORT.println("WiFiManager config FS Read failure!"); #else String settings_available = readEEPROM(134, 1); @@ -325,7 +330,7 @@ void setup() { strcpy(mqtt_pass, custom_mqtt_pass.getValue()); //save the custom parameters to FS - #if defined(ENABLE_STATE_SAVE_SPIFFS) + #if defined(ENABLE_STATE_SAVE_SPIFFS) and (defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)) (writeConfigFS(shouldSaveConfig)) ? DBG_OUTPUT_PORT.println("WiFiManager config FS Save success!"): DBG_OUTPUT_PORT.println("WiFiManager config FS Save failure!"); #else if defined(ENABLE_STATE_SAVE_EEPROM) if (shouldSaveConfig) { diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index 9f84d8d..13b5067 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -1256,6 +1256,7 @@ void checkForRequests() { #ifdef ENABLE_STATE_SAVE_SPIFFS bool updateFS = false; +#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT) // Write configuration to FS JSON bool writeConfigFS(bool saveConfig){ if (saveConfig) { @@ -1325,6 +1326,7 @@ bool readConfigFS() { updateFS = false; return false; } +#endif bool writeStateFS(){ updateFS = true;