From f59cea3be9eed8d63fa44d4fd360c9c68e9318f6 Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Wed, 15 Jul 2026 19:18:32 -0500 Subject: temp: report on-die temperature in /state and the info screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New chip_temp module wraps the ESP32-P4 TSENS driver (20-100C range for best accuracy in the warm band a PoE + 200MHz-PSRAM device lives in). /state gains temp_c (0.1C resolution, omitted when the sensor is unavailable); the long-press info overlay gains a temp line (lowercase c suffix — the local 8x8 font has no uppercase C). Junction temperature, ~10-20C above ambient under load. --- main/http_api.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'main/http_api.c') diff --git a/main/http_api.c b/main/http_api.c index b9eade0..5e84db6 100644 --- a/main/http_api.c +++ b/main/http_api.c @@ -1,6 +1,7 @@ #include "http_api.h" #include +#include #include #include @@ -17,6 +18,7 @@ #include "esp_system.h" #include "esp_timer.h" +#include "chip_temp.h" #include "display.h" #include "jpeg_decoder.h" #include "mdns_service.h" @@ -78,6 +80,13 @@ static esp_err_t state_get_handler(httpd_req_t *req) // prevented (would-have-torn count under double buffering). cJSON_AddNumberToObject(root, "tear_guard_engaged", (double)display_tear_guard_engaged()); + // On-die junction temperature (°C, ~10-20° above ambient under + // load). Omitted entirely if the sensor is unavailable. + float temp_c = chip_temp_read(); + if (!isnan(temp_c)) { + cJSON_AddNumberToObject(root, "temp_c", + round((double)temp_c * 10.0) / 10.0); + } viewport_state_unlock(); -- cgit v1.2.3