mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 09:13:52 +08:00
safety: move relay fault management (#2281)
* safety: move relay fault management * set it
This commit is contained in:
10
board/main.c
10
board/main.c
@@ -118,6 +118,7 @@ static void tick_handler(void) {
|
||||
static uint32_t controls_allowed_countdown = 0;
|
||||
static uint8_t prev_harness_status = HARNESS_STATUS_NC;
|
||||
static uint8_t loop_counter = 0U;
|
||||
static bool relay_malfunction_prev = false;
|
||||
|
||||
if (TICK_TIMER->SR != 0U) {
|
||||
|
||||
@@ -130,6 +131,15 @@ static void tick_handler(void) {
|
||||
simple_watchdog_kick();
|
||||
sound_tick();
|
||||
|
||||
if (relay_malfunction_prev != relay_malfunction) {
|
||||
if (relay_malfunction) {
|
||||
fault_occurred(FAULT_RELAY_MALFUNCTION);
|
||||
} else {
|
||||
fault_recovered(FAULT_RELAY_MALFUNCTION);
|
||||
}
|
||||
}
|
||||
relay_malfunction_prev = relay_malfunction;
|
||||
|
||||
// re-init everything that uses harness status
|
||||
if (harness.status != prev_harness_status) {
|
||||
prev_harness_status = harness.status;
|
||||
|
||||
Reference in New Issue
Block a user