ConfigHWCompass: surface MAG_CAL_BAD_OFFSETS/BAD_DIAG_SCALING/BAD_FITNESS failure codes#3722
Draft
christianpetri wants to merge 4 commits into
Draft
ConfigHWCompass: surface MAG_CAL_BAD_OFFSETS/BAD_DIAG_SCALING/BAD_FITNESS failure codes#3722christianpetri wants to merge 4 commits into
christianpetri wants to merge 4 commits into
Conversation
…l dialogs ArduPilot/ardupilot#32757 adds three new MAG_CAL_STATUS values sent in MAG_CAL_REPORT.cal_status when calibration fit is rejected: 8 = BAD_OFFSETS - offset component >= COMPASS_OFFS_MAX 9 = BAD_DIAG - diagonal/off-diagonal scaling out of range 10 = BAD_FITNESS - RMS residual exceeds tolerance Previously these fell through silently, leaving the cal dialog stuck. Changes: - Use calStatus > MAG_CAL_SUCCESS guard (future-proof for any further codes) - Track failure status per compass in lastFailureStatus dictionary - Show failure code in result label; set progress/picture to red on failure - Add unit tests covering the guard logic and wire values Note: Mavlink.cs is NOT changed - it is auto-generated. Named enum members MAG_CAL_BAD_OFFSETS/DIAG/FITNESS arrive when mavlink/mavlink#2478 merges and Mavlink.cs is regenerated. Tests use raw byte casts until then.
3 tasks
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.
Summary
Companion GCS change for ArduPilot/ardupilot#32757, which extends \CompassCalibrator::Status\ with three specific failure reasons reported via \MAG_CAL_REPORT.cal_status\ when the calibration fit is rejected:
Previously these values fell through silently, leaving the calibration dialog stuck in a running state with no feedback to the user.
Changes
Both dialogs now:
Notes on \Mavlink.cs\
\ExtLibs/Mavlink/Mavlink.cs\ is not changed — it is auto-generated from upstream mavlink XML. The named enum members will appear automatically when mavlink/mavlink#2478 merges and the file is regenerated.
Until then, raw values \8/\9/\10\ are received from firmware and handled correctly by the > MAG_CAL_SUCCESS\ guard. The result label shows e.g. \Mag 0: 8\ until the regen, after which it will show \Mag 0: MAG_CAL_BAD_FITNESS.
Tests
Tests in \MissionPlannerTests/GCSViews/MagCalStatusTests.cs\ cover:
A follow-up to switch from raw casts to named members is tracked in mavlink/mavlink#2478.
Depends on