143 return image_pending &&
150 SOTA_RST_POWERON = 1,
153 SOTA_RST_INT_WDT = 5,
154 SOTA_RST_TASK_WDT = 6,
156 SOTA_RST_DEEPSLEEP = 8,
157 SOTA_RST_BROWNOUT = 9,
168 return reset_reason == SOTA_RST_PANIC || reset_reason == SOTA_RST_INT_WDT ||
169 reset_reason == SOTA_RST_TASK_WDT || reset_reason == SOTA_RST_WDT;
175 switch (reset_reason) {
176 case SOTA_RST_PANIC:
return "panic";
177 case SOTA_RST_INT_WDT:
return "int_wdt";
178 case SOTA_RST_TASK_WDT:
return "task_wdt";
179 case SOTA_RST_WDT:
return "watchdog";
180 case SOTA_RST_BROWNOUT:
return "brownout";
181 case SOTA_RST_POWERON:
return "power_on";
182 case SOTA_RST_DEEPSLEEP:
return "deep_sleep";
183 default:
return "reset";
static bool sota_abandon_restores_identity(uint8_t staged)
An abandoned record puts the previous identity back only when it was saved in full.
Definition sota_trial.h:130
static bool sota_reset_is_crash(int reset_reason)
The reset was a crash or a watchdog.
Definition sota_trial.h:166
static bool sota_hold_pending_image(bool image_pending, sota_boot_outcome_t outcome)
Arduino's verifyRollbackLater(): keep an image the bootloader still has on probation (pending verify)...
Definition sota_trial.h:141
sota_boot_outcome_t
What a boot means for the saved trial record, and what to do about it.
Definition sota_trial.h:34
@ SOTA_BOOT_WAITING
Flashed, not booted yet (deep-sleep wake).
Definition sota_trial.h:39
@ SOTA_BOOT_NONE
No trial record.
Definition sota_trial.h:35
@ SOTA_BOOT_ROLLED_BACK
Not on the new image: restore identity, report.
Definition sota_trial.h:37
@ SOTA_BOOT_TRIAL
Running the new image: supervise it.
Definition sota_trial.h:36
@ SOTA_BOOT_ABANDONED
The slot switch never happened: drop quietly.
Definition sota_trial.h:40
@ SOTA_BOOT_TRIAL_RESET
The new image reset before it was confirmed: roll back.
Definition sota_trial.h:42
@ SOTA_BOOT_INCOMPLETE
The record cannot be checked: drop it.
Definition sota_trial.h:41
@ SOTA_BOOT_REPORT_PENDING
A previous boot recorded a rollback: report it.
Definition sota_trial.h:38
@ SOTA_BOOT_ROLLBACK_CUT
A rollback was saved but its slot switch never happened.
Definition sota_trial.h:43
@ SOTA_TRIAL_BOOTED
The new image booted once; any reset ends the trial.
Definition sota_trial.h:50
@ SOTA_TRIAL_ROLLED_BACK
A rollback was decided and saved.
Definition sota_trial.h:49
@ SOTA_TRIAL_STAGED
The new image has not booted yet.
Definition sota_trial.h:48
static sota_boot_outcome_t sota_classify_boot(const sota_boot_facts_t *f)
Classify this boot against the trial record.
Definition sota_trial.h:84
@ SOTA_STAGED_STARTED
The record is being written.
Definition sota_trial.h:59
@ SOTA_STAGED_SNAPSHOT
The previous image's identity is saved.
Definition sota_trial.h:60
static const char * sota_rollback_reason(int reset_reason)
Reason sent with rolled_back, from the reset that ended the trial.
Definition sota_trial.h:173
static bool sota_on_new_image(const sota_boot_facts_t *f)
Whether the running image is the update's, from sota_new_part or else sota_prev_part.
Definition sota_trial.h:76
The trial record and the boot's facts that sota_classify_boot() reads.
Definition sota_trial.h:64
uint32_t prev_part
sota_prev_part, 0 when missing.
Definition sota_trial.h:68
uint32_t boot_part
Partition the next boot selects, 0 when unknown.
Definition sota_trial.h:70
uint32_t new_part
sota_new_part, 0 when missing.
Definition sota_trial.h:67
uint8_t staged
sota_staged, 0 when missing.
Definition sota_trial.h:66
bool deep_sleep_wake
This boot is a wake from deep sleep.
Definition sota_trial.h:71
uint32_t running_part
Running partition address, 0 when unknown.
Definition sota_trial.h:69
uint8_t trial
sota_trial.
Definition sota_trial.h:65