From 3473e30e2e575c0f984abd456615c3ea3e293e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Por=C4=99bski?= Date: Wed, 27 Nov 2024 17:17:22 +0100 Subject: [PATCH 1/2] Fix temperature float formatting for basic oled display --- src/AgOledDisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AgOledDisplay.cpp b/src/AgOledDisplay.cpp index d28ba40..0682038 100644 --- a/src/AgOledDisplay.cpp +++ b/src/AgOledDisplay.cpp @@ -394,7 +394,7 @@ void OledDisplay::showDashboard(const char *status) { if (config.isTemperatureUnitInF()) { snprintf(strBuf, sizeof(strBuf), "T:%0.1f F", utils::degreeC_To_F(temp)); } else { - snprintf(strBuf, sizeof(strBuf), "T:%0.f1 C", temp); + snprintf(strBuf, sizeof(strBuf), "T:%0.1f C", temp); } } else { if (config.isTemperatureUnitInF()) { From 39ef69cbdfa5c6d06733e4c24340fdc97fc38a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Por=C4=99bski?= Date: Wed, 27 Nov 2024 17:18:43 +0100 Subject: [PATCH 2/2] Fix printing of debug logs throught serial --- src/AgValue.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/AgValue.cpp b/src/AgValue.cpp index 0df5db8..dc41896 100644 --- a/src/AgValue.cpp +++ b/src/AgValue.cpp @@ -189,7 +189,7 @@ bool Measurements::update(MeasurementType type, int val, int ch) { // Sanity check if measurement type is defined for integer data type or not if (temporary == nullptr) { - Serial.printf("%s is not defined for integer data type\n", measurementTypeStr(type)); + Serial.printf("%s is not defined for integer data type\n", measurementTypeStr(type).c_str()); // TODO: Just assert? return false; } @@ -228,7 +228,7 @@ bool Measurements::update(MeasurementType type, int val, int ch) { // Calculate average based on how many elements on the list temporary->update.avg = temporary->sumValues / (float)temporary->listValues.size(); if (_debug) { - Serial.printf("%s{%d}: %.2f\n", measurementTypeStr(type), ch, temporary->update.avg); + Serial.printf("%s{%d}: %.2f\n", measurementTypeStr(type).c_str(), ch, temporary->update.avg); } return true; @@ -260,7 +260,7 @@ bool Measurements::update(MeasurementType type, float val, int ch) { // Sanity check if measurement type is defined for float data type or not if (temporary == nullptr) { - Serial.printf("%s is not defined for float data type\n", measurementTypeStr(type)); + Serial.printf("%s is not defined for float data type\n", measurementTypeStr(type).c_str()); // TODO: Just assert? return false; } @@ -299,7 +299,7 @@ bool Measurements::update(MeasurementType type, float val, int ch) { // Calculate average based on how many elements on the list temporary->update.avg = temporary->sumValues / (float)temporary->listValues.size(); if (_debug) { - Serial.printf("%s{%d}: %.2f\n", measurementTypeStr(type), ch, temporary->update.avg); + Serial.printf("%s{%d}: %.2f\n", measurementTypeStr(type).c_str(), ch, temporary->update.avg); } return true; @@ -348,7 +348,7 @@ int Measurements::get(MeasurementType type, int ch) { // Sanity check if measurement type is defined for integer data type or not if (temporary == nullptr) { - Serial.printf("%s is not defined for integer data type\n", measurementTypeStr(type)); + Serial.printf("%s is not defined for integer data type\n", measurementTypeStr(type).c_str()); // TODO: Just assert? return false; } @@ -383,7 +383,7 @@ float Measurements::getFloat(MeasurementType type, int ch) { // Sanity check if measurement type is defined for float data type or not if (temporary == nullptr) { - Serial.printf("%s is not defined for float data type\n", measurementTypeStr(type)); + Serial.printf("%s is not defined for float data type\n", measurementTypeStr(type).c_str()); // TODO: Just assert? return false; } @@ -434,7 +434,7 @@ float Measurements::getAverage(MeasurementType type, int ch) { // Sanity check if measurement type is not defined if (measurementAverage == -1000) { - Serial.printf("ERROR! %s is not defined on get average value function\n", measurementTypeStr(type)); + Serial.printf("ERROR! %s is not defined on get average value function\n", measurementTypeStr(type).c_str()); delay(1000); assert(0); }