mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-28 09:03:46 +08:00
22a8575199
Keep official openpilot ancestry and dependency licenses. Store resources directly in Git, remove LFS setup requirements, and leave the downloadable big model outside the source tree.
28 lines
673 B
C
28 lines
673 B
C
#pragma once
|
|
|
|
#include "board/sys/sys.h"
|
|
|
|
uint8_t fault_status = FAULT_STATUS_NONE;
|
|
uint32_t faults = 0U;
|
|
|
|
void fault_occurred(uint32_t fault) {
|
|
if ((faults & fault) == 0U) {
|
|
if ((PERMANENT_FAULTS & fault) != 0U) {
|
|
print("Permanent fault occurred: 0x"); puth(fault); print("\n");
|
|
fault_status = FAULT_STATUS_PERMANENT;
|
|
} else {
|
|
print("Temporary fault occurred: 0x"); puth(fault); print("\n");
|
|
fault_status = FAULT_STATUS_TEMPORARY;
|
|
}
|
|
}
|
|
faults |= fault;
|
|
}
|
|
|
|
void fault_recovered(uint32_t fault) {
|
|
if ((PERMANENT_FAULTS & fault) == 0U) {
|
|
faults &= ~fault;
|
|
} else {
|
|
print("Cannot recover from a permanent fault!\n");
|
|
}
|
|
}
|