From 2173d1a4e554d48b6b72330d51ca5518ed2b44a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sun, 28 Aug 2016 13:28:18 +0200 Subject: [PATCH] Save settings only if they have changed --- code/src/settings.ino | 6 ++++++ code/src/webserver.ino | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/code/src/settings.ino b/code/src/settings.ino index cad34b9b..940df7ce 100644 --- a/code/src/settings.ino +++ b/code/src/settings.ino @@ -31,6 +31,9 @@ void settingsSetup() { []() {} #endif ); + #if DEBUG + Serial.println("[SETTINGS] Initialized"); + #endif } void settingsLoop() { @@ -52,6 +55,9 @@ bool delSetting(const String& key) { } void saveSettings() { + #if DEBUG + Serial.println("[SETTINGS] Saving"); + #endif #if not AUTO_SAVE EEPROM.commit(); #endif diff --git a/code/src/webserver.ino b/code/src/webserver.ino index 80bf3185..95c45bfd 100644 --- a/code/src/webserver.ino +++ b/code/src/webserver.ino @@ -156,7 +156,8 @@ void handleSave() { Serial.println(F("[WEBSERVER] Request: /save")); #endif - bool disconnectMQTT = false; + bool dirty = false; + bool dirtyMQTT = false; for (unsigned int i=0; i