This commit is contained in:
debsahu 2018-04-08 18:18:33 -04:00
parent 5f39f9429a
commit 09a26a750b
2 changed files with 9 additions and 2 deletions

View file

@ -24,6 +24,11 @@
#include <ArduinoOTA.h>
#endif
//SPIFFS Save
#if !defined(ENABLE_HOMEASSISTANT) and defined(ENABLE_STATE_SAVE_SPIFFS)
#include <ArduinoJson.h> //
#endif
// MQTT
#ifdef ENABLE_MQTT
#include <PubSubClient.h>
@ -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) {

View file

@ -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;