-
-
Notifications
You must be signed in to change notification settings - Fork 967
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
SystemTask state refactor #2109
SystemTask state refactor #2109
Conversation
Build size and comparison to main:
|
State transitions now happen immediately where possible This simplifies state management in general, and prevents bugs such as the chime issue from occurring in the first place
c2a39b3
to
4b6b9d3
Compare
Inverted state check to make adding new states smoother |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A documentation of the states of SystemTask (a state diagram for example) would probably be helpful to understand this PR and for future us. This might be not blocking for this PR, but this would be a really nice addition for developers and contributors ;-)
I'm pretty terrible at graphics but I'll give it a go! |
PR InfiniTimeOrg/InfiniTime#2109 refactors the `SystemTask.h` state machine to prevent `GoingToSleep` race conditions (and similar state transistions). In doing so the function `uxQueueMessagesWaiting()` from NRF SDK was used. Implement this newly used function.
PR InfiniTimeOrg/InfiniTime#2109 refactors the `SystemTask.h` state machine to prevent `GoingToSleep` race conditions (and similar state transistions). In doing so the function `uxQueueMessagesWaiting()` from NRF SDK was used. Implement this newly used function.
Updating InfiniSim to support the newly used function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looking sound
Currently SystemTask is somewhat fragile to duplicate state transitions and unusual state transition message orders. Most notably this can cause it to get stuck in
GoingToSleep
in some scenarios.This PR introduces GoToSleep() and changes GoToRunning() as immediately executable functions. The guarantee that state transitions happen immediately reduces complexity when it comes to ensuring the device is awake for events such as Chimes
Fixes part of #1790 #2012 (there may be other issues contributing to these, but this is probably part of it)