Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/FSM/FooContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct FooContext
static FState<FooContext> sCooldown;

uint8_t count;
uint8_t elapsed;
unsigned long elapsed;

FSM<FooContext>* fsm;
};
};
6 changes: 4 additions & 2 deletions examples/FSM/States/RunState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ static void update(FooContext* const ctx)

if (digitalRead(4) == LOW)
ctx->fsm->transitionTo(FooContext::sOff);
else if (((ctx->count + 1) % 6) == 0)
else if (((ctx->count + 1) % 6) == 0){
ctx->count = 0;
ctx->fsm->transitionTo(FooContext::sCooldown);
}
}

FState<FooContext> FooContext::sRun(enter, update, nullptr);
FState<FooContext> FooContext::sRun(enter, update, nullptr);
6 changes: 3 additions & 3 deletions examples/HSM/FooContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ struct FooContext
static HState<FooContext> sCooldown;

uint8_t count;
uint8_t current;
uint8_t elapsed;
unsigned long current;
unsigned long elapsed;

HSM<FooContext, 5>* hsm;
};
};
6 changes: 4 additions & 2 deletions examples/HSM/States/RunState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ static void update(FooContext* const ctx)
ctx->count++;
}

if (((ctx->count +1) % 6) == 0)
if (((ctx->count +1) % 6) == 0){
ctx->count = 0;
ctx->transitionTo(FooContext::sCooldown);
}
}

HState<FooContext> FooContext::sRun(&FooContext::sOnGroup, enter, update, nullptr);
HState<FooContext> FooContext::sRun(&FooContext::sOnGroup, enter, update, nullptr);