feat(Telemetry,FileManager,LoggingHandler): QA-to-shipping stats reset — telemetry.reset_boot_data + logs.clear

Console wants a "reset device stats before shipping" button for staff to
clear QA-bench data (test reboots, debug log spam) without wiping actual
device configuration. telemetry.reset_strikes and telemetry.reset_metrics
already covered bell strikes and runtime/playback counters — this adds the
two gaps: lifetime boot count + SD boot history, and SD debug logs.

Deliberately does not touch FirmwareValidator's NVS namespace (rollback
safety state, not history) or device identity NVS (serial/hw_family).

Verified: pio run on all four board variants.
This commit is contained in:
2026-07-17 14:14:55 +03:00
parent 959cb77d81
commit f41332a771
11 changed files with 172 additions and 2 deletions
+1
View File
@@ -30,6 +30,7 @@ Telemetry tracks per-bell strike counts and thermal load to protect actuators fr
| `bool isFaultReset() const` | Returns `true` if the captured reset reason indicates a fault: `ESP_RST_PANIC`, `ESP_RST_INT_WDT`, `ESP_RST_TASK_WDT`, `ESP_RST_WDT`, or `ESP_RST_BROWNOUT`. `false` for expected resets (power-on, software reset/OTA, deep sleep wake, etc). |
| `String getResetReasonString() const` | Human-readable reset reason, e.g. `"PANIC"`, `"POWERON"`, `"TASK_WATCHDOG"`. |
| `uint32_t getLifetimeBootCount() const` | NVS-backed count of every boot this device has ever done. The authoritative counter — see [Boot tracking](#boot-tracking) below for why this exists alongside two other, narrower counters. |
| `bool resetBootData()` | Zeroes the lifetime boot counter (NVS `vesper_boot`) and deletes the SD boot history log (`/telemetry_boot_log.json`). Used by `telemetry.reset_boot_data` — a QA-to-shipping reset, see F-057 in the [feature catalog](../../docs/features/feature-catalog.md). Does NOT touch `FirmwareValidator`'s separate NVS namespace. Returns `false` only if the NVS write itself failed; the SD deletion is always best-effort. |
| `const CrashReport& getCrashReport() const` | Coredump summary from the most recent crash, if one was found at `begin()`. `.available` is `false` when the last reset wasn't a crash, or no coredump was present for one that was. |
| `void sampleDiagnosticsIfDue()` | Called from `TelemetryTask`'s existing 1s loop. Reads `temperatureRead()` every `DIAGNOSTICS_SAMPLE_INTERVAL_MS` (15s) and folds it into `temperatureStats`. See [Diagnostics reporting](#diagnostics-reporting) below. |
| `const RunningStats& getTemperatureStats() const` | Current accumulated min/max/avg temperature since the last `resetDiagnosticsStats()`. |