fix: start web stats capture from boot on >=4MB PSRAM boards
Этот коммит содержится в:
@@ -28,12 +28,12 @@ Operational guidance:
|
|||||||
|
|
||||||
The screenshots below show the current split between the lighter `/app` admin page and the dedicated `/stats` status page.
|
The screenshots below show the current split between the lighter `/app` admin page and the dedicated `/stats` status page.
|
||||||
|
|
||||||
### `/app`
|
### `/app` screenshot
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
### `/stats`
|
### `/stats` screenshot
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
@@ -210,12 +210,14 @@ Stats samples are collected once per minute.
|
|||||||
|
|
||||||
Current in-memory history caps are:
|
Current in-memory history caps are:
|
||||||
|
|
||||||
| Board class | Sample cap | Event cap | Approx. sampled history |
|
| Board class | Sample cap | Event cap | Approx. sampled history |
|
||||||
| ------------------------------ | ---------: | --------: | ------------------------ |
|
| -------------------------------- | ---------: | --------: | ------------------------ |
|
||||||
| No PSRAM | `24` | `8` | Live-only recent history |
|
| No PSRAM | `24` | `8` | Live-only recent history |
|
||||||
| Less than `4MB` PSRAM | `240` | `96` | About `4` hours |
|
| Less than `4 MB` PSRAM | `240` | `96` | About `4` hours |
|
||||||
| `4MB` to less than `8MB` PSRAM | `480` | `192` | About `8` hours |
|
| `4 MB` to less than `8 MB` PSRAM | `480` | `192` | About `8` hours |
|
||||||
| `8MB` PSRAM or more | `720` | `288` | About `12` hours |
|
| `8 MB` PSRAM or more | `720` | `288` | About `12` hours |
|
||||||
|
|
||||||
|
On boards with `4 MB` PSRAM or more, stats history starts capturing from boot when `web.stats` is enabled, even if `/stats` has not been opened yet.
|
||||||
|
|
||||||
Archive-backed restore requires `web.stats` enabled plus a mounted SD card on boards that support the EastMesh archive path.
|
Archive-backed restore requires `web.stats` enabled plus a mounted SD card on boards that support the EastMesh archive path.
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ bool shouldUseLiveOnlyStats() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasBootAutoCapturePsram() {
|
||||||
|
#if defined(ESP32)
|
||||||
|
return psramFound() && ESP.getPsramSize() >= (4UL * 1024UL * 1024UL);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T* allocHistoryBuffer(size_t count) {
|
T* allocHistoryBuffer(size_t count) {
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
@@ -291,6 +299,9 @@ void StatsHistory::begin(bool enabled, ArchiveStorage* archive) {
|
|||||||
_enabled = enabled;
|
_enabled = enabled;
|
||||||
_next_summary_flush_ms = millis() + kSummaryFlushIntervalMs;
|
_next_summary_flush_ms = millis() + kSummaryFlushIntervalMs;
|
||||||
_next_event_flush_ms = millis() + kEventFlushIntervalMs;
|
_next_event_flush_ms = millis() + kEventFlushIntervalMs;
|
||||||
|
if (_enabled && shouldAutoActivateFromBoot()) {
|
||||||
|
activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsHistory::setArchive(ArchiveStorage* archive) {
|
void StatsHistory::setArchive(ArchiveStorage* archive) {
|
||||||
@@ -315,6 +326,9 @@ void StatsHistory::setEnabled(bool enabled) {
|
|||||||
_last_access_ms = 0;
|
_last_access_ms = 0;
|
||||||
_next_summary_flush_ms = millis() + kSummaryFlushIntervalMs;
|
_next_summary_flush_ms = millis() + kSummaryFlushIntervalMs;
|
||||||
_next_event_flush_ms = millis() + kEventFlushIntervalMs;
|
_next_event_flush_ms = millis() + kEventFlushIntervalMs;
|
||||||
|
if (shouldAutoActivateFromBoot()) {
|
||||||
|
activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,6 +411,10 @@ bool StatsHistory::supportsPersistence() const {
|
|||||||
return !_live_only;
|
return !_live_only;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StatsHistory::shouldAutoActivateFromBoot() const {
|
||||||
|
return _enabled && !_live_only && hasBootAutoCapturePsram();
|
||||||
|
}
|
||||||
|
|
||||||
bool StatsHistory::isAccessActive(uint32_t now_ms) const {
|
bool StatsHistory::isAccessActive(uint32_t now_ms) const {
|
||||||
if (!_live_only) {
|
if (!_live_only) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ private:
|
|||||||
bool ensureBuffers();
|
bool ensureBuffers();
|
||||||
void releaseBuffers();
|
void releaseBuffers();
|
||||||
bool supportsPersistence() const;
|
bool supportsPersistence() const;
|
||||||
|
bool shouldAutoActivateFromBoot() const;
|
||||||
bool isAccessActive(uint32_t now_ms) const;
|
bool isAccessActive(uint32_t now_ms) const;
|
||||||
bool restoreSummaryLog();
|
bool restoreSummaryLog();
|
||||||
bool restoreEventsLog();
|
bool restoreEventsLog();
|
||||||
|
|||||||
@@ -1684,7 +1684,7 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
|
|||||||
function sparkStrokeColor(key, points) {
|
function sparkStrokeColor(key, points) {
|
||||||
if (key === "packets") return "#d97706";
|
if (key === "packets") return "#d97706";
|
||||||
if (key === "signal") return "#3b82f6";
|
if (key === "signal") return "#3b82f6";
|
||||||
if (key === "noise_floor") return "#ef4444";
|
if (key === "noise_floor") return "#94a3b8";
|
||||||
if (key === "memory") {
|
if (key === "memory") {
|
||||||
const values = Array.isArray(points) ? points.map((item) => item && item[1]).filter((value) => Number.isFinite(value)) : [];
|
const values = Array.isArray(points) ? points.map((item) => item && item[1]).filter((value) => Number.isFinite(value)) : [];
|
||||||
const current = values.length ? values[values.length - 1] : NaN;
|
const current = values.length ? values[values.length - 1] : NaN;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user