update library; adjusted update behavior

This commit is contained in:
reaw 2024-02-14 05:46:34 +07:00
parent c08a762c00
commit ee4126f0a0
3 changed files with 11 additions and 2 deletions

View file

@ -712,6 +712,14 @@ void ISEDisplay::updateAirPurifierStateStandby()
void ISEDisplay::updateAirPurifierState()
{
//check for page
if(currentPage != 2){
return;
}
else if(currentPage ==1){
updateAirPurifierStateStandby();
return;
}
// Get the state
bool state = strcmp(pm_switch->getValue(), "on") == 0;
ESP_LOGI("ISEDisplay", "Updating air purifier state to: %d", state);

View file

@ -190,9 +190,10 @@ void loop()
}
// Update the PM state every 1 seconds
static uint32_t last_pm_switch_update = 0;
if (millis() - last_pm_switch_update > 5000)
if (millis() - last_pm_switch_update > 500)
{
iseDisplay.updateAirPurifierState();
last_pm_switch_update = millis();
}
}