DFReader: Fix some missing bitmask info in dump verbose #947
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.
Following #937, I noticed a few things with bitmask displays that wasn't quite behaving, which this PR aims to fix:
1/ The bits of ArmChecks are not being displayed when doing
dump --verbose ARM
This was because these bits have no description, and the
except KeyError
does not catch this.Fixed by using if
hasattr(bit, 'description')
instead.2/ The last bit was always missing (e.g. CHANGED bit on POWR.Flags)
This was because
for i in range(bit_offset)
needs a+1
.Actually I realised this should rather be using
highest_bit+1
in case more bits are set than defined.3/ If any bit is missing a definition from the XML, then this and subsequent bit are not shown
This was because
bang
variable was being used undefined in this case.Fixed by defining
bang
earlier, so it is available in either case.I have also aligned the "!" to be spaced out consistently with how TLOGs and MavProxy show these things.
Tested with a number of examples:
ARM now showing bits:
POWR now showing last bit:
And by removing the bits except USING_SIGNING from the MAV definition in my local .pymavlink/LogMessages/Plane.xml file: