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
Add initial persistent parameter API #280
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jonasdn
requested review from
ataffanel,
evoggy,
gemenerik,
knmcguire and
tobbeanton
November 11, 2021 11:58
jonasdn
force-pushed
the
jonasdn/persistent_parameters
branch
4 times, most recently
from
November 12, 2021 06:28
e34c79e
to
8763d3e
Compare
krichardsson
suggested changes
Nov 12, 2021
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.
I just had a quick look
jonasdn
force-pushed
the
jonasdn/persistent_parameters
branch
from
November 12, 2021 08:04
8763d3e
to
b8ab6cc
Compare
Does it look better now? |
jonasdn
commented
Nov 25, 2021
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.
Looks good! Some comments below!
jonasdn
force-pushed
the
jonasdn/persistent_parameters
branch
2 times, most recently
from
November 25, 2021 14:28
fa33e95
to
9c2cf81
Compare
Get the state of the specified persistent parameter. The state will be returned in the supplied callback. The state is represented as a namedtuple with members: `is_stored`, `default_value` and `stored_value`. The state is `None` if the parameter is not persistent or if something goes wrong. | Member | Description | | ----------------- | ----------------------------------------------- | | `is_stored` | `True` if the value is stored to eeprom | | `default_value` | The default value supplied by the firmware | | `stored_value` | Value stored in eeprom, None if `not is_stored` |
Store the current value of the specified persistent parameter to eeprom. The supplied callback will be called with `True` as an argument on success, and with `False` as an argument on failure.
Clear the current value of the specified persistent parameter from eeprom. The supplied callback will be called with `True` as an argument on success, and with `False` as an argument on failure.
So that the same callback can multiplex for a lot of parameters.
When doing persitent param operations, check that the parameter is persistent. Otherwise throw exception.
krichardsson
force-pushed
the
jonasdn/persistent_parameters
branch
from
December 1, 2021 13:00
c433cf8
to
10b2276
Compare
To make sure they get treated in the same queue and do not race against each other.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A persistent parameter is one that can be stored to eeprom. The way to do this is to set a value to the parameter, using the regular parameter API, and then use CRTP to tell the firmware to store the value. A value can also be cleared from eeprom using CRTP.
In order to build nice UIs we want to be able to tell whether a persistent parameter is stored or not, and what the default value of the parameter is. This is done by asking the firmware about the state.
Also! Since we are taking the last bit in the parameter type to express that this is a persistent parameter we have now introduced the concept of extended type information. That we also fetch as part of the connection in the Crazyflie class.
Contains the following commit: