add comments

This commit is contained in:
2023-10-12 22:15:24 +01:00
parent eb97dc0f60
commit a602f20e01
4 changed files with 50 additions and 31 deletions

View File

@@ -286,6 +286,7 @@ enum states get_current_state()
// 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();
}
@@ -294,11 +295,12 @@ void updateEncoderStateMachine()
{
enum states new_state = get_current_state(); // get new state, don't update state var 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;