-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2.2.0 #11
v2.2.0 #11
Conversation
* Add `on_state()` handler to states * New `run_machine()` method to invoke machine execution (includes a `check_timed_transitions()` call) * New `timed_switchoff.ino` example sketch to ilustrate new `on_state()` and `run_machine()` funcionality * Corrections: - `make_transition()` correctly initialices timed transitions start milliseconds (`make_transition()` is now a fsm method) - Initial state `on_enter()` handler is now correctly executed on fsm first run - Removed `Serial.println(now);` trace in _Fsm.cpp_ - Correct initialization of `m_num_timed_transitions`
@Thelmos Great job! Did you mean to add a copy of |
@Thelmos Also, in the I suggest we require at least one call to |
Mmmm, you are right, Regarding the |
I may have had a good idea, ... What if we replace all This would have several benefits:
As a drawback What do you think about this idea? |
This library is usefull for my projects, but I need some changes to improve some aspects ... So I made a fork and coded some changes, some of that changes were in onther PR but not applied in the way I needed. I made a PR in case library owner wants to merge my changes in main repository, it's up to @jonblack decide what PRs he accepts, as it's up to me what PR I made. |
@Thelmos I was also thinking about this but I'm beginning to favour splitting it up more so that the methods have a clear responsibilities:
The problem I have with a single @redge76 As far as I can tell, this solution would work for you as well since
@Thelmos How were the changes in other PR's not applied in the way you needed? If there's a difference it's worth discussing so everyone is happy. I agree it's a shame the other pull request commit history isn't included. |
I think you are right, simplifying interface makes it more obscure and less flexible. Regarding changes in other PR, I don't like for example how the correction for timed transitions was done in corna@b5b4a46 Looks more natural to me sove this in I was in a hurry with my project, it is now almost finished using my fork, thats why I implement all changes so fast, but feel free to reject my PR, your idea looks better than my |
I would like to avoid because you have to wait for some loop execution before arriving to the destination state. but I think I can live with this. |
You are right @redge76, I have found some other situations where a "decoupled" Perhaps |
I've made the changes I mentioned in the branch https://github.com/jonblack/arduino-fsm/tree/Thelmos-master. I wanted to merge it into this pull-request but couldn't find out how (if it's even possible). If anyone knows how, please fill me in. The update contains:
@Thelmos I was going to implement "marking transitions" with I do like the idea of |
I will take a look at your branch asap. Regarding trigger() function... I think we can keep it simple and make it store only last triggered event that could fire a transition from current state, so next process() call will perform that transition. We also need to decide what process() function will check in first place, timed transitions or triggered events, ... I would go for timed transitions. |
@Thelmos I agree it's better to keep it simple. Let's store the last transition, then. I also agree that timed transitions should be processed first. |
That is not easily possible. You would need to create a patch and move that into into your own repository. :-( |
Yeah, since that comment I've come across this a lot. It's kind of a shame you can't collaborate on pull requests. For now I've been pulling locally, making changes that need adding, and then merging into master and pushing. |
Is version 2.2.0 working ? |
Give it a try and see. I haven't looked at this in a while. I'm hoping to go through all these issues soon as I'll have some free time on my hands. If you find something wrong in the meantime, it'd be a great help. |
Hi, You really need to merge this pull request to the master branch. (or just delete everything in master and push all the files of thelmos ) Currently the version distributed in platformio and arduino is 2.1 :-( |
I'm playing with it to see if it works alright...
What about the changes on the Thelmos-master branch? |
I mean to "copy" all files from thelmos to master. |
I'm going through both my arduino libraries now and updating them. After next week, I have a bit of time to work on it. I'm sorry this is taking so long. I'll get there :) |
on_state()
handler to statesrun_machine()
method to invoke machine execution (includes acheck_timed_transitions()
call)timed_switchoff.ino
example sketch to ilustrate newon_state()
and
run_machine()
funcionalitymake_transition()
correctly initialices timed transitions startmilliseconds (
make_transition()
is now a fsm method)on_enter()
handler is now correctly executed on fsmfirst run
Serial.println(now);
trace in Fsm.cppm_num_timed_transitions