Skip to content

SystemModule

Source: SystemModule.h

SystemModule

class SystemModule
src/core/system/SystemModule.h:41

Inherits: MoonModule

The device's identity and its vitals, always loaded and always visible.

It owns the network name and the hardware model, and surfaces the live tick metrics.

Prior art: MoonLight's system diagnostics over REST, with the device name driving mDNS.

SystemModule card

Public Methods

inline void setScheduler(Scheduler * s) : Adopt the scheduler, whose timings the vitals read.

virtual inline bool respectsEnabled() const override : Keep the diagnostics ticking, since hiding uptime and heap serves nobody.

virtual inline void setup() override : Settle the device name, prime the static readouts, and apply the saved log level.

inline platform::LogLevel logLevel() const : The persisted log level, which the main loop reads to gate its once-a-second line.

virtual inline void onControlChanged(const char * controlName) override : Apply a log-level change live, and re-assert the firmware variant a load overwrote.

virtual inline void defineControls() override : Declare the identity controls, the live gauges and the static readouts.

virtual inline void tick1s() override : Coerce the device name, then refresh every live reading.

inline const char * deviceName() const : The network identity, guaranteed a valid non-empty hostname since it is coerced each tick.

inline const char * deviceModel() const : The physical-hardware identity (device-model catalog entry name), pushed by tooling.

Public Static Methods

static inline bool validateDeviceModel(const char * value) : Accept printable ASCII within the buffer, which every write path checks.

More info

What it reports

The dynamic readings refresh every second: uptime, frames a second, tick time, heap and PSRAM. The static ones are read once at boot: chip, CPU, SDK, flash and the reset reason.

PSRAM is derived rather than flagged, since the allocator merges its pool at boot. A total larger than the internal total is the signal, so a board without it adds nothing. The co-processor readout appears only where the radio is a separate chip.

The two identities

deviceName is the one network identity, behind mDNS, the SoftAP SSID and DHCP. It is coerced to a valid hostname every tick, so a rename propagates within one tick.

deviceModel is the physical board, an entry from the device-model catalog. A device cannot identify its own hardware, so tooling pushes this one. A validator on the control checks every write path rather than each transport doing so.