change AC behavior; comfirmed work

This commit is contained in:
reaw55 2024-04-22 14:26:40 +07:00
parent d4b36336cd
commit 553eae0566
5 changed files with 59 additions and 9 deletions

Binary file not shown.

View file

@ -14,4 +14,4 @@ board = wt32-eth01
framework = arduino
lib_deps = siwats/ESPMegaPROR3@^2.5.3
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=5
build_flags = -DCORE_DEBUG_LEVEL=0

View file

@ -49,6 +49,7 @@ void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCar
delay(100);
this->updateAirPurifierState();
this->updateSystemtoggle();
this->updateAllStandbyToggle();
this->updateACState();
this->updateLightGroupStatePageDashboard();
@ -65,7 +66,7 @@ void ISEDisplay::loop()
recieveSerialCommand();
// Check if the AC state has been changed
if (ac_press_pending && (millis() - time_since_last_ac_change) > 5000)
if (ac_press_pending && (millis() - time_since_last_ac_change) > 500)
{
ESP_LOGI("ISEDisplay", "Sending AC IR code");
sendACIRcode();
@ -74,7 +75,7 @@ void ISEDisplay::loop()
ESP_LOGI("ISEDisplay", "AC press pending set to false");
}
// check for ac staggered start
if (ac_staggered_start_call_pending && (millis() - time_since_ac_staggered_start_call) > 1000)
if (ac_staggered_start_call_pending && (millis() - time_since_ac_staggered_start_call) > 3000)
{
ESP_LOGI("ISEDisplay", "Sending Staggered AC IR code (York)");
sendACIRcode();
@ -148,10 +149,15 @@ void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type
{
switch (component)
{
case COMPONENT_OBJ_STANDBY_LOGO:
if (touch_type != TOUCH_TYPE_RELEASE)
break;
//this->jumpToPage(2);
break;
case COMPONENT_OBJ_STANDBY_BTN_OPEN_ALL_TOGGLE:
if (touch_type != TOUCH_TYPE_RELEASE)
break;
allOn();
//allToggleStandby();
this->jumpToPage(2);
// the function of the button is to open the dashboard from standby
break;
@ -325,6 +331,7 @@ void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type
case COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_MASTER_LIGHT:
break;
case COMPONENT_OBJ_DASHBOARD_LOGO:
jumpToPage(1);
break;
case COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_PM_LOCK:
if (touch_type != TOUCH_TYPE_RELEASE)
@ -444,6 +451,7 @@ void ISEDisplay::handlePWMChange(uint8_t pin, bool state, uint16_t value)
{
// Light
updateLightGroupStatePageStandby();
updateAllStandbyToggle();
// time_since_last_screen_update = millis(); // update time since last activity
}
}
@ -567,6 +575,7 @@ void ISEDisplay::setACstate(uint8_t ac_fan_speed, uint8_t ac_mode, uint8_t ac_te
this->ac_press_pending = true;
updateACState();
updateSystemtoggle();
updateAllStandbyToggle();
}
void ISEDisplay::sendACIRcode()
{
@ -1162,13 +1171,50 @@ void ISEDisplay::toggleSystem()
togglePM();
}
}
void ISEDisplay::allOn()
void ISEDisplay::allToggleStandby()
{
setLightGroupState(3);
setPMstate(true, pm_fan_speed);
bool lightState = calculateLightGroupState();
bool pmState = strcmp(pm_switch->getValue(), "on") == 0;
if (ac_mode != 0)
{
setACstate(0, ac_fan_speed, ac_temperature);
}
else{
setACstate(2, ac_fan_speed, ac_temperature);
}
}
if (lightState)
{
setLightGroupState(0);
}
else
{
setLightGroupState(3);
}
if (pmState)
{
setPMstate(false, pm_fan_speed);
}
else
{
setPMstate(true, pm_fan_speed);
}
}
void ISEDisplay::updateAllStandbyToggle()
{
bool state = calculateAllState();
if (!this->takeSerialMutex())
return;
this->displayAdapter->print("s_open_all.pic=");
this->displayAdapter->print(state ? COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_ON : COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_OFF);
this->sendStopBytes();
this->displayAdapter->print("s_open_all.pic2=");
this->displayAdapter->print(state ? COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_ON_PRESSED : COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_OFF_PRESSED);
this->sendStopBytes();
this->giveSerialMutex();
}
void ISEDisplay::toggleLightIndividual(uint8_t row)
{
// Get the current state
@ -1350,6 +1396,7 @@ void ISEDisplay::handleACChange(uint8_t mode, uint8_t fan_speed, uint8_t tempera
ESP_LOGI("ISEDisplay", "AC state changed: mode: %d, fan speed: %d, temperature: %d", mode, fan_speed, temperature);
updateACState();
updateSystemtoggle();
updateAllStandbyToggle();
}
void ISEDisplay::updateuserACmode()
{

View file

@ -31,6 +31,7 @@ class ISEDisplay : public ESPMegaDisplay {
void updateAirPurifierState();
void updateAirPurifierStateStandby();
void updateSystemtoggle();
void updateAllStandbyToggle();
void updateDateTimeText(rtctime_t time);
void updateWeather(char *weather_string);
void updateTempOutside(float temp_outside);
@ -97,7 +98,7 @@ class ISEDisplay : public ESPMegaDisplay {
void setAClockstate(bool is_ac_lock_on);
void toggleACLock();
void togglePMLock();
void allOn();
void allToggleStandby();
void toggleLightGroupState();
void toggleLightGroupStateStandby();
void toggleLightIndividual(uint8_t row);

View file

@ -346,6 +346,7 @@ void pmswitchupdatedisplay(char *value)
ESP_LOGI("PM switch", "getting PM switch state from MQTT: %d", pm_switch.getValue());
iseDisplay.updateAirPurifierState();
iseDisplay.updateSystemtoggle();
iseDisplay.updateAllStandbyToggle();
ESP_LOGI("PM switch", "toggling PM switch state from: %d to %d", pm_switch.getValue(), !pm_switch.getValue());
}
void pmlockupdatedisplay(char *value)
@ -533,6 +534,7 @@ void handlePageChange(uint8_t page)
case PAGE_STANDBY:
iseDisplay.updateLightGroupStatePageStandby();
iseDisplay.updateAirPurifierStateStandby();
iseDisplay.updateAllStandbyToggle();
break;
case PAGE_DASHBOARD:
iseDisplay.updateLightGroupStatePageDashboard();