adjust IR behaviour
This commit is contained in:
parent
6a15d99e52
commit
d4604d28c3
4 changed files with 253 additions and 133 deletions
|
|
@ -6,8 +6,9 @@ ISEDisplay::ISEDisplay(HardwareSerial *adapter, const uint8_t *light_array, uint
|
|||
this->column = column;
|
||||
}
|
||||
|
||||
void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCard, ClimateCard *climateCard_daikin, ClimateCard *climateCard_york, RemoteVariable *pm_switch, RemoteVariable *pm_fan_speed, RemoteVariable *ac_lock, RemoteVariable *pm_lock)
|
||||
void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCard, ClimateCard *climateCard_daikin, ClimateCard *climateCard_york, RemoteVariable *pm_switch, RemoteVariable *pm_fan_speed, RemoteVariable *ac_lock, RemoteVariable *pm_lock, ESPMegaIoT *iot)
|
||||
{
|
||||
this->iot = iot;
|
||||
this->inputCard = inputCard;
|
||||
this->outputCard = outputCard;
|
||||
this->climateCard_daikin = climateCard_daikin;
|
||||
|
|
@ -22,8 +23,8 @@ void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCar
|
|||
this->outputCallbackHandle = this->outputCard->registerChangeCallback(bindedHandlePWMChange);
|
||||
this->climateCallbackHandle = this->climateCard_daikin->registerChangeCallback(bindedHandleACChange);
|
||||
// this->climateCallbackHandle = this->climateCard_york->registerChangeCallback(bindedHandleACChange);
|
||||
this->user_mode = 2; // initialized to cool by default
|
||||
this->ac_lock_state = strcmp(ac_lock->getValue(), "on") == 0;// initialized to get value
|
||||
this->user_mode = 2; // initialized to cool by default
|
||||
this->ac_lock_state = strcmp(ac_lock->getValue(), "on") == 0; // initialized to get value
|
||||
this->pm_lock_state = strcmp(pm_lock->getValue(), "on") == 0; // initialized to get value
|
||||
this->pm_fan_speed = 10;
|
||||
// remote_pm_fan_speed->setValue(pm_fan_speed);
|
||||
|
|
@ -49,11 +50,10 @@ void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCar
|
|||
this->updateLightGroupStatePageDashboard();
|
||||
|
||||
// intialize AC state
|
||||
if(ac_lock_state == false)
|
||||
if (ac_lock_state == false)
|
||||
{
|
||||
setACstate(ac_fan_speed, ac_mode, ac_temperature); // default to off with temp 25 and fan on Auto
|
||||
}
|
||||
|
||||
}
|
||||
void ISEDisplay::loop()
|
||||
{
|
||||
|
|
@ -64,8 +64,11 @@ void ISEDisplay::loop()
|
|||
// Check if the AC state has been changed
|
||||
if (ac_press_pending && (millis() - time_since_last_ac_change) > 5000)
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", "Sending AC IR code");
|
||||
sendACIRcode();
|
||||
ESP_LOGI("ISEDisplay", "AC IR code sent");
|
||||
ac_press_pending = false;
|
||||
ESP_LOGI("ISEDisplay", "AC press pending set to false");
|
||||
}
|
||||
|
||||
// Check if the MQTT connection has been lost
|
||||
|
|
@ -73,23 +76,28 @@ void ISEDisplay::loop()
|
|||
if (last_mqtt_connected_check == 0)
|
||||
{
|
||||
last_mqtt_connected_check = millis() + 15000; // Wait 15 seconds before checking
|
||||
ESP_LOGD("ISE Display", "Waiting 15 seconds before checking MQTT connection");
|
||||
}
|
||||
static bool first_disconnect = true;
|
||||
// ESP_LOGI("ISEDisplay", "init first disconnect set to true");
|
||||
if (millis() - last_mqtt_connected_check > 3000)
|
||||
{
|
||||
ESP_LOGD("ISE Display", "Checking MQTT Connection, Connection is %s", this->cards.iot->mqttConnected() ? "true" : "false");
|
||||
ESP_LOGD("ISE Display", "Checking MQTT Connection, Connection is %s", this->iot->mqttConnected() ? "true" : "false");
|
||||
if (!this->iot->mqttConnected())
|
||||
|
||||
{
|
||||
|
||||
ESP_LOGI("ISEDisplay", "MQTT is disconnected");
|
||||
if (first_disconnect)
|
||||
{
|
||||
// When MQTT is disconnected, enter standalone mode
|
||||
// A/C lock is lifted
|
||||
// PM lock are lifted
|
||||
ESP_LOGI("ISEDisplay", "Entering standalone mode");
|
||||
this->ac_lock_state = false;
|
||||
ESP_LOGI("ISEDisplay", "AC lock state set to false");
|
||||
this->pm_lock_state = false;
|
||||
ESP_LOGI("ISEDisplay", "PM lock state set to false");
|
||||
first_disconnect = false;
|
||||
ESP_LOGI("ISEDisplay", "first disconnect set to false");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -97,18 +105,27 @@ void ISEDisplay::loop()
|
|||
if (first_disconnect == false)
|
||||
{
|
||||
// When MQTT is connected, exit standalone mode
|
||||
// In standalone mode, socket contactor is turned off
|
||||
// A/C lock is set
|
||||
// PM lock is set
|
||||
|
||||
ESP_LOGI("ISEDisplay", "Exiting standalone mode");
|
||||
|
||||
first_disconnect = true;
|
||||
ESP_LOGI("ISEDisplay", "first disconnect set to true");
|
||||
this->ac_lock_state = strcmp(ac_lock->getValue(), "on") == 0;
|
||||
ESP_LOGI("ISEDisplay", "AC lock state set to %d", this->ac_lock_state);
|
||||
this->pm_lock_state = strcmp(pm_lock->getValue(), "on") == 0;
|
||||
ESP_LOGI("ISEDisplay", "PM lock state set to %d", this->pm_lock_state);
|
||||
updateACState();
|
||||
ESP_LOGI("ISEDisplay", "AC state updated");
|
||||
updateAirPurifierState();
|
||||
ESP_LOGI("ISEDisplay", "Air purifier state updated");
|
||||
}
|
||||
}
|
||||
last_mqtt_connected_check = millis();
|
||||
ESP_LOGI("ISEDisplay", "last mqtt connected check set to current time");
|
||||
}
|
||||
// ESP_LOGV("ISEDisplay", "this Loop is finish");
|
||||
}
|
||||
|
||||
void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type)
|
||||
|
|
@ -134,6 +151,10 @@ void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type
|
|||
case COMPONENT_OBJ_STANDBY_BTN_AC_TOGGLE:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
if (this->ac_lock_state == true){
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
break;
|
||||
}
|
||||
toggleAC();
|
||||
break;
|
||||
case COMPONENT_OBJ_STANDBY_BTN_PM_TOGGLE:
|
||||
|
|
@ -155,29 +176,37 @@ void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type
|
|||
case COMPONENT_OBJ_DASHBOARD_BTN_AC_TOGGLE:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
//if ac_lock is true do nothing
|
||||
if (strcmp(ac_lock->getValue(), "on") == 0)
|
||||
|
||||
// if ac_lock is true do nothing
|
||||
if (this->ac_lock_state == true)
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
break;
|
||||
}
|
||||
|
||||
toggleAC();
|
||||
break;
|
||||
case COMPONENT_OBJ_DASHBOARD_BTN_AC_MODE:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
//if ac_lock is true do nothing
|
||||
if (strcmp(ac_lock->getValue(), "on") == 0)
|
||||
// if ac_lock is true do nothing
|
||||
if (this->ac_lock_state == true)
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
break;
|
||||
}
|
||||
changeUserACmode();
|
||||
break;
|
||||
case COMPONENT_OBJ_DASHBOARD_BTN_AC_FAN_SPEED:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
//if ac_lock is true do nothing
|
||||
if (strcmp(ac_lock->getValue(), "on") == 0)
|
||||
// if ac_lock is true do nothing
|
||||
if (this->ac_lock_state == true){
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
break;
|
||||
ac_fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
}
|
||||
// ac_fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
ac_fan_speed = this->ac_fan_speed;
|
||||
// mode= auto, high, mid, low
|
||||
ESP_LOGI("ISEDisplay", "Current AC fan speed: %d", ac_fan_speed);
|
||||
ac_fan_speed = (ac_fan_speed + 1) % 4;
|
||||
|
|
@ -187,30 +216,35 @@ void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type
|
|||
case COMPONENT_OBJ_DASHBOARD_BTN_AC_TEMP_MINUS:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
//if ac_lock is true do nothing
|
||||
if (strcmp(ac_lock->getValue(), "on") == 0)
|
||||
// if ac_lock is true do nothing
|
||||
if (this->ac_lock_state == true){
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
break;
|
||||
ac_temperature = this->climateCard_daikin->getTemperature() - 1;
|
||||
}
|
||||
// ac_temperature = this->climateCard_daikin->getTemperature() - 1;
|
||||
ac_temperature = this->ac_temperature - 1;
|
||||
setACstate(ac_fan_speed, ac_mode, ac_temperature);
|
||||
break;
|
||||
case COMPONENT_OBJ_DASHBOARD_BTN_AC_TEMP_PLUS:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
//if ac_lock is true do nothing
|
||||
if (strcmp(ac_lock->getValue(), "on") == 0)
|
||||
// if ac_lock is true do nothing
|
||||
if (this->ac_lock_state == true){
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
break;
|
||||
ac_temperature = this->climateCard_daikin->getTemperature() + 1;
|
||||
}
|
||||
// ac_temperature = this->climateCard_daikin->getTemperature() + 1;
|
||||
ac_temperature = this->ac_temperature + 1;
|
||||
setACstate(ac_fan_speed, ac_mode, ac_temperature);
|
||||
break;
|
||||
case COMPONENT_OBJ_DASHBOARD_BTN_PM_TOGGLE:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
//if pm_lock is true do nothing
|
||||
if (strcmp(pm_lock->getValue(), "on") == 0)
|
||||
// if pm_lock is true do nothing
|
||||
if (this->pm_lock_state == true){
|
||||
ESP_LOGI("ISEDisplay", "PM lock is on, do nothing");
|
||||
break;
|
||||
}
|
||||
togglePM();
|
||||
break;
|
||||
case COMPONENT_OBJ_DASHBOARD_TXT_PM_INSIDE:
|
||||
|
|
@ -411,17 +445,20 @@ void ISEDisplay::handlePWMChange(uint8_t pin, bool state, uint16_t value)
|
|||
}
|
||||
void ISEDisplay::updateDateTimeText(rtctime_t time)
|
||||
{
|
||||
if (!this->takeSerialMutex())
|
||||
return;
|
||||
// Send the time to the display
|
||||
if (this->currentPage == 1)
|
||||
{
|
||||
if (!this->takeSerialMutex())
|
||||
return;
|
||||
// Send the time to the display
|
||||
|
||||
this->displayAdapter->printf("time.txt=\"%02d:%02d\"", time.hours, time.minutes);
|
||||
this->sendStopBytes();
|
||||
this->displayAdapter->printf("time.txt=\"%02d:%02d\"", time.hours, time.minutes);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->displayAdapter->printf("date.txt=\"%02d.%02d.%d\"", time.day, time.month, time.year);
|
||||
this->sendStopBytes();
|
||||
this->displayAdapter->printf("date.txt=\"%02d.%02d.%d\"", time.day, time.month, time.year);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->giveSerialMutex();
|
||||
this->giveSerialMutex();
|
||||
}
|
||||
}
|
||||
// TODO : Implement
|
||||
// user remote var
|
||||
|
|
@ -497,9 +534,17 @@ void ISEDisplay::setACstate(uint8_t ac_fan_speed, uint8_t ac_mode, uint8_t ac_te
|
|||
this->ac_fan_speed = ac_fan_speed;
|
||||
this->ac_mode = ac_mode;
|
||||
this->ac_temperature = ac_temperature;
|
||||
//check ac_temp is within bound of daikin
|
||||
if (this->ac_temperature < DAIKIN_MIN_TEMP)
|
||||
{
|
||||
this->ac_temperature = DAIKIN_MIN_TEMP;
|
||||
}
|
||||
else if (this->ac_temperature > DAIKIN_MAX_TEMP)
|
||||
{
|
||||
this->ac_temperature = DAIKIN_MAX_TEMP;
|
||||
}
|
||||
this->time_since_last_ac_change = millis();
|
||||
this->ac_press_pending = true;
|
||||
|
||||
updateACState();
|
||||
}
|
||||
void ISEDisplay::sendACIRcode()
|
||||
|
|
@ -532,6 +577,13 @@ void ISEDisplay::sendACIRcode()
|
|||
{
|
||||
this->climateCard_york->setState(cur_ac_mode, cur_ac_fan_speed, york_temp);
|
||||
}
|
||||
// get value of mode fanspeed and temp and print compare to store value
|
||||
ESP_LOGI("ISEDisplay", "AC IR code sent");
|
||||
ESP_LOGI("ISEDisplay", "Daikin fan speed: %d, Daikin mode: %d, Daikin temperature: %d", cur_ac_fan_speed, cur_ac_mode, cur_ac_temperature);
|
||||
ESP_LOGI("ISEDisplay", "York fan speed: %d, York mode: %d, York temperature: %d", cur_ac_fan_speed, cur_ac_mode, york_temp);
|
||||
ESP_LOGI("ISEDisplay", "getting value of mode, fanspeed and temp from climate card");
|
||||
ESP_LOGI("ISEDisplay", "Daikin fan speed: %d, Daikin mode: %d, Daikin temperature: %d", this->climateCard_daikin->getFanSpeed(), this->climateCard_daikin->getMode(), this->climateCard_daikin->getTemperature());
|
||||
ESP_LOGI("ISEDisplay", "York fan speed: %d, York mode: %d, York temperature: %d", this->climateCard_york->getFanSpeed(), this->climateCard_york->getMode(), this->climateCard_york->getTemperature());
|
||||
}
|
||||
|
||||
void ISEDisplay::toggleLightGroupState()
|
||||
|
|
@ -610,32 +662,41 @@ void ISEDisplay::togglePMStandby()
|
|||
void ISEDisplay::toggleAC()
|
||||
{
|
||||
// Get the current group state
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
// get fan speed and temperature
|
||||
uint8_t fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
uint8_t temperature = this->climateCard_daikin->getTemperature();
|
||||
|
||||
// uint8_t mode = this->climateCard_daikin->getMode();
|
||||
uint8_t mode = this->ac_mode;
|
||||
ESP_LOGI("ISEDisplay", "Current AC mode: %d", mode);
|
||||
ESP_LOGI("ISEDisplay", "Current user mode: %d", user_mode);
|
||||
// get value of mode, fanspeed and temp and print compare to store value
|
||||
ESP_LOGI("ISEDisplay", "Daikin fan speed: %d, Daikin mode: %d, Daikin temperature: %d", this->climateCard_daikin->getFanSpeed(), this->climateCard_daikin->getMode(), this->climateCard_daikin->getTemperature());
|
||||
ESP_LOGI("ISEDisplay", "York fan speed: %d, York mode: %d, York temperature: %d", this->climateCard_york->getFanSpeed(), this->climateCard_york->getMode(), this->climateCard_york->getTemperature());
|
||||
// Toggle the state
|
||||
if (mode == 0)
|
||||
if (mode != 0)
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", " User mode: %d", user_mode);
|
||||
setACstate(fan_speed, user_mode, temperature);
|
||||
// update mode to new mode
|
||||
mode = 0;
|
||||
ESP_LOGI("ISEDisplay", "change actual AC mode to off: %d", mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", "User mode BEFORE: %d", user_mode);
|
||||
// update user mode to new mode
|
||||
user_mode = mode;
|
||||
// change actual mode to off
|
||||
ESP_LOGI("ISEDisplay", "User mode AFTER: %d", user_mode);
|
||||
setACstate(fan_speed, 0, temperature);
|
||||
{ // ie mode is off
|
||||
// do nothing as the state is keep in user_mode
|
||||
// the mode will change to user_mode when turn on by toggleAC()
|
||||
ESP_LOGI("ISEDisplay", "do nothing; user mode: %d , actual mode: %d", user_mode, mode);
|
||||
mode = user_mode;
|
||||
}
|
||||
// get fan speed and temperature
|
||||
// uint8_t fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
// uint8_t temperature = this->climateCard_daikin->getTemperature();
|
||||
uint8_t fan_speed = this->ac_fan_speed;
|
||||
uint8_t temperature = this->ac_temperature;
|
||||
ESP_LOGI("ISEDisplay", "Current AC mode: %d", mode);
|
||||
// Toggle the state
|
||||
setACstate(fan_speed, mode, temperature);
|
||||
}
|
||||
void ISEDisplay::changeUserACmode()
|
||||
{
|
||||
// Get the current group state
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
uint8_t mode = this->ac_mode;
|
||||
// uint8_t mode = this->climateCard_daikin->getMode();
|
||||
ESP_LOGI("ISEDisplay", "Current actual AC mode: %d", mode);
|
||||
// Toggle the state
|
||||
// user mode alternate between 1 and 2
|
||||
|
|
@ -795,6 +856,7 @@ void ISEDisplay::updateLightGroupStatePageDashboard()
|
|||
for (uint8_t i = 1; i <= 4; i++)
|
||||
{
|
||||
u_int8_t state = getLightLevel(i);
|
||||
updateLightSwitch();
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
|
|
@ -832,6 +894,60 @@ void ISEDisplay::updateLightGroupStatePageDashboard()
|
|||
|
||||
this->giveSerialMutex();
|
||||
}
|
||||
void ISEDisplay::updateLightSwitch()
|
||||
{
|
||||
// Calculate the state
|
||||
bool state_master = calculateLightGroupState();
|
||||
// Send the state to the display
|
||||
if (!this->takeSerialMutex())
|
||||
return;
|
||||
|
||||
this->displayAdapter->print("light_m_sw.pic=");
|
||||
this->displayAdapter->print(state_master ? COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_ON : COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_OFF);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->displayAdapter->print("light_m_sw.pic2=");
|
||||
this->displayAdapter->print(state_master ? COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_ON_PRESSED : COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_OFF_PRESSED);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->giveSerialMutex();
|
||||
|
||||
// check state and set for each individual light row
|
||||
// if state is 0 set to off and other(1,2,3) to on
|
||||
|
||||
for (uint8_t i = 1; i <= 4; i++)
|
||||
{
|
||||
u_int8_t state = getLightLevel(i);
|
||||
if (state == 0)
|
||||
{
|
||||
this->displayAdapter->print("light_row");
|
||||
this->displayAdapter->print(i);
|
||||
this->displayAdapter->print("_sw.pic=");
|
||||
this->displayAdapter->print(COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_OFF);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->displayAdapter->print("light_row");
|
||||
this->displayAdapter->print(i);
|
||||
this->displayAdapter->print("_sw.pic2=");
|
||||
this->displayAdapter->print(COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_OFF_PRESSED);
|
||||
this->sendStopBytes();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->displayAdapter->print("light_row");
|
||||
this->displayAdapter->print(i);
|
||||
this->displayAdapter->print("_sw.pic=");
|
||||
this->displayAdapter->print(COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_ON);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->displayAdapter->print("light_row");
|
||||
this->displayAdapter->print(i);
|
||||
this->displayAdapter->print("_sw.pic=");
|
||||
this->displayAdapter->print(COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_ON_PRESSED);
|
||||
this->sendStopBytes();
|
||||
}
|
||||
}
|
||||
}
|
||||
bool ISEDisplay::calculateLightGroupState()
|
||||
{
|
||||
// Check if all lights are on
|
||||
|
|
@ -862,8 +978,8 @@ bool ISEDisplay::calculateAllState()
|
|||
void ISEDisplay::toggleSystem()
|
||||
{
|
||||
toggleLightGroupState();
|
||||
//check for ac lock and pm lock, if lock is on do nothing
|
||||
if (strcmp(ac_lock->getValue(), "on") == 0)
|
||||
// check for ac lock and pm lock, if lock is on do nothing
|
||||
if (this->ac_lock_state == true)
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", "AC lock is on, do nothing");
|
||||
}
|
||||
|
|
@ -871,7 +987,7 @@ void ISEDisplay::toggleSystem()
|
|||
{
|
||||
toggleAC();
|
||||
}
|
||||
if (strcmp(pm_lock->getValue(), "on") == 0)
|
||||
if (this->pm_lock_state == true)
|
||||
{
|
||||
ESP_LOGI("ISEDisplay", "PM lock is on, do nothing");
|
||||
}
|
||||
|
|
@ -884,7 +1000,7 @@ void ISEDisplay::allOn()
|
|||
{
|
||||
setLightGroupState(3);
|
||||
setPMstate(true, pm_fan_speed);
|
||||
setACstate(ac_mode, ac_fan_speed, ac_temperature);
|
||||
setACstate(2, ac_fan_speed, ac_temperature);
|
||||
}
|
||||
|
||||
void ISEDisplay::toggleLightIndividual(uint8_t row)
|
||||
|
|
@ -927,11 +1043,11 @@ void ISEDisplay::updateAirPurifierStateStandby()
|
|||
return;
|
||||
|
||||
this->displayAdapter->print("s_pm_toggle.pic=");
|
||||
this->displayAdapter->print(state ? COMPONENT_STANDBY_PIC_AC_TOGGLE_ON : COMPONENT_STANDBY_PIC_AC_TOGGLE_OFF);
|
||||
this->displayAdapter->print(state ? COMPONENT_STANDBY_PIC_PM_TOGGLE_ON : COMPONENT_STANDBY_PIC_PM_TOGGLE_OFF);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->displayAdapter->print("s_pm_toggle.pic2=");
|
||||
this->displayAdapter->print(state ? COMPONENT_STANDBY_PIC_AC_TOGGLE_ON_PRESSED : COMPONENT_STANDBY_PIC_AC_TOGGLE_OFF_PRESSED);
|
||||
this->displayAdapter->print(state ? COMPONENT_STANDBY_PIC_PM_TOGGLE_ON_PRESSED : COMPONENT_STANDBY_PIC_PM_TOGGLE_OFF_PRESSED);
|
||||
this->sendStopBytes();
|
||||
|
||||
this->giveSerialMutex();
|
||||
|
|
@ -989,7 +1105,8 @@ void ISEDisplay::handleACChange(uint8_t mode, uint8_t fan_speed, uint8_t tempera
|
|||
}
|
||||
void ISEDisplay::updateuserACmode()
|
||||
{
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
// uint8_t mode = this->climateCard_daikin->getMode();
|
||||
uint8_t mode = this->ac_mode;
|
||||
if (!this->takeSerialMutex())
|
||||
return;
|
||||
ESP_LOGI("ISEDisplay", "updating display user AC mode to: %d", user_mode);
|
||||
|
|
@ -1063,8 +1180,10 @@ void ISEDisplay::updateuserACmode()
|
|||
}
|
||||
void ISEDisplay::updateACfanSpeed()
|
||||
{
|
||||
uint8_t fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
// uint8_t fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
// uint8_t mode = this->climateCard_daikin->getMode();
|
||||
uint8_t fan_speed = this->ac_fan_speed;
|
||||
uint8_t mode = this->ac_mode;
|
||||
this->ac_lock_state = strcmp(ac_lock->getValue(), "on") == 0;
|
||||
|
||||
ESP_LOGI("ISEDisplay", "updating display AC fan speed to: %d", fan_speed);
|
||||
|
|
@ -1162,10 +1281,12 @@ void ISEDisplay::updateACState()
|
|||
// TODOlater : The cognitive complexity here is so high, maybe break up the method a bit?
|
||||
|
||||
// Get the state
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
uint8_t temperature = this->climateCard_daikin->getTemperature();
|
||||
// uint8_t mode = this->climateCard_daikin->getMode();
|
||||
// uint8_t temperature = this->climateCard_daikin->getTemperature();
|
||||
uint8_t mode = this->ac_mode;
|
||||
uint8_t temperature = this->ac_temperature;
|
||||
this->ac_lock_state = strcmp(ac_lock->getValue(), "on") == 0;
|
||||
|
||||
|
||||
if (currentPage != 1)
|
||||
{
|
||||
if (!this->takeSerialMutex())
|
||||
|
|
@ -1191,8 +1312,6 @@ void ISEDisplay::updateACState()
|
|||
this->displayAdapter->print("c_degree.pic=");
|
||||
this->displayAdapter->print(COMPONENT_DASHBOARD_PIC_DEGREE_C_ON);
|
||||
this->sendStopBytes();
|
||||
|
||||
user_mode = mode;
|
||||
}
|
||||
this->displayAdapter->print("ac_sw.pic=");
|
||||
this->displayAdapter->print(mode != 0 ? COMPONENT_DASHBOARD_PIC_AC_TOGGLE_ON : COMPONENT_DASHBOARD_PIC_AC_TOGGLE_OFF);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue