Open Thelmos opened 8 years ago
Created pull request #11 solving this and other issues.
I am using this version of the library but I am now getting errors:
collect2.exe*:error: ld returned 1 exit status Error creating .elf
Is there an include statement missing?
@DeeJee You'll need to post some code. That error can be for multiple reasons (e.g. missing namespace). Try to reproduce the error with as small a program as possible and post it here. Also worth making sure that by "this version" you mean the code in the pull request this issue references?
Also worth making sure that by "this version" you mean the code in the pull request this issue references? Yes, I was referring to the code in the pull request.
I did what you suggested and made a tiny program with only the state machine code in it. It now compiles fine. That leaves me with a quest to find the code that caused the problem. The main version of the state machine works fine with my code but the code from the pull request does not. I think I made a mistake in my own code that I got away with.... until now.
Anyway, thank you for your tip. I should have thought about that myself :o
I currently have the state machine in use in my project. It is working fine and I an using all three functions. Thank you for creating this library.
@DeeJee Are you referring to init
, check
and trigger
as the "three functions"?
I am referring to the three functions that are passed into the State objects. I believe they are called on_enter, on_state and on_exit.
Allow states to have a
on_state()
function that will run while in that state.Main program loop will need a call to
run_machine()
to resolve thanon_state()
calls and resolve timed transitions.This example shows how it would work (not tested, can contain errors):