@@ -132,7 +132,7 @@ static int addTransition(char *stateName, stateTransition_t *trans) {
132132
133133static int initIdle (state_t * idle ) {
134134
135- initTransition (idle -> transitions [0 ], findState (PUMPDOWN_NAME ), genTranAction );
135+ initTransition (idle -> transitions [0 ], findState (PUMPDOWN_NAME ), toPumpdown );
136136 initTransition (idle -> transitions [1 ], findState (NON_RUN_FAULT_NAME ), genTranAction );
137137 initTransition (idle -> transitions [2 ], findState (RUN_FAULT_NAME ), toRunFault );
138138 addTransition (IDLE_NAME , idle -> transitions [0 ]);
@@ -265,11 +265,10 @@ state_t *getCurrState() {
265265void runStateMachine (void ) {
266266 /* The cmd receiver will populate this field if we get an override */
267267 if (strcmp (stateMachine .overrideStateName , BLANK_NAME ) != 0 ) {
268-
269268 state_t * tempState = findState (stateMachine .overrideStateName );
270269 /* TODO We also need to execute a transition if it exists here */
271270 if (tempState != NULL ) {
272- stateTransition_t * trans = findTransition (tempState , stateMachine .overrideStateName );
271+ stateTransition_t * trans = findTransition (stateMachine . currState , stateMachine .overrideStateName );
273272 if (trans != NULL ) trans -> action ();
274273 stateMachine .currState = tempState ;
275274 }
@@ -304,7 +303,7 @@ void buildStateMachine(void) {
304303 initState (stateMachine .allStates [0 ], IDLE_NAME , idleAction , 3 );
305304 initState (stateMachine .allStates [1 ], PUMPDOWN_NAME , pumpdownAction , 2 );
306305 initState (stateMachine .allStates [2 ], PROPULSION_NAME , propulsionAction , 2 );
307- initState (stateMachine .allStates [3 ], BRAKING_NAME , brakingAction , 3 );
306+ initState (stateMachine .allStates [3 ], BRAKING_NAME , brakingAction , 2 );
308307 initState (stateMachine .allStates [4 ], SERV_PRECHARGE_NAME , servPrechargeAction , 2 );
309308 initState (stateMachine .allStates [5 ], CRAWL_NAME , crawlAction , 3 );
310309 initState (stateMachine .allStates [6 ], STOPPED_NAME , stoppedAction , 3 );
0 commit comments