From 95d14776adc5d5b85e33192636782377e3ec78c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 28 Sep 2026 02:01:34 +0000 Subject: [PATCH 1/2] feat: report temperatures in /api/status Chip (temperatureRead), battery gauge (BQ27220/CW2017) and, on S3 builds with the UC8179 driver, the panel's on-chip sensor with its sample age. Sensors a board lacks are omitted. Bumps freeink-sdk to 3c20ecf (feat/status-temps on the fork, based on ad146a5). Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XgLRarbAmBVepTPKCK7mgd --- CHANGELOG.md | 1 + freeink-sdk | 2 +- src/network/CrossPointWebServer.cpp | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b40efe757f5..1911c23e4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Added +- The web status API (`/api/status`) reports a `temperatures` block: the chip temperature, the battery fuel gauge's temperature on boards that have one (such as the X3), and on the X4 Pro the e-ink panel controller's own sensor, sampled after a screen refresh at most once a minute. Sensors a board lacks are left out. - View a selected book's reading stats from its Library or File Browser action menu. - Library replaces Recent Books with a searchable book list, and adds various book metadata sort options. - Reset a book's reader settings from the in-reader Settings tab. diff --git a/freeink-sdk b/freeink-sdk index ad146a56210..3c20ecf7871 160000 --- a/freeink-sdk +++ b/freeink-sdk @@ -1 +1 @@ -Subproject commit ad146a5621001a320c35f8f24dfd294a07959c3a +Subproject commit 3c20ecf78717ee791a0bc8852a04731079289745 diff --git a/src/network/CrossPointWebServer.cpp b/src/network/CrossPointWebServer.cpp index b716a5479ef..a857d4cb68d 100644 --- a/src/network/CrossPointWebServer.cpp +++ b/src/network/CrossPointWebServer.cpp @@ -17,12 +17,14 @@ #include #include #ifndef SIMULATOR +#include #include #include #endif #include #include +#include #include #include @@ -829,6 +831,33 @@ void CrossPointWebServer::handleStatus() const { static const BatteryMonitor monitor; battery["millivolts"] = monitor.readMillivolts(); battery["charging"] = monitor.isCharging(); + + // Temperatures in C, one entry per sensor the board has. The panel value + // is the UC8179's own sensor, sampled after a refresh at most once a + // minute; ageMs says how old it is. + JsonObject temps = doc["temperatures"].to(); + const float chipC = temperatureRead(); + if (!std::isnan(chipC)) { + JsonObject t = temps["chip"].to(); + t["source"] = CONFIG_IDF_TARGET; + t["c"] = std::round(chipC * 10.0f) / 10.0f; + } + int16_t gaugeDeciC = 0; + if (monitor.readTemperatureDeciC(gaugeDeciC)) { + JsonObject t = temps["battery"].to(); + t["source"] = BoardConfig::ACTIVE.batteryGauge.gaugeType == BoardConfig::GaugeType::Cw2017 ? "cw2017" : "bq27220"; + t["c"] = gaugeDeciC / 10.0f; + } +#if FREEINK_UC8179_PANEL_TEMP + int8_t panelC = 0; + uint32_t panelAgeMs = 0; + if (freeink::uc8179PanelTemperature(panelC, panelAgeMs)) { + JsonObject t = temps["panel"].to(); + t["source"] = "uc8179"; + t["c"] = panelC; + t["ageMs"] = panelAgeMs; + } +#endif } #endif From 53ba71cee393b097053819ac8ad17b037dbe1979 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 28 Sep 2026 02:28:04 +0000 Subject: [PATCH 2/2] feat: skip the chip temperature on the C3 Its sensor driver costs ~3.8 KB of flash on a build at 94.3%. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XgLRarbAmBVepTPKCK7mgd --- CHANGELOG.md | 2 +- src/network/CrossPointWebServer.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1911c23e4a0..466926487c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Added -- The web status API (`/api/status`) reports a `temperatures` block: the chip temperature, the battery fuel gauge's temperature on boards that have one (such as the X3), and on the X4 Pro the e-ink panel controller's own sensor, sampled after a screen refresh at most once a minute. Sensors a board lacks are left out. +- The web status API (`/api/status`) reports a `temperatures` block: the chip temperature on ESP32-S3 devices, the battery fuel gauge's temperature on boards that have one (such as the X3), and on the X4 Pro the e-ink panel controller's own sensor, sampled after a screen refresh at most once a minute. Sensors a board lacks are left out. - View a selected book's reading stats from its Library or File Browser action menu. - Library replaces Recent Books with a searchable book list, and adds various book metadata sort options. - Reset a book's reader settings from the in-reader Settings tab. diff --git a/src/network/CrossPointWebServer.cpp b/src/network/CrossPointWebServer.cpp index a857d4cb68d..99743a285ea 100644 --- a/src/network/CrossPointWebServer.cpp +++ b/src/network/CrossPointWebServer.cpp @@ -836,12 +836,14 @@ void CrossPointWebServer::handleStatus() const { // is the UC8179's own sensor, sampled after a refresh at most once a // minute; ageMs says how old it is. JsonObject temps = doc["temperatures"].to(); +#if !CONFIG_IDF_TARGET_ESP32C3 // the C3's sensor driver costs ~3.8 KB of flash const float chipC = temperatureRead(); if (!std::isnan(chipC)) { JsonObject t = temps["chip"].to(); t["source"] = CONFIG_IDF_TARGET; t["c"] = std::round(chipC * 10.0f) / 10.0f; } +#endif int16_t gaugeDeciC = 0; if (monitor.readTemperatureDeciC(gaugeDeciC)) { JsonObject t = temps["battery"].to();