4#include "LocalTimeRK.h"
6#include "PublishQueuePosixRK.h"
28static int resolveErrorAction() {
29 int8_t alert =
current.get_alertCode();
30 uint8_t resets =
sysStatus.get_resetCount();
39 Log.info(
"OOM alert but reset count=%u; suppressing further resets", resets);
48 Log.info(
"Connectivity alert %d with reset count=%u; suppressing further resets", alert, resets);
57 if (!Time.isValid()) {
58 Log.info(
"Alert 40 set but time is invalid - deferring corrective action");
62 time_t lastHook =
sysStatus.get_lastHookResponse();
64 Log.info(
"Alert 40 set but no recorded lastHookResponse - deferring corrective action");
68 time_t now = Time.now();
69 if ((now - lastHook) > (3 * 3600L)) {
70 Log.info(
"Alert 40 - no successful webhook response for >3 hours, scheduling soft reset");
74 Log.info(
"Alert 40 active but webhook response is recent - no reset needed");
84 Log.info(
"Alert 16 with reset count=%u; suppressing further resets", resets);
101 static unsigned long resetTimer = 0;
102 static int resolution = 0;
113 int8_t alert =
current.get_alertCode();
114 if (alert == 15 || alert == 16 || alert == 31) {
115 Log.warn(
"Low-power mode: clearing alert %d to avoid reset loop", alert);
120 resolution = resolveErrorAction();
123 resolution = resolveErrorAction();
125 Log.info(
"Entering ERROR_STATE with alert=%d, resetCount=%u, resolution=%d",
127 resetTimer = millis();
130 switch (resolution) {
142 Log.info(
"Executing soft reset from ERROR_STATE");
152 Log.info(
"Executing deep power down from ERROR_STATE (alert=%d)",
current.get_alertCode());
Cloud Configuration Management - Particle Ledger integration for device configuration.
Global compile-time configuration options and enums.
const unsigned long resetWait
void publishStateTransition()
Persistent Data Storage Structures - EEPROM/Retained Memory Management.
Singleton wrapper around ISensor implementations.
void requestFullDisconnectAndRadioOff()
Pinout definitions for the carrier board and sensors.