Fix (dis)arm reason enumeration #25766
Open
+40
−68
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.
Solved Problem
When analysing logs I found that the (dis)arm reason is reported wrong according to the message definition because the logged uORB message
vehicle_status
specifically theARM_DISARM_REASON_...
enum values are not in sync with the events enum defined in the json and autogenerated into thearm_disarm_reason_t
type.Solution
static_assert
s for each enum value with the same name of both the uORB and event value. This does not force a new reason to be added to both places but at least checks the existing ones and gives a hint that the two have to match when people do a full text search.arm()
ordisarm()
and some of them are deprecated but were never removed:transition_to_standby
arming state machine leftoverfailure_detector
was used for failure detection actions before Commander failsafe state machine rewrite #20172 and are now handled as failsafe actionsshutdown
arming state machine leftoverunit_test
arming state machine unit testing leftoverlockdown
I made an extra commit because it's more complicated since it's still used but not really a usefully reachable code path since Commander failsafe state machine rewrite #20172 Please read the commit description for more details.lockdown
see last point of 2. and the in depth commit message.Changelog Entry
Test coverage
The static asserts are now passing (which they weren't after the first commit). The naming was consistently replaced. I didn't plan any additional testing. Please review.
Context
Related links, screenshot before/after, video