fix standby picture not toggling

This commit is contained in:
reaw 2024-02-16 13:46:02 +07:00
parent b537d3921e
commit 44687da028

View file

@ -782,13 +782,7 @@ void ISEDisplay::updateAirPurifierStateStandby()
void ISEDisplay::updateAirPurifierState()
{
//check for page
if(currentPage != 2){
return;
}
else if(currentPage ==1){
updateAirPurifierStateStandby();
return;
}
if(currentPage != 1){
// Get the state
bool state = strcmp(pm_switch->getValue(), "on") == 0;
ESP_LOGI("ISEDisplay", "Updating air purifier state to: %d", state);
@ -814,6 +808,13 @@ void ISEDisplay::updateAirPurifierState()
this->sendStopBytes();
this->giveSerialMutex();
return;
}
else if(currentPage == 1){
updateAirPurifierStateStandby();
return;
}
}
void ISEDisplay::handleACChange(uint8_t mode, uint8_t fan_speed, uint8_t temperature)
{
@ -898,7 +899,7 @@ void ISEDisplay::updateACState()
// Get the state
uint8_t mode = this->climateCard->getMode();
uint8_t temperature = this->climateCard->getTemperature();
if(currentPage != 1){
this->takeSerialMutex();
// Send the state to the display
@ -939,7 +940,23 @@ void ISEDisplay::updateACState()
this->displayAdapter->print(temperature);
// this->displayAdapter->print("\"");
this->sendStopBytes();
this->giveSerialMutex();
}
else if (currentPage == 1)
{
this->takeSerialMutex();
this->displayAdapter->print("s_ac_toggle.pic=");
this->displayAdapter->print(mode != 0 ? COMPONENT_STANDBY_AC_PIC_ON : COMPONENT_STANDBY_AC_PIC_OFF);
this->sendStopBytes();
this->displayAdapter->print("s_ac_toggle.pic2=");
this->displayAdapter->print(mode != 0 ? COMPONENT_STANDBY_AC_PIC_ON_PRESSED : COMPONENT_STANDBY_AC_PIC_OFF_PRESSED);
this->sendStopBytes();
this->giveSerialMutex();
}
ESP_LOGI("ISEDisplay", "display AC state updated");
}