Northeastern-Electric-Racing / Cerberus

Our FreeRTOS-based vehicle control application
1 stars 0 forks source link

Bms fault fixes #182

Closed jr1221 closed 3 weeks ago

jr1221 commented 4 weeks ago

Once we switched from crashing the code to a simple timer, the bms fault would behave differently and refault the car after a pause. Also, since we used a switch statement without breaks it was never gonna work. This PR fixes the faulting by making the timer run all the time on a loop and restart when faulted.

Sequence: No message: wait 4s --> fault car --> wait 4s --> fault car, in effect resetting the car fault timer 1 second before it would put the car back into ready. If message comes back, will unfault after minimum 1 second maximum 5 seconds by not allowing the car fault time to be reset, so it can expire.

Message recieved in under 4s, timer reset.