add room temperature display

This commit is contained in:
Siwat Sirichai 2024-03-24 01:11:43 +07:00
parent 4d8562a64a
commit 20e9544ca4
1 changed files with 17 additions and 1 deletions

View File

@ -640,7 +640,23 @@ void CUDDisplay::handle_ac_change(uint8_t mode, uint8_t fan_speed, uint8_t tempe
void CUDDisplay::handle_ac_sensor(float temperature, float humidity)
{
// Not needed for now
// Is the temperature valid?
// A temperature of -999.0 means the sensor is not connected
ESP_LOGV("CUD Display", "AC Sensor Temperature: %f", temperature);
if (temperature == -999.0)
{
// If the temperature is not valid, Send NA to the display
this->takeSerialMutex();
this->displayAdapter->printf("%s.txt=\"NA\"", LCD_DASHBOARD_ELEMENT_NAME_ROOM_TEMPERATURE);
this->sendStopBytes();
this->giveSerialMutex();
return;
}
// Temperature is valid, send it to the display
this->takeSerialMutex();
this->displayAdapter->printf("%s.txt=\"%d\"", LCD_DASHBOARD_ELEMENT_NAME_ROOM_TEMPERATURE, (int)temperature);
this->sendStopBytes();
this->giveSerialMutex();
}
void CUDDisplay::handle_mqtt_connected()