Skip to content

Fix mistyped target macros that silently disable features - #11955

Open
sensei-hacker wants to merge 2 commits into
iNavFlight:release/9.1from
sensei-hacker:fix-macro-typos-target-sweep
Open

sensei-hacker wants to merge 2 commits into
iNavFlight:release/9.1from
sensei-hacker:fix-macro-typos-target-sweep

Conversation

@sensei-hacker

@sensei-hacker sensei-hacker commented Sep 15, 2026

Copy link
Copy Markdown
Member

Summary

Fixes mistyped/dead #defines in 7 target headers that silently disabled
features, found by check_macro_typos.py and verified against driver/core
usage (not the tool's heuristic alone).

Changes

  • IFLIGHT_H743_AIO_V2, JHEH7AIO: BEEPER_PINBEEPER. The beeper
    driver (sound_beeper.c) gates on #ifdef BEEPER, so the beeper was
    silently compiled out and the pin left floating.
  • RADIOLINKF405: USE_SERIAL_3WAY_BLHELI_INTERFACE
    USE_SERIAL_4WAY_BLHELI_INTERFACE. Core only tests the 4WAY name, so
    4-way BLHeli passthrough was compiled out.
  • BETAFPVF435: ADC_CHANNEL1/2/3_PINADC_CHANNEL_1/2/3_PIN. The
    missing underscore made adcInit (drivers/adc.c) run
    disableChannelMapping() for those channels, so VBAT/current/RSSI ADC
    was dead. Also removed a duplicate INVERTER_PIN_USART3_RX.
  • AIKONF7, BETAFPVF435, BROTHERHOBBYF405V3, PRINCIPIOTF7: removed dead
    USE_FLASH_W25M* / W25M* / W25M512* / W25M02G* cruft — that flash
    family was never implemented in any driver; all four targets still define
    the real USE_FLASH_W25N01G (+ pin/bus), which flash_w25n.c consumes.
  • src/utils/bf2inav.py: removed the W25M/W25M02G/W25M512 entries
    from the converter's supported-flash-chips list so future Betaflight→INAV
    conversions don't regenerate the dead macros.

Testing

Build-tested every touched target (via inav-builder) against release/9.1
all 7 succeeded with no errors and no warnings:

Target Result
IFLIGHT_H743_AIO_V2
JHEH7AIO
RADIOLINKF405
BETAFPVF435
AIKONF7
BROTHERHOBBYF405V3
PRINCIPIOTF7

Not hardware-tested (config-only #define fixes; each rename was verified
against the consuming driver and each pin against its target's pin map).

Code Review

Reviewed with the inav-code-review agent — APPROVE (no critical/important
issues). The one minor follow-up it noted (the converter's dead W25M
entries) is addressed in this PR.

Left alone (verified NOT bugs)

  • PIXRACER ICM20608_CS_PIN/ICM20608_SPI_BUS — locally-consistent label,
    board uses DEVHW_MPU6500 (ICM20608G WHO_AM_I); renaming would be cosmetic.
  • HAKRCF722V2 SPI1_NSS1_PIN/SPI1_NSS2_PIN — intentional dual-gyro CS
    variants, consumed locally by GYRO1_CS_PIN/GYRO2_CS_PIN.
  • KAKUTEH7WING VBAT_SCALE_DEFAULT2 — single harmless dead define.

check_macro_typos.py flagged target.h defines that resemble typos of real
INAV macros. Verified each against driver/core usage and fixed the
confirmed cases:

- IFLIGHT_H743_AIO_V2, JHEH7AIO: BEEPER_PIN -> BEEPER. The beeper driver
  gates on #ifdef BEEPER, so the beeper was silently compiled out.
- RADIOLINKF405: USE_SERIAL_3WAY_BLHELI_INTERFACE ->
  USE_SERIAL_4WAY_BLHELI_INTERFACE. The 4-way BLHeli passthrough was
  compiled out (no 3WAY macro exists in core).
- BETAFPVF435: ADC_CHANNEL1/2/3_PIN -> ADC_CHANNEL_1/2/3_PIN. adcInit
  disables channels whose *_PIN macro is missing, so VBAT/current/RSSI
  ADC was dead. Also dropped a duplicate INVERTER_PIN_USART3_RX.
- AIKONF7, BETAFPVF435, BROTHERHOBBYF405V3, PRINCIPIOTF7: removed the
  never-implemented USE_FLASH_W25M* / W25M* cruft (all four still define
  the real USE_FLASH_W25N01G).
@sensei-hacker sensei-hacker added this to the 9.1 milestone Sep 15, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix target macro typos that silently disable features

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Correct beeper, ADC, and BLHeli macros to restore silently disabled target features.
• Remove unsupported W25M declarations while retaining implemented W25N01G flash configurations.
• Preserve target pin mappings and verify all seven affected firmware builds.
Diagram

graph TD
  T["Target headers"] --> B["Beeper driver"] & A["ADC mapping"] & S["BLHeli passthrough"] & F["W25N flash"]
Loading
High-Level Assessment

Directly correcting macros at their target definitions is the lowest-risk approach because it restores the names already consumed by core drivers without introducing compatibility aliases or changing shared code. Removing unsupported W25M declarations also avoids preserving misleading configuration for an unimplemented driver family.

Files changed (7) +6 / -43

Bug fix (4) +6 / -16
target.hRestore ADC mappings and remove dead declarations +3/-13

Restore ADC mappings and remove dead declarations

• Renames all three ADC pin macros to the format consumed by the ADC driver, restoring VBAT, current, and RSSI channel mappings. Also removes unsupported W25M flash declarations and a duplicate USART3 inverter macro.

src/main/target/BETAFPVF435/target.h

target.hEnable the configured beeper pin +1/-1

Enable the configured beeper pin

• Renames BEEPER_PIN to BEEPER so the beeper driver recognizes PD2 and includes beeper support for this target.

src/main/target/IFLIGHT_H743_AIO_V2/target.h

target.hEnable the configured beeper pin +1/-1

Enable the configured beeper pin

• Renames BEEPER_PIN to BEEPER so the beeper driver recognizes PD15 and includes beeper support for this target.

src/main/target/JHEH7AIO/target.h

target.hRestore BLHeli 4-way passthrough support +1/-1

Restore BLHeli 4-way passthrough support

• Replaces the nonexistent serial 3-way BLHeli feature macro with the core-recognized 4-way interface macro, restoring ESC passthrough compilation.

src/main/target/RADIOLINKF405/target.h

Other (3) +0 / -27
target.hRemove unsupported W25M flash declarations +0/-9

Remove unsupported W25M flash declarations

• Removes dead W25M, W25M02G, and W25M512 feature, bus, and chip-select macros. The implemented W25N01G and M25P16 flash configurations remain unchanged.

src/main/target/AIKONF7/target.h

target.hRemove unsupported W25M flash declarations +0/-9

Remove unsupported W25M flash declarations

• Deletes unused W25M-family feature and pin macros while retaining the implemented M25P16 and W25N01G flash configurations on SPI3.

src/main/target/BROTHERHOBBYF405V3/target.h

target.hRemove unsupported W25M flash declarations +0/-9

Remove unsupported W25M flash declarations

• Deletes dead W25M, W25M02G, and W25M512 configuration while preserving the supported M25P16 and W25N01G flash definitions on SPI2.

src/main/target/PRINCIPIOTF7/target.h

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

RAM / Flash usage vs. base commit 13485eb — commit aa7fdea

Target Flash Δ RAM Δ
MATEKF405 ±0 B (±0.00%) CCM: ±0 B (±0.00%)
RAM: ±0 B (±0.00%)
MATEKF722 ±0 B (±0.00%) ITCM_RAM: ±0 B (±0.00%)
RAM: ±0 B (±0.00%)
TCM: ±0 B (±0.00%)
MATEKF765 ±0 B (±0.00%) DTCM_RAM: ±0 B (±0.00%)
SRAM1: ±0 B (±0.00%)
MATEKH743 ±0 B (±0.00%) D2_RAM: ±0 B (±0.00%)
DTCM_RAM: ±0 B (±0.00%)
ITCM_RAM: ±0 B (±0.00%)
RAM: ±0 B (±0.00%)

See RAM/flash optimization guide for techniques to reduce usage.

@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

Test firmware build ready — commit aa7fdea

Download firmware for PR #11955

245 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.

The Betaflight->INAV converter emitted USE_FLASH_W25M/W25M02G/W25M512 for
every converted target, but that flash family has no driver (targets use
W25N01G). Removing them from the supported list prevents the dead macros
from being regenerated on future conversions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant