src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/chip_temp.h
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-07-15 19:18:32 -0500
committerLuke Hoersten <[email protected]>2026-07-15 19:18:32 -0500
commitf59cea3be9eed8d63fa44d4fd360c9c68e9318f6 (patch)
tree699a0b554d04600520505c9e5bf835f89663af9f /main/chip_temp.h
parent659da7f36473a21494693f031a39fb6bb977b90a (diff)
temp: report on-die temperature in /state and the info screen
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.
Diffstat (limited to 'main/chip_temp.h')
-rw-r--r--main/chip_temp.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/chip_temp.h b/main/chip_temp.h
new file mode 100644
index 0000000..ef3e792
--- /dev/null
+++ b/main/chip_temp.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "esp_err.h"
+
+// On-die temperature sensor (ESP32-P4 TSENS). Init once at boot; reads are
+// cheap (~µs) and safe from any task. Note this is junction temperature —
+// expect ~10-20°C above ambient under load; useful for trending and
+// thermal-throttle debugging, not room temperature.
+esp_err_t chip_temp_init(void);
+
+// Degrees Celsius, or NAN if the sensor isn't initialized / read failed.
+float chip_temp_read(void);