Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Added

- 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.
Expand Down
31 changes: 31 additions & 0 deletions src/network/CrossPointWebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
#include <esp_efuse.h>
#include <esp_efuse_table.h>
#ifndef SIMULATOR
#include <FreeInkDisplay.h>
#include <esp_image_format.h>
#include <esp_ota_ops.h>
#endif

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iterator>

Expand Down Expand Up @@ -829,6 +831,35 @@ 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<JsonObject>();
#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<JsonObject>();
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<JsonObject>();
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<JsonObject>();
t["source"] = "uc8179";
t["c"] = panelC;
t["ageMs"] = panelAgeMs;
}
#endif
}
#endif

Expand Down
Loading