Skip to content

Commit

Permalink
delaying after mpu transitions to OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
caiodasilva2005 committed Oct 30, 2024
1 parent 57403ed commit 77d2868
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Core/Src/state_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ static int transition_functional_state(func_state_t new_state, pdu_t *pdu,
/* Turn off high power peripherals */
// write_fan_battbox(pdu, true);
write_pump(pdu, false);
write_fault(pdu, true);
cerberus_state.nero =
(nero_state_t){ .nero_index = OFF, .home_mode = false };
osDelay(1000); /* Delay for 1 sec before faulting car */
write_fault(pdu, true);
serial_print("FAULTED\r\n");
break;
default:
Expand Down Expand Up @@ -227,11 +228,8 @@ int fault()
{
// count 5 seconds before unfaulting
osTimerStart(unfault_timer, pdMS_TO_TICKS(5 * 1000));
int status = queue_state_transition(
return queue_state_transition(
(state_req_t){ .id = FUNCTIONAL, .state.functional = FAULTED });
// delay for one second before faulting the car
osDelay(pdMS_TO_TICKS(1000));
return status;
}

void unfault_timer_callback(void *args)
Expand Down

0 comments on commit 77d2868

Please sign in to comment.