Compare commits

...

2 Commits

Author SHA1 Message Date
Siwat Sirichai 79748da31c Merge branch 'main' into cud 2023-10-04 03:14:39 +07:00
Siwat Sirichai eed04d8795 Update espmega_iot_core.cpp 2023-10-04 03:14:33 +07:00
1 changed files with 18 additions and 5 deletions

View File

@ -24,6 +24,8 @@ const char MQTT_USERNAME[] = "username";
const char MQTT_PASSWORD[] = "password";
#endif
uint8_t utc_offset = 7;
float current_room_temp = 0;
float current_room_humid = 0;
// Inputs
#define VINT_COUNT 16
@ -742,17 +744,20 @@ void publish_env_state()
switch (errorCode)
{
case DHTLIB_OK:
mqtt.publish(String(AC_ROOM_TEMPERATURE_TOPIC), String(env_sensor.getTemperature()));
current_room_humid = env_sensor.getHumidity();
current_room_temp = env_sensor.getTemperature();
mqtt.publish(String(AC_ROOM_TEMPERATURE_TOPIC), String(current_room_temp));
mqtt_client.loop();
mqtt.publish(String(AC_HUMIDITY_TOPIC), String(env_sensor.getHumidity()));
mqtt.publish(String(AC_HUMIDITY_TOPIC), String(current_room_humid));
mqtt_client.loop();
if(lcd_current_page==4) {
if (lcd_current_page == 4)
{
Serial.print("roomtemp.txt=\"");
Serial.print(env_sensor.getTemperature());
Serial.print(current_room_temp);
Serial.print("C\"");
lcd_send_stop_bit();
Serial.print("roomhumid.txt=\"");
Serial.print(env_sensor.getHumidity());
Serial.print(current_room_humid);
Serial.print("%\"");
lcd_send_stop_bit();
}
@ -818,6 +823,14 @@ void lcd_refresh()
}
break;
case 4:
Serial.print("roomtemp.txt=\"");
Serial.print(current_room_temp);
Serial.print("C\"");
lcd_send_stop_bit();
Serial.print("roomhumid.txt=\"");
Serial.print(current_room_humid);
Serial.print("%\"");
lcd_send_stop_bit();
if (ac_mode != 2)
panel.writeStr("temp.txt", String(ac_temperature) + "C");
else