From a1decd342779ca8d32a048e8d1e7541bfd1e15e1 Mon Sep 17 00:00:00 2001
From: giedriuslt <123905703+giedriuslt@users.noreply.github.com>
Date: Fri, 9 Feb 2024 15:32:02 +0200
Subject: [PATCH] Add temperature to BL602 (#1067)
Co-authored-by: openshwprojects <85486843+openshwprojects@users.noreply.github.com>
---
src/httpserver/http_fns.c | 80 +++++++++++++++++++++++++++++++++++++--
1 file changed, 76 insertions(+), 4 deletions(-)
diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c
index be6cd30af..55841a043 100644
--- a/src/httpserver/http_fns.c
+++ b/src/httpserver/http_fns.c
@@ -25,6 +25,9 @@ static char SUBMIT_AND_END_FORM[] = "
+#include // For BL602 ADC HAL
+#include // For BL602 ADC Standard Driver
+#include // For BL602 Global Register Standard Driver
#elif PLATFORM_W600 || PLATFORM_W800
#elif PLATFORM_XR809
@@ -47,6 +50,68 @@ static char SUBMIT_AND_END_FORM[] = " Cfg size: %i, change counter: %i, ota counter: %i, boot incompletes %i (might change to 0 if you wait to 30 sec)!",
sizeof(g_cfg), g_cfg.changeCounter, g_cfg.otaCounter, g_bootFailures);
-#if PLATFORM_BEKEN
- if(!bSafeMode && g_bootFailures <= 1) // only in Normal mode, and if boot is not failing
+ // display temperature - thanks to giedriuslt
+ // only in Normal mode, and if boot is not failing
+ if(!bSafeMode && g_bootFailures <= 1)
{
+#if PLATFORM_BEKEN
UINT32 temperature;
temp_single_get_current_temperature(&temperature);
hprintf255(request, "Internal temperature: %.1f°C ",
temperature/10.0f);
- }
+#elif PLATFORM_BL602
+ float wifi_temperature;
+ get_tsen_adc(&wifi_temperature, 0);
+ hprintf255(request, "Internal Temperature: %.1f°C ",
+ wifi_temperature);
#elif PLATFORM_LN882H
// Quick hack to display LN-only temperature,
// we may improve it in the future
extern float g_wifi_temperature;
- hprintf255(request, "Internal temperature: %f°C ",
+ hprintf255(request, "Internal temperature: %.1f°C ",
g_wifi_temperature);
#endif
+ }
inputName = CFG_GetPingHost();
if (inputName && *inputName && CFG_GetPingDisconnectedSecondsToRestart()) {