FunctionPointerStateMachineExample icon indicating copy to clipboard operation
FunctionPointerStateMachineExample copied to clipboard

Led_Init() never called upon initialization

Open faststoff opened this issue 7 years ago • 0 comments
trafficstars

StateMachine_Init() should ensure the function associated with the initialization state (ie. Led_Init()) get called. Now, the first function which gets called is the Led_Idle() function. Suggested change:

void StateMachine_Init(stateMachine_t * stateMachine) {
    printf("Initialising state machine.\r\n");
    stateMachine->currState = ST_INIT;
   (stateFunctionA[stateMachine->currState].func)(); //call initialization function
}

faststoff avatar Mar 18 '18 10:03 faststoff