Fix decoder bugs and add unit tests#42
Open
junzis wants to merge 2 commits intoopenskynetwork:masterfrom
Open
Conversation
Bug fixes (cross-validated against pyModeS, lib1090, dump1090): - Fix heading integer division in AirspeedHeadingMsg (360/1024 -> 360.0/1024.0) - Fix vertical rate availability check in VelocityOverGroundMsg and AirspeedHeadingMsg (check raw==0 before shift, old check was never true after <<6) - Fix geo-minus-baro availability check in AirspeedHeadingMsg (check raw==0 before multiply, old check produced -25 instead of unavailable) - Fix byte sign extension in AirborneOperationalStatusV1Msg capability/operational codes (mask with &0xFF before shift to prevent sign extension when byte >= 0x80) - Fix byte sign extension in EmergencyOrPriorityStatusMsg squawk decoding (msg[2]&0xFF, was producing squawk 7573 instead of correct 6513) - Fix NL function boundary in CPR decode for airborne and surface positions (clamp acos argument to [-1,1] to prevent NaN at high latitudes) - Fix PositionDecoder nulling last_pos on failed decode, breaking subsequent local decodes - Fix AirborneOperationalStatusV1Msg control flow: check subtype before parsing capability codes to avoid airborne parsing on surface messages Tests added: 113 tests across 11 test classes covering all message types.
- TCASResolutionAdvisoryMsg: fix msg[4] used instead of msg[3] for threat_identity high bits, add &0xFF masks on all shifted bytes - SurfaceOperationalStatusV1Msg: add &0xFF masks to prevent sign extension, reorder subtype check before field parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug fixes (cross-validated against pyModeS, lib1090, dump1090):
Tests added: 113 tests across 11 test classes covering all message types.