change the ac state to correct mode

This commit is contained in:
reaw55 2024-03-30 14:56:50 +07:00
parent 20d38ec7ac
commit 21948a86d8
2 changed files with 26 additions and 27 deletions

View file

@ -22,7 +22,7 @@ void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCar
auto bindedHandleTouch = std::bind(&ISEDisplay::handleTouch, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); auto bindedHandleTouch = std::bind(&ISEDisplay::handleTouch, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
this->outputCallbackHandle = this->outputCard->registerChangeCallback(bindedHandlePWMChange); this->outputCallbackHandle = this->outputCard->registerChangeCallback(bindedHandlePWMChange);
this->climateCallbackHandle = this->climateCard_daikin->registerChangeCallback(bindedHandleACChange); this->climateCallbackHandle = this->climateCard_daikin->registerChangeCallback(bindedHandleACChange);
this->user_mode = 1; // initialized to cool by default this->user_mode = 2; // initialized to cool by default
this->pm_fan_speed = 10; this->pm_fan_speed = 10;
//remote_pm_fan_speed->setValue(pm_fan_speed); //remote_pm_fan_speed->setValue(pm_fan_speed);
this->ac_fan_speed = 0; this->ac_fan_speed = 0;
@ -862,14 +862,6 @@ void ISEDisplay::updateuserACmode()
switch (user_mode) switch (user_mode)
{ {
case 1: case 1:
this->displayAdapter->print("ac_mode.pic=");
this->displayAdapter->print(COMPONENT_AC_MODE_COOL_PIC);
this->sendStopBytes();
this->displayAdapter->print("ac_mode.pic2=");
this->displayAdapter->print(COMPONENT_AC_MODE_COOL_PIC_PRESSED);
this->sendStopBytes();
break;
case 2:
this->displayAdapter->print("ac_mode.pic="); this->displayAdapter->print("ac_mode.pic=");
this->displayAdapter->print(COMPONENT_AC_MODE_FAN_PIC); this->displayAdapter->print(COMPONENT_AC_MODE_FAN_PIC);
this->sendStopBytes(); this->sendStopBytes();
@ -877,6 +869,14 @@ void ISEDisplay::updateuserACmode()
this->displayAdapter->print(COMPONENT_AC_MODE_FAN_PIC_PRESSED); this->displayAdapter->print(COMPONENT_AC_MODE_FAN_PIC_PRESSED);
this->sendStopBytes(); this->sendStopBytes();
break; break;
case 2:
this->displayAdapter->print("ac_mode.pic=");
this->displayAdapter->print(COMPONENT_AC_MODE_COOL_PIC);
this->sendStopBytes();
this->displayAdapter->print("ac_mode.pic2=");
this->displayAdapter->print(COMPONENT_AC_MODE_COOL_PIC_PRESSED);
this->sendStopBytes();
break;
default: default:
break; break;
} }

View file

@ -245,24 +245,23 @@ void loop()
{ {
espmega.loop(); espmega.loop();
iseDisplay.loop(); iseDisplay.loop();
// //loop set york ac state between 21 and 22 degree and mode to 1 every 5 seconds
//loop set york ac state between 21 and 22 degree every 5 seconds // static uint32_t last_ac_update = 0;
static uint32_t last_ac_update = 0; // if (millis() - last_ac_update > 5000)
if (millis() - last_ac_update > 5000) // {
{ // uint8_t ac_temperature = climateCard_york.getTemperature();
uint8_t ac_temperature = climateCard_york.getTemperature(); // if (ac_temperature == 21)
if (ac_temperature == 21) // {
{ // ESP_LOGV("AC", "Setting AC temperature to 22");
ESP_LOGV("AC", "Setting AC temperature to 22"); // climateCard_york.setState(2, 1, 22);
climateCard_york.setTemperature(22); // }
} // else
else // {
{ // ESP_LOGV("AC", "Setting AC temperature to 21");
ESP_LOGV("AC", "Setting AC temperature to 21"); // climateCard_york.setState(2, 1, 21);
climateCard_york.setTemperature(21); // }
} // last_ac_update = millis();
last_ac_update = millis(); // }
}
// Update the time every 15 seconds // Update the time every 15 seconds