Files
PX4-Autopilot/boards/matek
Jacob Dahl d983b6424f refactor(boards): remove dead defines from board_config.h (#28168)
* refactor(boards): remove unused INPUT_CAP* board defines

INPUT_CAP*_TIMER, INPUT_CAP*_CHANNEL and GPIO_INPUT_CAP* have never had a
consumer. They are present as far back as v1.8.0 (then in
src/drivers/boards/px4fmu-v5/board_config.h) and no code outside a
board_config.h has ever read them.

Input capture is configured in the board timer_config.cpp via
initIOTimerChannelCapture() and driven by
platforms/nuttx/.../io_pins/input_capture.c. On ten of these boards the
removed defines restate, in a second notation, exactly the channel
timer_config.cpp already declares -- fmu-v5x described T5C4 on PI0 and
declares initIOTimerChannelCapture({Timer5, Channel4}, {PortI, Pin0}).

Being unread, the duplicates drifted:

  - cuav/7-nano INPUT_CAP4 named GPIO_TIM4_CH1IN_2 on PD12 while its own
    INPUT_CAP4_TIMER said 15; the configured channel is T15C2 on PE6.
  - modalai/fc-v2 and sky-drones/smartap-airlink declare input capture
    pins while configuring no capture channel at all.

New boards kept inheriting the block by copying an existing
board_config.h.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* refactor(boards): remove leftover BOARD_HAS_PWM defines

a8e75d174c ("boards: remove BOARD_HAS_PWM and use
DIRECT_PWM_OUTPUT_CHANNELS") dropped the last consumer in 2021, but the
board_config.h side of that cleanup was never finished and boards added
since have kept copying it in. Every remaining definition is a bare alias
of DIRECT_PWM_OUTPUT_CHANNELS, which is the macro actually read.

mamba-f405-mk2 defined it twice in the same header.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* refactor(boards): remove leftover DIRECT_INPUT_TIMER_CHANNELS defines

c5c80e31b6 ("boards: remove DIRECT_INPUT_TIMER_CHANNELS from
board_config.h") removed the last consumer in 2021. These ten boards
either predate the sweep or were added afterwards by copying a
board_config.h that still carried it.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* refactor(boards): remove unused BOARD_NUMBER_I2C_BUSES defines

Nothing reads BOARD_NUMBER_I2C_BUSES. The bus count actually in use is
PX4_NUMBER_I2C_BUSES, which each architecture sets in its micro_hal.h
(STM32_NI2C, KINETIS_NI2C, or a literal) and a board cannot influence.

The near-miss name is worse than a plain unused define: it reads like the
board is declaring its bus count when the value is inert.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* refactor(boards): remove unused BOARD_DMA_NUM_DSHOT_CHANNELS defines

Nothing reads it. The dshot driver sizes its DMA buffers from
MAX_IO_TIMERS and MAX_NUM_CHANNELS_PER_TIMER, so the accompanying comment
describes a budget the board cannot actually declare.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* refactor(boards/ark): remove dead board_config defines

cannode: the eight GPIO_TIM*_RESET pin configs were never added to
PX4_GPIO_INIT_LIST, unlike the GPIO_I2C1_{SCL,SDA}_RESET pair written
beside them, so nothing ever applied them.

fmu-v6s: ARKV6S_0 is a leftover from copying the fmu-v6x config. fmu-v6x
keys its SPI buses on the FMUM ID via initSPIFmumID(ARKV6X_0, ...), but
fmu-v6s has a single hardware version and uses the plain initSPIBus form,
so the ID is never referenced.

Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-08-05 22:26:22 -06:00
..