Skip to content

Merge release/9.1 into maintenance-10.x#11681

Merged
sensei-hacker merged 18 commits into
iNavFlight:maintenance-10.xfrom
sensei-hacker:merge-release-9.1-into-maintenance-10.x
Jul 2, 2026
Merged

Merge release/9.1 into maintenance-10.x#11681
sensei-hacker merged 18 commits into
iNavFlight:maintenance-10.xfrom
sensei-hacker:merge-release-9.1-into-maintenance-10.x

Conversation

@sensei-hacker

@sensei-hacker sensei-hacker commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

Forward ports the 15 commits currently on release/9.1 that aren't yet on maintenance-10.x: SITL-Mac VLA/STATIC_ASSERT build fixes, ICM42686P support, TBS_LUCID_H7_OEM and TBS_LUCID_H7_V3 targets, GCC 16 warning fixes, and two fixed-wing nav fixes (WP JUMP target skip, cross-track state reset on re-engagement).

release/9.1 itself is untouched — this only advances maintenance-10.x.

Changes

  • Merge commit resolving two conflicts:
    • lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_usb.c: maintenance-10.x's existing HAL driver rewrite already superseded release/9.1's debug-instrumentation removal; kept the maintenance-10.x version.
    • src/main/navigation/navigation_fixedwing.c: combined maintenance-10.x's filter-state refactor (hoisted fwCrossTrackErrorRateFilterState to file scope, pt1FilterSetCutoff/pt1FilterApply3) with release/9.1's fix (resync cross-track state when tracking disengages, to avoid a stale-data kick on re-engagement). Also caught and fixed a git auto-merge artifact that would have re-declared fwCrossTrackErrorRateFilterState as a shadowing local static.
  • Separate follow-up commit: fixed unresolved merge-conflict markers left in docs/ADSB.md by a previous merge (PR Merge/9.1 into 10.x #11626, 2026-06-06) that duplicated the "Alert and Warning" section — found while auditing this merge for silently-dropped content.

Testing

  • Built SITL and KAKUTEF7 (STM32F7) — both clean, zero warnings under -Werror.
  • Built the two new targets, TBS_LUCID_H7_OEM and TBS_LUCID_H7_V3 — both clean.
  • Diffed every file touched by both branches since their merge-base against both maintenance-10.x and release/9.1 to confirm no feature or fix was silently dropped by the merge.

sensei-hacker and others added 17 commits June 7, 2026 00:56
…roxh7-v2

AEDROXH7: fix LED strip DMA conflict with motor outputs
The fixed-wing waypoint cross-track controller (nav_fw_wp_tracking_accuracy) kept
its rate/error state in function-local statics that were never reset. After a turn
or loiter, where the controller is disengaged (needToCalculateCircularLoiter), the
first sample on the next leg was computed from stale data from the previous leg,
causing a small heading twitch when rejoining the course line.

Re-seed the controller state to the current cross-track error while it is not
actively steering, so it re-engages cleanly on the next leg.
When a WP mission JUMP activated its target waypoint, isWaypointReached() could read a wpTurnSmoothingActive flag left over from the previous waypoint. The JUMP defers target setup by one navigation loop, and in that gap the FW position controller re-arms the flag from the previous waypoint's geometry. With nav_fw_wp_turn_smoothing = CUT this marks the jump target as reached on its first loop (and cascades the following WP via the bearing-miss check), so the mission jumps to target+1 instead of the target.

Reset wpTurnSmoothingActive when a new active waypoint is set so a freshly activated waypoint cannot inherit the previous waypoint's smoothing-reached state. Turn smoothing is otherwise unchanged: the FW controller recomputes the flag every position update from the new waypoint geometry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tate-reset

Fixed wing nav: reset WP cross-track tracking state on re-engagement
FW nav: fix WP JUMP target skipped by stale turn-smoothing flag
Removed a link to a specific OLED display from the documentation.
Resolves iNavFlight#11660
…ase-link

Remove outdated OLED display link from Display.md
_logBufferHex() sized a stack buffer using two `const size_t` locals
(charsPerByte, maxBytes). In C, const-qualified objects are not integer
constant expressions, so the array size expression was technically a
variable-length array; recent AppleClang treats reliance on its
extension that folds such expressions back to a constant as an error
under -Werror -Wgnu-folding-constant, breaking build-SITL-Mac.

Replace the const locals with a local enum, whose members are genuine
integer constant expressions in C. The buffer size and behavior are
unchanged (13 + 5*8 + 1 = 54 bytes either way).
STATIC_ASSERT expands to a typedef of a char array sized by the
condition, a common compile-time-assertion trick. This call site's
condition compared GPS_DEGREES_DIVIDER (already 10000000L) against the
floating-point literal 1e7. Per C11 6.6p6, integer constant expressions
may not contain floating constants, so despite being trivially
foldable, AppleClang's -Wgnu-folding-constant -Werror rejects it.

Replace 1e7 with 10000000L to match GPS_DEGREES_DIVIDER's own literal
form, making the condition a pure integer constant expression. No
change to the assertion's truth value or any runtime behavior.
…la-error-9.1

Fix build-SITL-Mac VLA-folding-constant error in log.c (9.1 backport)
# Conflicts:
#	lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_usb.c
#	src/main/navigation/navigation_fixedwing.c
PR iNavFlight#11626 (merged 2026-06-06) committed literal <<<<<<</=======/>>>>>>>
conflict markers, duplicating the entire "Alert and Warning" section.
Deduplicate and remove the markers.
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Backport release/9.1 fixes and targets into maintenance-10.x

🐞 Bug fix ✨ Enhancement 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Backport release/9.1 navigation fixes for WP JUMP and FW cross-track re-engagement.
• Add IMU/target support updates (ICM42686P detect/config, new TBS_LUCID_H7_* targets).
• Resolve build/doc regressions (GCC16 warnings, VLA/STATIC_ASSERT, leftover merge markers).
Diagram

graph TD
  A["maintenance-10.x backport"] --> B["Nav core"] --> C["FW nav ctrl"]
  A --> D["IMU drivers"] --> E["H7 targets"]
  A --> F["Build fixes"]
  A --> G["Docs"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Cherry-pick the 15 commits instead of merging
  • ➕ Avoids bringing over unrelated conflict history
  • ➕ Lets maintainers reorder/split changes by subsystem for easier review
  • ➖ Higher risk of missing hunks or subtly diverging conflict resolutions
  • ➖ More manual effort to keep parity with release branch
2. Split into focused PRs (nav vs targets vs toolchain vs docs)
  • ➕ Smaller, faster reviews per area
  • ➕ Easier to revert/forward-port a single subsystem if needed
  • ➖ More coordination overhead
  • ➖ Harder to guarantee exact equivalence with release/9.1 backport set

Recommendation: A direct merge/backport is appropriate here because it preserves the release/9.1 history and reduces the chance of silently dropping fixes; given the breadth (nav + targets + toolchain), keep the merge as-is but ensure CI/build coverage on representative F7/H7 targets and spot-check the fixed-wing controller paths affected by the state reseeding.

Files changed (27) +662 / -78

Enhancement (14) +630 / -15
accgyro_icm42605.cAdd ICM42686P variant detection and configuration handling +40/-13

Add ICM42686P variant detection and configuration handling

• Introduces an explicit variant enum for ICM42605/42686P/42688P, detects 42686P via WHO_AM_I, and adjusts FS selection accordingly. Updates AAF config selection and logging to be variant-aware.

src/main/drivers/accgyro/accgyro_icm42605.c

accgyro_mpu.hAdd WHO_AM_I constant for ICM42686P +1/-0

Add WHO_AM_I constant for ICM42686P

• Defines ICM42686P_WHO_AM_I_CONST to support runtime identification in the ICM426xx driver.

src/main/drivers/accgyro/accgyro_mpu.h

target.cRegister ICM45686 as an additional supported gyro option +2/-0

Register ICM45686 as an additional supported gyro option

• Adds bus device descriptors for DEVHW_ICM45686 alongside existing MPU6000 and ICM42605 entries for both IMUs.

src/main/target/TBS_LUCID_H7/target.c

target.hEnable ICM45686 IMU support for TBS_LUCID_H7 +2/-1

Enable ICM45686 IMU support for TBS_LUCID_H7

• Defines USE_IMU_ICM45686 so the target can build and expose ICM45686 support.

src/main/target/TBS_LUCID_H7/target.h

config.cAdd OEM targetConfiguration() defaults (PINIO + beeper PWM) +42/-0

Add OEM targetConfiguration() defaults (PINIO + beeper PWM)

• Defines target-specific defaults mapping user box IDs to PINIO and enabling PWM beeper mode.

src/main/target/TBS_LUCID_H7_OEM/config.c

target.cAdd OEM target timer map and IMU bus descriptors +64/-0

Add OEM target timer map and IMU bus descriptors

• Introduces timerHardware mappings and registers SPI IMU devices (MPU6000/ICM42605/ICM45686) with EXTI pins for both gyros.

src/main/target/TBS_LUCID_H7_OEM/target.c

target.hAdd OEM target header (pins, buses, features) +183/-0

Add OEM target header (pins, buses, features)

• Defines board identifier/product string, IO pinout (UART/SPI/I2C/CAN/ADC), default features, and dual-gyro configuration including ICM45686 enablement.

src/main/target/TBS_LUCID_H7_OEM/target.h

config.cAdd V3 targetConfiguration() defaults (PINIO + beeper PWM) +42/-0

Add V3 targetConfiguration() defaults (PINIO + beeper PWM)

• Defines target-specific defaults mapping user box IDs to PINIO and enabling PWM beeper mode.

src/main/target/TBS_LUCID_H7_V3/config.c

target.cAdd V3 target timer map and IMU bus descriptors +64/-0

Add V3 target timer map and IMU bus descriptors

• Introduces timerHardware mappings and registers SPI IMU devices (MPU6000/ICM42605/ICM45686) with EXTI pins for both gyros.

src/main/target/TBS_LUCID_H7_V3/target.c

target.hAdd V3 target header (pins, buses, features) +183/-0

Add V3 target header (pins, buses, features)

• Defines board identifier/product string, IO pinout (UART/SPI/I2C/CAN/ADC), default features, and dual-gyro configuration including ICM45686 enablement.

src/main/target/TBS_LUCID_H7_V3/target.h

target.cRegister ICM45686 as an additional supported gyro option +2/-0

Register ICM45686 as an additional supported gyro option

• Adds bus device descriptors for DEVHW_ICM45686 alongside existing MPU6000 and ICM42605 entries for both IMUs.

src/main/target/TBS_LUCID_H7_WING/target.c

target.hEnable ICM45686 IMU support for TBS_LUCID_H7_WING +1/-0

Enable ICM45686 IMU support for TBS_LUCID_H7_WING

• Defines USE_IMU_ICM45686 so the target can build and expose ICM45686 support.

src/main/target/TBS_LUCID_H7_WING/target.h

target.cRegister ICM45686 as an additional supported gyro option +2/-0

Register ICM45686 as an additional supported gyro option

• Adds bus device descriptors for DEVHW_ICM45686 alongside existing MPU6000 and ICM42605 entries for both IMUs.

src/main/target/TBS_LUCID_H7_WING_MINI/target.c

target.hEnable ICM45686 IMU support and fix missing newline +2/-1

Enable ICM45686 IMU support and fix missing newline

• Defines USE_IMU_ICM45686 and normalizes end-of-file newline to satisfy tooling/format expectations.

src/main/target/TBS_LUCID_H7_WING_MINI/target.h

Bug fix (5) +24 / -8
log.cFix GCC VLA warning by making buffer sizing compile-time constant +6/-2

Fix GCC VLA warning by making buffer sizing compile-time constant

• Replaces function-local const size_t values with an enum so the log buffer size is a constant expression. Prevents compilers from treating the stack buffer as a VLA under stricter toolchains.

src/main/common/log.c

osd.cMake GPS divider STATIC_ASSERT toolchain-safe +1/-1

Make GPS divider STATIC_ASSERT toolchain-safe

• Changes the STATIC_ASSERT comparison from 1e7 to an integer literal (10000000L) to avoid floating/constant-expression issues with some compilers.

src/main/io/osd.c

serial_4way_avrootloader.cAvoid string initializer warnings in fixed-size uint8_t array +1/-1

Avoid string initializer warnings in fixed-size uint8_t array

• Replaces a string literal initializer with an explicit character list for BootMsg to avoid toolchain warnings and ensure exact sizing.

src/main/io/serial_4way_avrootloader.c

navigation.cReset turn-smoothing flag when activating a waypoint +1/-0

Reset turn-smoothing flag when activating a waypoint

• Clears wpTurnSmoothingActive on waypoint activation so newly activated waypoints (including JUMP targets) cannot inherit prior smoothing state.

src/main/navigation/navigation.c

navigation_fixedwing.cReseed FW cross-track controller state when tracking is disengaged +15/-4

Reseed FW cross-track controller state when tracking is disengaged

• Moves cross-track statics to a wider scope and, when tracking accuracy steering is inactive, reseeds previous error/time and resets filter state. Prevents stale-state kicks when re-engaging waypoint tracking after loiter/turn phases.

src/main/navigation/navigation_fixedwing.c

Refactor (4) +6 / -12
fport.cRemove unused frame error counter to silence warnings +0/-2

Remove unused frame error counter to silence warnings

• Drops an unused volatile static counter in reportFrameError(), leaving the hook as a no-op while still consuming the parameter.

src/main/rx/fport.c

xplane.cWhitespace cleanup in SITL X-Plane integration +4/-4

Whitespace cleanup in SITL X-Plane integration

• Removes trailing whitespace and normalizes formatting in a few call sites for cleaner builds/linting.

src/main/target/SITL/sim/xplane.c

hott.cRemove unused debug counter and fix preprocessor whitespace +1/-3

Remove unused debug counter and fix preprocessor whitespace

• Drops an unused static counter in hottSerialWrite() and normalizes an #else line to avoid warning/noise under stricter builds.

src/main/telemetry/hott.c

jetiexbus.cRemove unused debug frame-loss counter and minor formatting cleanup +1/-3

Remove unused debug frame-loss counter and minor formatting cleanup

• Eliminates an unused framesLost counter and related increment to avoid warnings; also normalizes whitespace in a switch case.

src/main/telemetry/jetiexbus.c

Documentation (2) +0 / -43
ADSB.mdRemove leftover merge markers and duplicated ADS-B alert section +0/-42

Remove leftover merge markers and duplicated ADS-B alert section

• Eliminates unresolved conflict markers and removes a duplicated ADS-B alert/warning block. Restores the document to a single coherent Alert and Warning section.

docs/ADSB.md

Display.mdRemove stale display vendor link +0/-1

Remove stale display vendor link

• Drops an outdated multiwiicopter.com display link from the displays list.

docs/Display.md

Other (2) +2 / -0
CMakeLists.txtAdd build definition for new TBS_LUCID_H7_OEM target +1/-0

Add build definition for new TBS_LUCID_H7_OEM target

• Registers the new STM32H743XI-based target with the build system.

src/main/target/TBS_LUCID_H7_OEM/CMakeLists.txt

CMakeLists.txtAdd build definition for new TBS_LUCID_H7_V3 target +1/-0

Add build definition for new TBS_LUCID_H7_V3 target

• Registers the new STM32H743XI-based target with the build system.

src/main/target/TBS_LUCID_H7_V3/CMakeLists.txt

@qodo-code-review

qodo-code-review Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. AAF freq overflow ✓ Resolved 🐞 Bug ≡ Correctness
Description
In getGyroAafConfig(), selectedFreq is stored as int8_t but the AAF lookup table contains
frequencies like 258 and 303, so selectedFreq overflows and can corrupt the “closest frequency”
comparison, selecting the wrong AAF parameters for ICM42688P/ICM42686P.
Code

src/main/drivers/accgyro/accgyro_icm42605.c[433]

        }
Evidence
The LUT used for ICM42688P/42686P includes frequencies (e.g. 258, 303) that do not fit into int8_t,
while getGyroAafConfig stores the selected frequency in an int8_t and uses it in the ABS()
comparison that determines the chosen candidate.

src/main/drivers/accgyro/accgyro_icm42605.c[121-135]
src/main/drivers/accgyro/accgyro_icm42605.c[415-443]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`getGyroAafConfig()` uses `int8_t selectedFreq` to hold LUT frequencies. For the 42688/42686 path the LUT includes values >127 (e.g. 258, 303), which overflow `int8_t` and can cause the function to pick the wrong AAF candidate.

### Issue Context
This function selects the closest supported AAF cutoff frequency by comparing `ABS(desiredFreq - aafConfigs[i].freq)` against `ABS(desiredFreq - selectedFreq)`. If `selectedFreq` wraps, the comparison becomes invalid.

### Fix
- Change `selectedFreq` to a wide signed type (e.g. `int32_t` or `uint16_t`, but prefer `int32_t` for safe signed subtraction).
- Ensure the subtraction is performed in a sufficiently wide signed type, e.g.:
 - `const int32_t desired = desiredFreq;`
 - compare `ABS(desired - (int32_t)aafConfigs[i].freq)`

### Fix Focus Areas
- src/main/drivers/accgyro/accgyro_icm42605.c[415-443]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread src/main/drivers/accgyro/accgyro_icm42605.c
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Test firmware build ready — commit 9fd17c0

Download firmware for PR #11681

240 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

selectedFreq in getGyroAafConfig() was declared int8_t (max 127), but
aafLUT42688[] contains freq values up to 1962. Values above 127 silently
truncated on assignment, corrupting the closest-frequency comparison and
causing the wrong AAF register configuration to be selected. This affected
every board using this gyro at the default 256Hz LPF setting (selected
303Hz instead of the correct 258Hz cutoff). Changed to uint16_t to match
aafConfig_t.freq's own type.
@sensei-hacker sensei-hacker merged commit d90cd26 into iNavFlight:maintenance-10.x Jul 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants