display climate implementation

This commit is contained in:
Siwat Sirichai 2023-12-31 00:37:50 +07:00
parent ea2c2e076b
commit 19aae95252
4 changed files with 21 additions and 17 deletions

View file

@ -73,6 +73,10 @@ void InternalDisplay::handlePwmStateChange(uint8_t pin, bool state, uint16_t val
// Update the output state
this->setOutputBar(pin, value);
this->setOutputStateColor(pin, state);
// Refresh the PWM Adjustment page if the current page is the PWM Adjustment page and the pin is the same
if (this->currentPage == INTERNAL_DISPLAY_PWM_ADJUSTMENT_PAGE && this->pmwAdjustmentPin == pin) {
this->refreshPWMAdjustment();
}
}
void InternalDisplay::handlePageChange(uint8_t page) {
@ -171,7 +175,7 @@ void InternalDisplay::refreshOutput() {
void InternalDisplay::refreshAC() {
this->displayAdapter->print("temp.txt=\"");
this->displayAdapter->print(this->climateCard->getTemperature());
this->displayAdapter->print(" C\"");
this->displayAdapter->print("C\"");
this->sendStopBytes();
this->displayAdapter->print("fan_auto.pic=");
this->displayAdapter->print(this->climateCard->getFanSpeed() == AC_FAN_SPEED_AUTO ? PIC_AC_FAN_SPEED_AUTO_ACTIVE : PIC_AC_FAN_SPEED_AUTO_INACTIVE);
@ -179,7 +183,7 @@ void InternalDisplay::refreshAC() {
this->displayAdapter->print("fan_low.pic=");
this->displayAdapter->print(this->climateCard->getFanSpeed() == AC_FAN_SPEED_LOW ? PIC_AC_FAN_SPEED_LOW_ACTIVE : PIC_AC_FAN_SPEED_LOW_INACTIVE);
this->sendStopBytes();
this->displayAdapter->print("fan_med.pic=");
this->displayAdapter->print("fan_mid.pic=");
this->displayAdapter->print(this->climateCard->getFanSpeed() == AC_FAN_SPEED_MEDIUM ? PIC_AC_FAN_SPEED_MEDIUM_ACTIVE : PIC_AC_FAN_SPEED_MEDIUM_INACTIVE);
this->sendStopBytes();
this->displayAdapter->print("fan_high.pic=");
@ -217,18 +221,6 @@ void InternalDisplay::refreshAC() {
}
}
void InternalDisplay::setPWMAdjustmentSlider(uint16_t value) {
// TODO: implementation
}
void InternalDisplay::setPWMAdjustmentPin(uint8_t pin) {
// TODO: implementation
}
void InternalDisplay::setPWMAdjustmentButton(bool state) {
// TODO: implementation
}
void InternalDisplay::setOutputBar(uint8_t pin, uint16_t value) {
// Write the value to the output bar
this->displayAdapter->print("j");