fram saving feature

This commit is contained in:
Siwat Sirichai 2023-12-30 13:52:32 +07:00
parent 1ee4209e3c
commit b1dd128aa1
1 changed files with 7 additions and 0 deletions

View File

@ -86,18 +86,24 @@ void ClimateCard::setTemperature(uint8_t temperature)
{ {
this->state.ac_temperature = temperature; this->state.ac_temperature = temperature;
updateAirConditioner(); updateAirConditioner();
if (fram_auto_save)
saveStateToFRAM();
} }
void ClimateCard::setMode(uint8_t mode) void ClimateCard::setMode(uint8_t mode)
{ {
this->state.ac_mode = mode; this->state.ac_mode = mode;
updateAirConditioner(); updateAirConditioner();
if (fram_auto_save)
saveStateToFRAM();
} }
void ClimateCard::setFanSpeed(uint8_t fan_speed) void ClimateCard::setFanSpeed(uint8_t fan_speed)
{ {
this->state.ac_fan_speed = fan_speed; this->state.ac_fan_speed = fan_speed;
updateAirConditioner(); updateAirConditioner();
if (fram_auto_save)
saveStateToFRAM();
} }
void ClimateCard::registerCallback(std::function<void(uint8_t, uint8_t, uint8_t)> callback) void ClimateCard::registerCallback(std::function<void(uint8_t, uint8_t, uint8_t)> callback)
@ -146,6 +152,7 @@ void ClimateCard::updateAirConditioner()
{ {
callbacks[i](this->state.ac_temperature, this->state.ac_mode, this->state.ac_fan_speed); callbacks[i](this->state.ac_temperature, this->state.ac_mode, this->state.ac_fan_speed);
} }
} }
float ClimateCard::getRoomTemperature() float ClimateCard::getRoomTemperature()