From 62ad9648b5c1bf8480b9c69ebb09a2a77db5cf41 Mon Sep 17 00:00:00 2001 From: lumapu Date: Thu, 29 Aug 2024 22:52:02 +0200 Subject: [PATCH] 0.8.143 * fixed crash #1743 --- src/CHANGES.md | 3 +++ src/defines.h | 2 +- src/publisher/pubMqtt.h | 5 +++-- src/publisher/pubMqttDefs.h | 3 ++- src/utils/helper.cpp | 2 +- src/web/html/system.html | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index 1c06a1e8..6975fbf1 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.8.143 - 2024-08-29 +* fixed crash #1743 + ## 0.8.142 - 2024-08-28 * merge PR: add read_temp_c to system + mqtt #1739 * improved sending limits of multiple inverters in very short timeframe #1726 diff --git a/src/defines.h b/src/defines.h index 2a0646be..2f32e49e 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 142 +#define VERSION_PATCH 143 //------------------------------------- typedef struct { uint8_t ch; diff --git a/src/publisher/pubMqtt.h b/src/publisher/pubMqtt.h index 04494d7d..49b209f5 100644 --- a/src/publisher/pubMqtt.h +++ b/src/publisher/pubMqtt.h @@ -159,8 +159,9 @@ class PubMqtt { publish(subtopics[MQTT_RSSI], String(WiFi.RSSI()).c_str()); publish(subtopics[MQTT_FREE_HEAP], String(ESP.getFreeHeap()).c_str()); #if defined(ESP32) - publish(subtopics[MQTT_TEMP_SENS_C], String(ah::readTemperature()).c_str()); - #else ESP32 + snprintf(mVal.data(), mVal.size(), "%.2f", ah::readTemperature()); + publish(subtopics[MQTT_TEMP_SENS_C], mVal.data()); + #else publish(subtopics[MQTT_HEAP_FRAG], String(ESP.getHeapFragmentation()).c_str()); #endif } diff --git a/src/publisher/pubMqttDefs.h b/src/publisher/pubMqttDefs.h index 22239a0d..691bb098 100644 --- a/src/publisher/pubMqttDefs.h +++ b/src/publisher/pubMqttDefs.h @@ -77,7 +77,8 @@ const char* const subtopics[] PROGMEM = { "status", "connected", "not_connected", - "ack_pwr_limit" + "ack_pwr_limit", + "cpu_temp" }; enum { diff --git a/src/utils/helper.cpp b/src/utils/helper.cpp index 7d0c2cfb..b30f58e0 100644 --- a/src/utils/helper.cpp +++ b/src/utils/helper.cpp @@ -156,7 +156,7 @@ namespace ah { // This formula is an approximation and might need to be calibrated for your specific use case. float temperature = (voltage - 500) / 10.0;*/ - #if defined(ESP_32) + #if defined(ESP32) return temperatureRead(); #else return 0; diff --git a/src/web/html/system.html b/src/web/html/system.html index 2e5d44a8..a6223455 100644 --- a/src/web/html/system.html +++ b/src/web/html/system.html @@ -46,7 +46,7 @@ tr("Chip", "CPU: " + obj.chip.cpu_freq + "MHz, " + obj.chip.cores + " Core(s)"), tr("Chip Model", obj.chip.model) /*IF_ESP32*/ - ,tr("Chip temp.", obj.chip.temp_sensor_c + "°C") + ,tr("Chip temp.", Math.round(obj.chip.temp_sensor_c * 10) / 10 + "°C") /*ENDIF_ESP32*/ ]