Skip to content

Commit 2e691e3

Browse files
safety: move relay fault management (#2281)
* safety: move relay fault management * set it
1 parent f6a06e3 commit 2e691e3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

board/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static void tick_handler(void) {
118118
static uint32_t controls_allowed_countdown = 0;
119119
static uint8_t prev_harness_status = HARNESS_STATUS_NC;
120120
static uint8_t loop_counter = 0U;
121+
static bool relay_malfunction_prev = false;
121122

122123
if (TICK_TIMER->SR != 0U) {
123124

@@ -130,6 +131,15 @@ static void tick_handler(void) {
130131
simple_watchdog_kick();
131132
sound_tick();
132133

134+
if (relay_malfunction_prev != relay_malfunction) {
135+
if (relay_malfunction) {
136+
fault_occurred(FAULT_RELAY_MALFUNCTION);
137+
} else {
138+
fault_recovered(FAULT_RELAY_MALFUNCTION);
139+
}
140+
}
141+
relay_malfunction_prev = relay_malfunction;
142+
133143
// re-init everything that uses harness status
134144
if (harness.status != prev_harness_status) {
135145
prev_harness_status = harness.status;

0 commit comments

Comments
 (0)