Northeastern-Electric-Racing / Cerberus

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

[RTOS] - State Machine Cleanup #168

Open nwdepatie opened 1 month ago

nwdepatie commented 1 month ago

Description

Currently we have two different implementations of the state machine transition, one in a task and one in a function. I think that either approach would work but we just need to choose and formalize it.

Acceptance Criteria

Functionally equivalent code that transitions states as before.

Proposed Solution

This can go two ways:

  1. Keep the state machine task and use the function of queue_state_transition to actually queue something. Remove the extra stuff in that function too and let the stateMachineDirector handle it
  2. Keep everything in that function and remove the stateMachineDirector task. We would still need a way of getting the PDU struct into the file somehow, so we'd either need a new initStateMachine function or some extern magic in this case

I think both should work

nwdepatie commented 1 month ago

As a bonus, disable interrupts while switching states to make a critical section of code :) I think there is a function to disable NVIC interrupts