From 3cd06fc7d4fa55257e56326bbc6f2c0bf8695f44 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Wed, 4 Oct 2023 03:27:46 +0700 Subject: [PATCH] Update espmega_iot_core.cpp --- src/espmega_iot_core.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/espmega_iot_core.cpp b/src/espmega_iot_core.cpp index 88bd1a5..0a66536 100644 --- a/src/espmega_iot_core.cpp +++ b/src/espmega_iot_core.cpp @@ -752,13 +752,9 @@ void publish_env_state() mqtt_client.loop(); if (lcd_current_page == 4) { - Serial.print("roomtemp.txt=\""); - Serial.print(current_room_temp); - Serial.print("C\""); + Serial.printf("roomtemp.txt=\"%.01fC\"",current_room_temp); lcd_send_stop_bit(); - Serial.print("roomhumid.txt=\""); - Serial.print(current_room_humid); - Serial.print("%\""); + Serial.printf("roomhumid.txt=\"%d%\"",current_room_humid); lcd_send_stop_bit(); } break; @@ -823,14 +819,10 @@ 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(); + Serial.printf("roomtemp.txt=\"%.01fC\"",current_room_temp); + lcd_send_stop_bit(); + Serial.printf("roomhumid.txt=\"%.01f%\"",current_room_humid); + lcd_send_stop_bit(); if (ac_mode != 2) panel.writeStr("temp.txt", String(ac_temperature) + "C"); else