add york to display
This commit is contained in:
parent
90fb35aeb4
commit
c07fd62bba
10 changed files with 329 additions and 159 deletions
|
|
@ -9,18 +9,20 @@ ISEDisplay::ISEDisplay(HardwareSerial *adapter, const uint8_t *light_array, uint
|
|||
// TODO : Implement
|
||||
// debug to work
|
||||
|
||||
void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCard, ClimateCard *climateCard, RemoteVariable* pm_switch, RemoteVariable* pm_fan_speed)
|
||||
void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCard, ClimateCard *climateCard_daikin, ClimateCard *climateCard_york, RemoteVariable* pm_switch, RemoteVariable* pm_fan_speed)
|
||||
{
|
||||
this->inputCard = inputCard;
|
||||
this->outputCard = outputCard;
|
||||
this->climateCard = climateCard;
|
||||
this->climateCard_daikin = climateCard_daikin;
|
||||
this->climateCard_york = climateCard_york;
|
||||
this->pm_switch = pm_switch;
|
||||
this->remote_pm_fan_speed = pm_fan_speed;
|
||||
auto bindedHandlePWMChange = std::bind(&ISEDisplay::handlePWMChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||
auto bindedHandleACChange = std::bind(&ISEDisplay::handleACChange, 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->climateCallbackHandle = this->climateCard->registerChangeCallback(bindedHandleACChange);
|
||||
this->climateCallbackHandle = this->climateCard_daikin->registerChangeCallback(bindedHandleACChange);
|
||||
//this->climateCallbackHandle = this->climateCard_york->registerChangeCallback(bindedHandleACChange);
|
||||
this->user_mode = 1; // initialized to cool by default
|
||||
this->pm_fan_speed = 10;
|
||||
//remote_pm_fan_speed->setValue(pm_fan_speed);
|
||||
|
|
@ -50,7 +52,14 @@ void ISEDisplay::begin(DigitalInputCard *inputCard, DigitalOutputCard *outputCar
|
|||
// this->climateCard->setTemperature(ac_temperature);
|
||||
// this->climateCard->setFanSpeed(ac_fan_speed);
|
||||
// this->climateCard->setMode(ac_mode);
|
||||
this->climateCard->setState(ac_mode, ac_fan_speed, ac_temperature);
|
||||
this->climateCard_daikin->setState(ac_mode, ac_fan_speed, ac_temperature);
|
||||
if(mode == 3){
|
||||
this->climateCard_york->setState(0, ac_fan_speed, ac_temperature);
|
||||
}
|
||||
else{
|
||||
this->climateCard_york->setState(ac_mode, ac_fan_speed, ac_temperature);
|
||||
}
|
||||
|
||||
}
|
||||
void ISEDisplay::loop()
|
||||
{
|
||||
|
|
@ -210,25 +219,28 @@ void ISEDisplay::handleTouch(uint8_t page, uint8_t component, uint8_t touch_type
|
|||
case COMPONENT_AC_FAN_SPEED:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
ac_fan_speed = this->climateCard->getFanSpeed();
|
||||
ac_fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
// We have auto, low, mid, high right?, that's 0,1,2,3 a modulo operation of 3 only gives 0,1,2
|
||||
// mod 4 should fixed it
|
||||
ESP_LOGI("ISEDisplay", "Current AC fan speed: %d", ac_fan_speed);
|
||||
ac_fan_speed = (ac_fan_speed + 1) % 4;
|
||||
ESP_LOGI("ISEDisplay", "New AC fan speed: %d", ac_fan_speed);
|
||||
this->climateCard->setFanSpeed(ac_fan_speed);
|
||||
this->climateCard_daikin->setFanSpeed(ac_fan_speed);
|
||||
this->climateCard_york->setFanSpeed(ac_fan_speed);
|
||||
// updateACState();
|
||||
break;
|
||||
case COMPONENT_AC_TEMP_DOWN_BUTTON:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
this->climateCard->setTemperature(this->climateCard->getTemperature() - 1);
|
||||
this->climateCard_daikin->setTemperature(this->climateCard_daikin->getTemperature() - 1);
|
||||
this->climateCard_york->setTemperature(this->climateCard_york->getTemperature() - 1);
|
||||
// updateACState();
|
||||
break;
|
||||
case COMPONENT_AC_TEMP_UP_BUTTON:
|
||||
if (touch_type != TOUCH_TYPE_RELEASE)
|
||||
break;
|
||||
this->climateCard->setTemperature(this->climateCard->getTemperature() + 1);
|
||||
this->climateCard_daikin->setTemperature(this->climateCard_daikin->getTemperature() + 1);
|
||||
this->climateCard_york->setTemperature(this->climateCard_york->getTemperature() + 1);
|
||||
// updateACState();
|
||||
break;
|
||||
case COMPONENT_PM_TOGGLE_BUTTON:
|
||||
|
|
@ -460,7 +472,13 @@ void ISEDisplay::setACstate(uint8_t ac_fan_speed, uint8_t ac_mode, uint8_t ac_te
|
|||
ESP_LOGI("ISEDisplay", "AC mode set to: %d", ac_mode);
|
||||
//this->climateCard->setTemperature(ac_temperature);
|
||||
ESP_LOGI("ISEDisplay", "AC temperature set to: %d", ac_temperature);
|
||||
this->climateCard->setState(ac_mode, ac_fan_speed, ac_temperature);
|
||||
this->climateCard_daikin->setState(ac_mode, ac_fan_speed, ac_temperature);
|
||||
if(ac_mode == 3){
|
||||
this->climateCard_york->setState(0, ac_fan_speed, ac_temperature);
|
||||
}
|
||||
else{
|
||||
this->climateCard_york->setState(ac_mode, ac_fan_speed, ac_temperature);
|
||||
}
|
||||
// updateACState();
|
||||
}
|
||||
void ISEDisplay::toggleLightGroupState()
|
||||
|
|
@ -509,10 +527,10 @@ void ISEDisplay::togglePMStandby()
|
|||
void ISEDisplay::toggleAC()
|
||||
{
|
||||
// Get the current group state
|
||||
uint8_t mode = this->climateCard->getMode();
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
// get fan speed and temperature
|
||||
uint8_t fan_speed = this->climateCard->getFanSpeed();
|
||||
uint8_t temperature = this->climateCard->getTemperature();
|
||||
uint8_t fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
uint8_t temperature = this->climateCard_daikin->getTemperature();
|
||||
|
||||
ESP_LOGI("ISEDisplay", "Current AC mode: %d", mode);
|
||||
// Toggle the state
|
||||
|
|
@ -534,7 +552,7 @@ void ISEDisplay::toggleAC()
|
|||
void ISEDisplay::changeUserACmode()
|
||||
{
|
||||
// Get the current group state
|
||||
uint8_t mode = this->climateCard->getMode();
|
||||
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
|
||||
|
|
@ -868,7 +886,7 @@ void ISEDisplay::updateuserACmode()
|
|||
}
|
||||
void ISEDisplay::updateACfanSpeed()
|
||||
{
|
||||
uint8_t fan_speed = this->climateCard->getFanSpeed();
|
||||
uint8_t fan_speed = this->climateCard_daikin->getFanSpeed();
|
||||
ESP_LOGI("ISEDisplay", "updating display AC fan speed to: %d", fan_speed);
|
||||
if (!this->takeSerialMutex())
|
||||
return;
|
||||
|
|
@ -916,8 +934,8 @@ 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->getMode();
|
||||
uint8_t temperature = this->climateCard->getTemperature();
|
||||
uint8_t mode = this->climateCard_daikin->getMode();
|
||||
uint8_t temperature = this->climateCard_daikin->getTemperature();
|
||||
if(currentPage != 1){
|
||||
if (!this->takeSerialMutex())
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue