MCPcopy Create free account
hub / github.com/FastLED/FastLED / scopedWatchdogFirstInit

Function scopedWatchdogFirstInit

src/fl/wdt/watchdog.cpp.hpp:129–150  ·  view source on GitHub ↗

First-init helper, used by ScopedWatchdog's constructor. Runs only once per process. Single-threaded loop() is the canonical caller — no atomics are needed for the guard byte on supported MCUs.

Source from the content-addressed store, hash-verified

127// per process. Single-threaded loop() is the canonical caller — no atomics
128// are needed for the guard byte on supported MCUs.
129inline void scopedWatchdogFirstInit(fl::u32 timeout_ms) FL_NOEXCEPT {
130 Watchdog& wdt = Watchdog::instance();
131 wdt.begin(timeout_ms);
132
133 ResetInfo info = wdt.lastResetInfo();
134 if (info.cause == ResetCause::WATCHDOG ||
135 info.cause == ResetCause::PANIC ||
136 info.cause == ResetCause::LOCKUP) {
137 char buf[128];
138 fl::size n = info.describe(fl::span<char>(buf, sizeof(buf)), /*verbose=*/true);
139 scopedWatchdogPrintLine(fl::string_view("[FastLED.watchdog] recovered from:"));
140 scopedWatchdogPrintLine(fl::string_view(buf, n));
141
142 if (wdt.hasCrashReport()) {
143 // Hook for Tier 2 platforms. Future revision: also emit a
144 // multi-line CrashReport::describe() result here. For now the
145 // bare cause + raw register is the documented contract.
146 }
147 scopedWatchdogPause3s();
148 }
149 scopedWatchdogPrintLine(fl::string_view("[FastLED.watchdog] armed via FL_WATCHDOG_AUTO()"));
150}
151
152} // namespace platforms
153

Callers 1

ScopedWatchdogMethod · 0.85

Calls 7

scopedWatchdogPrintLineFunction · 0.85
scopedWatchdogPause3sFunction · 0.85
lastResetInfoMethod · 0.80
describeMethod · 0.80
string_viewClass · 0.50
beginMethod · 0.45
hasCrashReportMethod · 0.45

Tested by

no test coverage detected