Add support for unsetting parameters (track default values again)
The general concept is to go through all of the same things we do when saving values, but instead of updating the value reset the key to a flag value. Once done searching for that parameter in storage will fail. The type is NOT changed so when scanning we know the size of the variable.
I'm quite aware this leaks storage. Future improvements would have us remember suitable empty slots for each type we might store and use them when storing. This is a major complication, IMO.
- need to add a sanity check so we never store under the key (we don't have one for the sentinel value!)
- valgrind
- check Vector3 still works appropriately
Message PR is here: https://github.com/ArduPilot/mavlink/pull/350
I've discovered this is an absolutely terrible idea.
If we remove from storage a value which is at its default value and there exists in storage a value from an old, unused storage key which has some conversion code then we may execute that conversion code again, leading to a non-default value.
We need to purge from storage old, unused keys from storage. Which is probably impossible as we don't know what scripts are going to do, and when.
It might be possible to do some sort of mark-and-sweep through the parameter storage to remove any value which is not currently in use by the code (after reaching some sort of steady-state eg. all scripts have loaded and have read in their values from storage).