From b1dd128aa14e44b09c55c3a7acbe2f6081386a2a Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Sat, 30 Dec 2023 13:52:32 +0700 Subject: [PATCH] fram saving feature --- Template Project/lib/ESPMegaPRO/ClimateCard.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Template Project/lib/ESPMegaPRO/ClimateCard.cpp b/Template Project/lib/ESPMegaPRO/ClimateCard.cpp index 9e2cada..1c816d9 100644 --- a/Template Project/lib/ESPMegaPRO/ClimateCard.cpp +++ b/Template Project/lib/ESPMegaPRO/ClimateCard.cpp @@ -86,18 +86,24 @@ void ClimateCard::setTemperature(uint8_t temperature) { this->state.ac_temperature = temperature; updateAirConditioner(); + if (fram_auto_save) + saveStateToFRAM(); } void ClimateCard::setMode(uint8_t mode) { this->state.ac_mode = mode; updateAirConditioner(); + if (fram_auto_save) + saveStateToFRAM(); } void ClimateCard::setFanSpeed(uint8_t fan_speed) { this->state.ac_fan_speed = fan_speed; updateAirConditioner(); + if (fram_auto_save) + saveStateToFRAM(); } void ClimateCard::registerCallback(std::function callback) @@ -146,6 +152,7 @@ void ClimateCard::updateAirConditioner() { callbacks[i](this->state.ac_temperature, this->state.ac_mode, this->state.ac_fan_speed); } + } float ClimateCard::getRoomTemperature()