ConfigHWCompass: show calibration bad-fit reasons in mag cal dialog#3706
ConfigHWCompass: show calibration bad-fit reasons in mag cal dialog#3706christianpetri wants to merge 2 commits into
Conversation
|
Closing this in light of where ArduPilot PR #32757 ended up. The original approach here captured `Mag(N) bad ...` STATUSTEXT messages emitted from `fit_acceptable()`, but that GCS_SEND_TEXT approach was rejected during review due to flash cost (~448 bytes). The final version of #32757 emits no STATUSTEXT — it only sets new enum values (BAD_OFFSETS=8, BAD_DIAG=9, BAD_FITNESS=10) in `MAG_CAL_REPORT.cal_status`. That makes the STATUSTEXT subscription, regex, and dictionary added here dead code that will never fire. The right fix for issue #3709 is a much smaller change: add the three new values to the `MAG_CAL_STATUS` enum in `ExtLibs/Mavlink/Mavlink.cs`. The existing `(MAVLink.MAG_CAL_STATUS)obj.cal_status` cast in both compass forms will then display named labels automatically, with no extra subscription or logic needed. Will open a replacement PR once the upstream mavlink/mavlink XML is merged. |
Summary
Surface compass calibration failure reasons (
Mag(N) bad ...STATUSTEXT) directly inside the onboard mag calibration dialog, so users can see why a calibration was rejected without leaving the page.Pairs with the ArduPilot side that emits these diagnostics: ArduPilot/ardupilot#32757.
What changed
In both
ConfigHWCompass(legacy) andConfigHWCompass2:STATUSTEXTwhile calibration is running (in addition to the existingMAG_CAL_PROGRESSandMAG_CAL_REPORTsubscriptions).Mag\((\d+)\) badand store the latest message per compass ID in a thread-safeDictionary<string,string>.lbl_obmagresult.Environment.NewLineso newlines render correctly in the WinForms TextBox.falsefrom the new STATUSTEXT branch so non-compass STATUSTEXT continues to flow to other subscribers (HUD/messages remain unaffected).Why
Previously a failed compass calibration just looped silently with no indication of the cause. With ArduPilot now emitting specific
Mag(N) bad ...reasons (bad fit, bad radius, bad orientation, etc.), Mission Planner can show these inline so the user immediately knows what to fix.Tests
New
MissionPlannerTests/GCSViews/ConfigHWCompassTests.cs(MSTest):Result: 7/7 passing.
Manual verification (SITL)
COMPASS_CAL_FIT, extremeSIM_MAG*_OFS_*):Mag(N) bad ...lines appear in the dialog, replaced on each retry rather than accumulating.Notes