fix: improve web stats startup and memory indicators

This commit is contained in:
Jared Dohrman
2026-04-17 17:40:32 +10:00
parent 05fcffc838
commit 64402c7f5e
5 changed files with 70 additions and 24 deletions
+14 -1
View File
@@ -28,6 +28,7 @@ constexpr uint32_t kEventFlushIntervalMs = 60UL * 1000UL;
constexpr size_t kMaxSeriesPoints = 64;
constexpr size_t kSummaryRestoreWindowBytes = 16384;
constexpr size_t kEventsRestoreWindowBytes = 4096;
constexpr uint32_t kBootAutoCapturePsramMinBytes = 2000000UL;
constexpr size_t kLiveOnlySampleCapacity = 24;
constexpr size_t kLiveOnlyEventCapacity = 8;
@@ -66,7 +67,7 @@ bool shouldUseLiveOnlyStats() {
bool hasBootAutoCapturePsram() {
#if defined(ESP32)
return psramFound() && ESP.getPsramSize() >= (4UL * 1024UL * 1024UL);
return psramFound() && ESP.getPsramSize() >= kBootAutoCapturePsramMinBytes;
#else
return false;
#endif
@@ -415,6 +416,18 @@ bool StatsHistory::shouldAutoActivateFromBoot() const {
return _enabled && !_live_only && hasBootAutoCapturePsram();
}
bool StatsHistory::isBootAutoCaptureExpected() const {
return shouldAutoActivateFromBoot();
}
uint32_t StatsHistory::getDetectedPsramSizeBytes() const {
#if defined(ESP32)
return psramFound() ? ESP.getPsramSize() : 0;
#else
return 0;
#endif
}
bool StatsHistory::isAccessActive(uint32_t now_ms) const {
if (!_live_only) {
return true;