fix #125
This commit is contained in:
parent
5f39f9429a
commit
09a26a750b
2 changed files with 9 additions and 2 deletions
|
@ -24,6 +24,11 @@
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//SPIFFS Save
|
||||||
|
#if !defined(ENABLE_HOMEASSISTANT) and defined(ENABLE_STATE_SAVE_SPIFFS)
|
||||||
|
#include <ArduinoJson.h> //
|
||||||
|
#endif
|
||||||
|
|
||||||
// MQTT
|
// MQTT
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
|
@ -264,7 +269,7 @@ void setup() {
|
||||||
// After connecting, parameter.getValue() will get you the configured value
|
// After connecting, parameter.getValue() will get you the configured value
|
||||||
// id/name placeholder/prompt default length
|
// id/name placeholder/prompt default length
|
||||||
#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)
|
#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!");
|
(readConfigFS()) ? DBG_OUTPUT_PORT.println("WiFiManager config FS Read success!"): DBG_OUTPUT_PORT.println("WiFiManager config FS Read failure!");
|
||||||
#else
|
#else
|
||||||
String settings_available = readEEPROM(134, 1);
|
String settings_available = readEEPROM(134, 1);
|
||||||
|
@ -325,7 +330,7 @@ void setup() {
|
||||||
strcpy(mqtt_pass, custom_mqtt_pass.getValue());
|
strcpy(mqtt_pass, custom_mqtt_pass.getValue());
|
||||||
|
|
||||||
//save the custom parameters to FS
|
//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!");
|
(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)
|
#else if defined(ENABLE_STATE_SAVE_EEPROM)
|
||||||
if (shouldSaveConfig) {
|
if (shouldSaveConfig) {
|
||||||
|
|
|
@ -1256,6 +1256,7 @@ void checkForRequests() {
|
||||||
|
|
||||||
#ifdef ENABLE_STATE_SAVE_SPIFFS
|
#ifdef ENABLE_STATE_SAVE_SPIFFS
|
||||||
bool updateFS = false;
|
bool updateFS = false;
|
||||||
|
#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)
|
||||||
// Write configuration to FS JSON
|
// Write configuration to FS JSON
|
||||||
bool writeConfigFS(bool saveConfig){
|
bool writeConfigFS(bool saveConfig){
|
||||||
if (saveConfig) {
|
if (saveConfig) {
|
||||||
|
@ -1325,6 +1326,7 @@ bool readConfigFS() {
|
||||||
updateFS = false;
|
updateFS = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool writeStateFS(){
|
bool writeStateFS(){
|
||||||
updateFS = true;
|
updateFS = true;
|
||||||
|
|
Loading…
Reference in a new issue