32 #ifndef ROSFLIGHT_FIRMWARE_STATE_MANAGER_H 33 #define ROSFLIGHT_FIRMWARE_STATE_MANAGER_H 87 static constexpr uint32_t ARM_MAGIC =
90 uint16_t reset_count = 0;
91 uint16_t error_code = 0;
92 uint32_t arm_flag = 0;
111 uint32_t checksum = 0;
130 bool valid_checksum()
188 #endif // ROSFLIGHT_FIRMWARE_STATE_MANAGER_H
void write_backup_data(const BackupData::DebugInfo &debug)
Write recovery data to backup memory in the case of a hard fault.
void set_event(Event event)
uint32_t hardfault_count_
const State & state() const
struct __attribute__((packed)) BackupData
Stores backup data for restoring the system state after a hard fault.
uint16_t checksum_fletcher16(const uint8_t *src, size_t len, bool finalize=true, uint16_t start=0)
Fletcher 16-bit checksum.
void set_error(uint16_t error)
void clear_error(uint16_t error)
void check_backup_memory()
StateManager(ROSflight &parent)
uint32_t next_led_blink_ms_
uint32_t next_arming_error_msg_ms_