AP_Vehicle: store currently running firmware version into a parameter#32071
AP_Vehicle: store currently running firmware version into a parameter#32071peterbarker wants to merge 1 commit intoArduPilot:masterfrom
Conversation
|
This seems like a good idea for the future. Do you think we should only increase it? I don't think we want to get into the game of forwards compatibility. But that might let us have a more global system for deciding to do a conversion, and let it be re-done for users who go back and forth between versions. Do note that the read-only metadata is not absolute, and it might cause big problems for users restoring old param lists. But maybe manually increasing it could be the bypass for users who don't want to reset their EEPROM. I'm wondering instead about not making it even visible, like the secret calibration parameters. |
save the currently running firmware version into a parameter. Into the future we may use this number to prevent a user from attempting to upgrade from a truly ancient version of the firmware to a more modern one where we may have removed parameter upgrade code.
1b6c612 to
730d041
Compare
I was imagining this would always be set - we wouldn't ratchet it to the most recent version. This would stop people going 4.1 -> 4.4 -> 4.1 -> 4.7 (numbers made up and assuming 4.1 to 4.4 is allowed but 4.1 to 4.7 is not)
Yep, good call, I've made the thing INTERNAL_USE_ONLY. |
|
I'd like to be able to access it from Lua code though. When trying to write version specific Lua that deals with parameter name changes, it would be great to be able to get the current version number. |
Does ardupilot/libraries/AP_Scripting/docs/docs.lua Lines 1878 to 1911 in 6870d06 |
Better to just look for the old parameter and then look for the new parameter, surely? i.e. test for what you're really trying to test for (i.e. the existence of a parameter). No reason to infer from a version number. |
Sure that's what I do now, but "better?" - nah, it's a workaround. |
This is perfect! Thanks Thomas! |
|
We could hide the param from the user altogether with |
It would be VERY useful to have the value as a parameter value in a parameter file! |
If this is the goal, then we should add vehicle type in there somewhere and a little decoder python script like the one for devids. |
|
Don't we have FORMAT_VERSION? |
Not the same thing; if We haven't reset one of those since I've been with the project. |
Ok. Good to know. How about tying the parameter to firmware version we tie it to "parameter set revision". Where following actions don't increment:
Increment:
I think this type of parameter should be able to have multiple instances. eg. to handle vendor specific logic or maybe manage subsystems so we can tell users which subsystem is affected. It also shouldn't be (fully) autoincremented after update without user acknowledgement eg. use the last bit to store user accepting the change. |
Maybe for v5.0.0 with String params! :) I can only hope LOL |
|
Personally, I don't think this extra parameter is worth it. Better to reallocate 4 bytes (int or 4 uint8's?) into the flash storage page and don't make it visible.. like the missions and DNA list |
|
Let's sneak it in here: downside of using the Bak is it's only for larger chips and downside of touching note: once we boot with an old-to-new param value and we do whatever param migrations that are needed then we replace that param with the current version, which is the new default, which then will consume zero storage space I dunno.. adding a param here just feels like it goes against the don't-add-a-param-unless-you-reaaaaally-need-to methos which we have in place for good reasons. |
save the currently running firmware version into a parameter. Into the future we may use this number to prevent a user from attempting to upgrade from a truly ancient version of the firmware to a more modern one where we may have removed parameter upgrade code.
Tested in SITL: