Skip to content
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

AP_Param: add @SYS/defaults.parm and log default values #20972

Merged
merged 16 commits into from
Jul 20, 2022

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Jun 13, 2022

This adds a @SYS/defaults.parm ftp file that contains all the defaults for the board. Those default values are also logged in the PARM log at first arming. You do not get the defaults again with run-time changes.

This works, however we need to make sure everywhere is calling set_default not just set, this induces changes to AC_PID to follow that pattern so the defaults are correctly recorded. There are probably other places that doing the wrong thing where we would not get the correct value.

This does keep a linked list of all the params that have ever had set_defualt called on them, so we should probably not do that too much.... I have not calculated how many this is, probably less than 50...

The goal of this is to make it very easy to spot which params have been changed, with this patch one can grab the defaults over ftp and do a param compare.

@IamPete1
Copy link
Member Author

Look like this is just enough to push Hitec Airspeed over the edge, its only getting the AP_Param changes, could aggressively define them out on periph I guess....

@IamPete1 IamPete1 force-pushed the defaults_file_sys branch from b730d32 to e358675 Compare June 13, 2022 22:40
@IamPete1
Copy link
Member Author

Functionality now removed on Periph as much as possible to minimize flash cost. Also tested with params loaded from scripting, works as expected.

@IamPete1 IamPete1 force-pushed the defaults_file_sys branch 5 times, most recently from 5eedb8c to a4b79ad Compare June 21, 2022 14:47
@IamPete1 IamPete1 force-pushed the defaults_file_sys branch from a4b79ad to 4e84b59 Compare June 21, 2022 16:57
@IamPete1
Copy link
Member Author

Compare to tridge@065159b

@IamPete1 IamPete1 force-pushed the defaults_file_sys branch from 4e84b59 to 89e5b69 Compare June 27, 2022 16:32
@IamPete1
Copy link
Member Author

Added support for packed defaults via the param ftp format. This still has @SYS/defaults.parm in plain text. We could remove that once we get GCS support, or never add it in the first place...

The is some additional work to make sure the defaults are set correctly. We need to check everywhere using the param set method and add a new set_and_default in some cases as in tridge@065159b. I don't think we need to do every case, sometimes it is useful to see where a value has been automatically set but is not the default.

@tridge
Copy link
Contributor

tridge commented Jun 27, 2022

ArduPilot/MAVProxy#1077

@IamPete1
Copy link
Member Author

IamPete1 commented Jul 2, 2022

Just tested with ArduPilot/MAVProxy#1077 seems to work as expected. mav.parm.defaults.txt I set also set the first three servo trims in defualts.parm and they show up.

@IamPete1 IamPete1 force-pushed the defaults_file_sys branch from 6570e3b to a6db42b Compare July 7, 2022 13:44
@IamPete1
Copy link
Member Author

IamPete1 commented Jul 7, 2022

@tridge I have implemented, I think, the protocol you suggested.

@IamPete1 IamPete1 force-pushed the defaults_file_sys branch from e051423 to 116a157 Compare July 19, 2022 03:13
@IamPete1
Copy link
Member Author

rebased to resolve conflict

@tridge
Copy link
Contributor

tridge commented Jul 20, 2022

great work!

@tridge tridge merged commit 66a5a28 into ArduPilot:master Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants