Merge release/9.1 into maintenance-10.x (resolves #11759 conflict) - #11761
Conversation
inavflight/inav to kijan007/innav master update
merge master
Added targetr for ATOMRC F405 NAVI MINI with blackbox flash storage
feat(msp): add MSP2_INAV_WIND (0x2231) to expose wind estimator
# Conflicts: # docs/development/msp/msp_messages.json
PR Summary by QodoMerge release/9.1 into maintenance-10.x: add MSP2 wind message + ATOMRCF405MINI target
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Stale wind when invalid
|
| uint16_t windSpeed = (uint16_t)getEstimatedHorizontalWindSpeed(&windAngle); | ||
| uint8_t windFlags = isEstimatedWindSpeedValid() ? 1 : 0; | ||
| sbufWriteU16(dst, windSpeed); | ||
| sbufWriteU16(dst, windAngle / 100); |
There was a problem hiding this comment.
1. Stale wind when invalid 🐞 Bug ≡ Correctness
MSP2_INAV_WIND serializes windSpeed/windAngle even when isEstimatedWindSpeedValid() is false, so consumers can receive stale non-zero wind after the estimator is invalidated (timeout clears validity but does not reset estimatedWind). This contradicts the message documentation that states the command returns zeroes when not yet valid/unavailable.
Agent Prompt
## Issue description
`MSP2_INAV_WIND` currently writes wind speed/angle regardless of estimator validity and only sets a flag. Because the wind estimator can become invalid without clearing the cached `estimatedWind` values, MSP clients may receive stale wind data even though `flags` indicates invalid, which also contradicts the documented MSP message contract (“returns zeroes … when … not yet valid”).
## Issue Context
- `isEstimatedWindSpeedValid()` reflects validity, but `getEstimatedHorizontalWindSpeed()` always returns a magnitude computed from cached `estimatedWind`.
- `hasValidWindEstimate` can be cleared on timeout without resetting `estimatedWind`.
## Fix Focus Areas
- src/main/fc/fc_msp.c[1684-1699]
- (optional doc alignment if you choose not to change behavior) docs/development/msp/msp_messages.json[11409-11427]
## Suggested change
Inside the `MSP2_INAV_WIND` case, compute `valid = isEstimatedWindSpeedValid()` first.
- If `valid`: compute `windSpeed`/`windAngle` and serialize them, set `flags=1`.
- Else: serialize `0,0,0` (or `0,0,flags=0`), avoiding stale values.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
docs/Settings.md was stale on maintenance-10.x since commit 053c397 ("Split MAVLink telemetry into modules with multi-port runtime"), which changed settings.yaml's MAVLink settings (single-port names -> mavlink_port1_*/mavlink_port2_* dual-port names) without regenerating the docs. Pre-existing on maintenance-10.x, unrelated to this merge, but blocks this PR's CI check. Fixed by running update_cli_docs.py.
|
Test firmware build ready — commit Download firmware for PR #11761 244 targets built. Find your board's
|
getEstimatedHorizontalWindSpeed() was called unconditionally, so once
the wind estimate becomes invalid (e.g. the 15-minute stationary-altitude
timeout in wind_estimator.c), MSP2_INAV_WIND kept sending the last
computed windSpeed/windAngle instead of zero. estimatedWind[] is never
reset when hasValidWindEstimate clears, only the flags byte reflected
validity. This contradicted the message's own documentation ("returns
zeroes when wind estimation is not compiled in or not yet valid") and
diverged from every other consumer of this API (gps.c, osd.c,
rth_estimator.c, navigation.c, imu.c, mavlink_streams.c,
logic_condition.c, pitotmeter.c), all of which check
isEstimatedWindSpeedValid() before reading the value rather than relying
on the estimator to self-zero.
Reported by Qodo's automated review on PR #11761 (a release/9.1 ->
maintenance-10.x merge that carried this pre-existing bug forward,
unrelated to that merge itself). Fixed at the source (release/9.1) so it
flows forward on the next maintenance-10.x sync.
Summary
PR #11759 (
release/9.1→maintenance-10.x) had a merge conflict and can't be resolved via GitHub's web UI — doing so would merge all ofmaintenance-10.xinto the sharedrelease/9.1branch, contaminating the older release branch with months of newer development (seemerge-release-into-next-version.mdin the project's internal dev guides).This PR instead follows the safe procedure: branch off
maintenance-10.x, mergerelease/9.1into it, resolve conflicts there.release/9.1is untouched.Conflict resolution
One file conflicted:
docs/development/msp/msp_messages.json. The apparent conflict was almost entirelymaintenance-10.x's independent reformatting/regeneration of the file (11k+ line diff) colliding textually withrelease/9.1's single clean addition (theMSP2_INAV_WINDmessage entry, 29 lines, zero deletions). Resolved by takingmaintenance-10.x's version of the file as-is and inserting only the newMSP2_INAV_WINDentry at the same relative position (immediately afterMSP2_INAV_SET_AUX_RC), matchingmaintenance-10.x's indentation. Verified: valid JSON, and a diff againstmaintenance-10.xshows only the 29-line addition with zero unexpected removals.src/main/fc/fc_msp.candsrc/main/msp/msp_protocol_v2_inav.hauto-merged cleanly (clean additions on therelease/9.1side, no overlapping changes onmaintenance-10.x). The newATOMRCF405MINItarget files (target.c,target.h,CMakeLists.txt) added byrelease/9.1are carried through unchanged — verified byte-identical to the PR's version.Testing
docs/development/msp/msp_messages.jsonvalidated as well-formed JSON after resolution.maintenance-10.x— confirmed no base-branch content was dropped (no unexpected-lines beyond the intended insertion point).ATOMRCF405MINItarget files againstrelease/9.1's versions — byte-identical.Once merged, GitHub will auto-close #11759 since all of
release/9.1's commits become reachable frommaintenance-10.x.https://claude.ai/code/session_073a8e72-596e-49b0-8684-e90575ae33fe