Public Access
Five views, Tab between them: Overview (each core's load, memory, traffic, battery, two minutes of load), Tasks (share of a core over the last second, lowest free stack, flagged under 512 bytes; `s` sorts), Memory (free heap against the floors of Q86), Network (bytes per service, and what's moving now), System (what `info` prints, plus battery, card, radio, GNSS). It samples once a second and keeps history only while open. The arithmetic is host-tested, including the trap found on the device: a task's run-time counter only moves when it's switched out, so the task that samples (the main loop, alone on its core) gets what's left of its core. `tasks` now samples across a second of normal running instead of inside its own wait. The main loop uses 100 % of core 1 at rest (#40). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
38 lines
1.7 KiB
C++
38 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <Print.h>
|
|
#include <esp_partition.h>
|
|
|
|
#include <vector>
|
|
|
|
#include "key_value_store.h"
|
|
#include "task_stats.h"
|
|
|
|
namespace roro::system_info {
|
|
|
|
// Why the chip last started: "power-on", "panic", "task watchdog", "brownout"...
|
|
const char* resetReason();
|
|
// True if the last start was a crash or a watchdog, not a power-on or a deliberate restart.
|
|
bool resetWasCrash();
|
|
|
|
// Firmware, uptime and memory, one fact per line.
|
|
void printSystem(Print& out);
|
|
// Both app slots: which one runs, which boots next, and each one's version and OTA state. Versions
|
|
// come from NVS ("ver_<slot>"): the prebuilt framework stamps every image with its own version.
|
|
void printSlots(Print& out, KeyValueStore& store);
|
|
// Remembers which version the running slot holds (call at boot), or the slot an update just wrote.
|
|
void recordSlotVersion(KeyValueStore& store, const esp_partition_t* slot, const char* version);
|
|
// FreeRTOS tasks: state, priority, lowest free stack, CPU share since boot.
|
|
// The tasks' shares since `before` was sampled (with its run-time clock). The caller lets the main
|
|
// loop run in between: sampling twice inside one command would show the loop asleep.
|
|
void printTasks(Print& out, const std::vector<TaskSample>& before, uint32_t beforeTotal);
|
|
// Every task as FreeRTOS reports it now; returns the run-time clock (microseconds, 32 bits), to
|
|
// pair with the samples. Two of these make the shares the System App and `tasks` show.
|
|
uint32_t sampleTasks(std::vector<TaskSample>& out);
|
|
|
|
// Boots the firmware in the other app slot if it holds a valid image (a manual Rollback).
|
|
// Returns an error message; on success it restarts and doesn't return.
|
|
const char* bootOtherSlot();
|
|
|
|
} // namespace roro::system_info
|