add comments
This commit is contained in:
@@ -70,8 +70,12 @@ enum states get_current_state()
|
||||
}
|
||||
|
||||
|
||||
// doesn't have to be a fn anymore, but will be to maintain readability, expandability,
|
||||
// compatibility with setup() fn
|
||||
// also speed impact probably doesn't matter much since setup() runs once per boot
|
||||
void initialiseEncoderStateMachine()
|
||||
{
|
||||
// gets current state (initial) state and sets it
|
||||
state = get_current_state();
|
||||
}
|
||||
|
||||
@@ -80,11 +84,12 @@ void updateEncoderStateMachine()
|
||||
{
|
||||
enum states new_state = get_current_state(); // get new state, don't update state yet so states can be compared
|
||||
|
||||
// check new state is valid, coming from state1, increment error count if not
|
||||
// adjust count as appropriate if new state is valid
|
||||
// repeat for all other state cases
|
||||
switch (state)
|
||||
{
|
||||
case state1:
|
||||
// check new state is valid, coming from state1, increment error count if not
|
||||
// adjust count as appropriate if new state is valid
|
||||
switch (new_state) {
|
||||
case state1: break;
|
||||
case state2: count++; break;
|
||||
|
||||
Reference in New Issue
Block a user