Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Aug 22, 2025

Summary by CodeRabbit

  • New Features
    • Added native support for the AIRBOTSUPERF4V2 flight controller.
    • Preconfigured sensors: gyro/accelerometer (ICM42688P), barometer (DPS310), with optional LSM6DSV16X combo.
    • Ready-to-use pin mappings for motors, LEDs, UARTs, I2C, SPI, ADC and auxiliary pins.
    • Optional on-screen display support with font handling and MSP port selection when enabled.
    • Default power monitoring via ADC for voltage/current and blackbox logging to onboard flash.

@haslinghuis haslinghuis self-assigned this Aug 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 22, 2025

Walkthrough

Adds a new AIRBOTSUPERF4V2 Betaflight board configuration header defining MCU (AT32F435M), board/manufacturer IDs, enabled sensors/peripherals (ICM42688P, LSM6DSV16X, DPS310, M25P16), conditional OSD, and full pin/timer/UART/I2C/SPI/ADC mappings plus flash/blackbox and meter defaults.

Changes

Cohort / File(s) Summary
New board configuration
configs/AIRBOTSUPERF4V2/config.h
Adds AIRBOTSUPERF4V2 board config: targets AT32F435M; defines board/manufacturer IDs; enables ACC/GYRO (ICM42688P, LSM6DSV16X), BARO (DPS310), FLASH (M25P16); conditional OSD macros; comprehensive pin and TIMER_PIN_MAPPING for beep, motors, LEDs, UARTs, I2C, SPI, ADC, aux; sets I2C instances for sensors, flash interface, default ADC meter sources, and blackbox=flash.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ot0tot
  • nerdCopter
  • KarateBrot

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e150bc0 and db677ad.

📒 Files selected for processing (1)
  • configs/AIRBOTSUPERF4V2/config.h (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • configs/AIRBOTSUPERF4V2/config.h
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or `` to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
configs/AIRBOTSUPERF4V2/config.h (4)

29-38: Two IMU driver families enabled; trim to actual hardware to save flash and avoid ambiguity.

You enable ICM42688P (ACC+GYRO over SPI) and also LSM6DSV16X (I2C/SPI). Unless the board really ships with both, carrying both drivers bloats firmware and can complicate sensor probing.

If the hardware is ICM42688P-only, remove the LSM6 driver:

 #define USE_GYRO
 #define USE_GYRO_SPI_ICM42688P
-#define USE_ACCGYRO_LSM6DSV16X

If both variants exist, consider a separate config directory or feature flag to keep per-board binaries minimal.


107-116: Double-check TIMER_PIN_MAPPING vs. AT32 timer/DMAMUX constraints.

Motor PWM, LED strip, and SPI DMA must not collide. Please validate timer indices, channels, and DMA routing for:

  • LED_STRIP on PA15 (often repurposes JTDI — acceptable if by design),
  • Motors on PB6/7, PB0/1, PC6/7/8/9,
  • SPI3 (flash) and SPI1 (gyro) DMA selections.

Given prior DMA conflict issues on F4-class MCUs, cross-verify against the AT32 timer/DMA mapping referenced in the PR description. Also confirm that mapping indices align with the expected resource order (note MOTOR8 before MOTOR7 here is fine functionally, but verify it’s intentional).


117-117: Verify ADC1_DMA_OPT value.

Ensure ADC1_DMA_OPT=9 is the recommended option for your chosen ADC channel(s) and doesn’t overlap with timers/SPI DMA streams used above.

You can leave a short comment indicating the rationale (DMAMUX line/stream selection) to aid future maintenance.


81-91: PC14/PC15 usage: confirm LSE is not required.

LED0 uses PC15 and GYRO_1_CS uses PC14. On many MCUs these are LSE pins; on AT32F435 they can be GPIO, but if LSE is ever enabled these assignments could conflict. Confirm LSE isn’t used or document that LSE is intentionally disabled on this board.

Also applies to: 103-106

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0a79266 and dc6c8c5.

📒 Files selected for processing (1)
  • configs/AIRBOTSUPERF4V2/config.h (1 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the BOARD_NAME define in each config.h matches the directory name it resides in (e.g., configs/AXISFLYINGF7AIO/config.h must have #define BOARD_NAME AXISFLYINGF7AIO). This check is required for all Betaflight board configuration reviews.
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the `BOARD_NAME` define in config.h files exactly matches the directory name where the config file is located. For example, if the config file is in configs/AXISFLYINGF7AIO/config.h, then the BOARD_NAME should be defined as "AXISFLYINGF7AIO". This ensures proper board identification and configuration loading in Betaflight.
Learnt from: haslinghuis
PR: betaflight/config#835
File: configs/HDZERO_HALO_MPU6000/config.h:44-56
Timestamp: 2025-07-14T16:16:56.822Z
Learning: For Betaflight board configurations of boards already in production, pin assignments in config.h files reflect the actual hardware design and cannot be changed, even if they present potential conflicts with debug interfaces. The configuration must match the physical board layout, not ideal software design preferences.
📚 Learning: 2025-07-14T16:16:56.822Z
Learnt from: haslinghuis
PR: betaflight/config#835
File: configs/HDZERO_HALO_MPU6000/config.h:44-56
Timestamp: 2025-07-14T16:16:56.822Z
Learning: For Betaflight board configurations of boards already in production, pin assignments in config.h files reflect the actual hardware design and cannot be changed, even if they present potential conflicts with debug interfaces. The configuration must match the physical board layout, not ideal software design preferences.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-07-03T04:33:57.480Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the BOARD_NAME define in each config.h matches the directory name it resides in (e.g., configs/AXISFLYINGF7AIO/config.h must have #define BOARD_NAME AXISFLYINGF7AIO). This check is required for all Betaflight board configuration reviews.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-07-03T04:33:57.480Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the `BOARD_NAME` define in config.h files exactly matches the directory name where the config file is located. For example, if the config file is in configs/AXISFLYINGF7AIO/config.h, then the BOARD_NAME should be defined as "AXISFLYINGF7AIO". This ensures proper board identification and configuration loading in Betaflight.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-06-23T18:43:31.746Z
Learnt from: haslinghuis
PR: betaflight/config#822
File: configs/AXISFLYINGH7MINI/config.h:29-37
Timestamp: 2025-06-23T18:43:31.746Z
Learning: In Betaflight configuration files, feature enablement macros like USE_MAG are build options that can be controlled at compile time, while hardware instance definitions like MAG_I2C_INSTANCE are predefined in board configurations to assist with hardware mapping when those features are enabled at build time.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-06-02T16:16:20.197Z
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: In STM32F405-based flight controller configurations, timer pin mappings must be carefully analyzed for DMA stream conflicts, especially between motor timers, LED strip timers, and SPI DMA assignments. Changes to TIMER_PIN_MAPPING should include verification that all required peripherals (motors, LED strip, blackbox SPI) can coexist without DMA conflicts.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-08-20T02:54:58.596Z
Learnt from: ot0tot
PR: betaflight/config#872
File: configs/HGLRCH743/config.h:82-83
Timestamp: 2025-08-20T02:54:58.596Z
Learning: For Betaflight board configuration reviews, the definitive source for validating UART pin assignments is the serial_uart_{platform}.c file in the Betaflight codebase (e.g., serial_uart_stm32h7xx.c for STM32H7xx platforms), not generic MCU datasheets. These files contain the exact pin mappings that Betaflight supports for each UART peripheral.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-07-23T13:43:50.456Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-23T13:43:50.456Z
Learning: For Betaflight board configuration reviews, always verify that serial port defines (like ESC_SENSOR_UART, MSP_UART, GPS_UART, etc.) use valid SERIAL_PORT identifiers that match those defined in the Betaflight codebase at src/main/io/serial.h. Common valid identifiers include SERIAL_PORT_USART1, SERIAL_PORT_USART2, SERIAL_PORT_USART3, SERIAL_PORT_UART4, SERIAL_PORT_UART5, etc. Invalid identifiers like SERIAL_PORT_UART3 (should be SERIAL_PORT_USART3) will cause build failures.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
📚 Learning: 2025-07-23T13:43:50.456Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-23T13:43:50.456Z
Learning: For Betaflight board configuration reviews, always verify that serial port defines use valid identifiers from the serialPortIdentifier_e enum in src/main/io/serial.h. Valid identifiers include: SERIAL_PORT_USB_VCP (20), SERIAL_PORT_SOFTSERIAL1 (30), SERIAL_PORT_SOFTSERIAL2 (31), SERIAL_PORT_LPUART1 (40), SERIAL_PORT_UART0 (50, if SERIAL_UART_FIRST_INDEX == 0), SERIAL_PORT_USART1 (51 or 50), SERIAL_PORT_USART2, SERIAL_PORT_USART3, SERIAL_PORT_UART4, SERIAL_PORT_UART5, SERIAL_PORT_USART6, SERIAL_PORT_USART7, SERIAL_PORT_USART8, SERIAL_PORT_UART9, SERIAL_PORT_USART10. While some aliases exist (like SERIAL_PORT_UART3 = SERIAL_PORT_USART3), prefer using the primary identifiers as referenced in the serialPortIdentifiers array to avoid build failures.

Applied to files:

  • configs/AIRBOTSUPERF4V2/config.h
🔇 Additional comments (3)
configs/AIRBOTSUPERF4V2/config.h (3)

26-28: BOARD_NAME matches directory — good catch kept.

BOARD_NAME equals the directory name (AIRBOTSUPERF4V2) and MANUFACTURER_ID is set. This aligns with our board-naming requirement.


60-62: UART2_RX not defined; PA3 is used for ADC current — intentional one-wire SA/IRC?

UART2 TX is PA2 but RX isn’t mapped (PA3 is CURRENT ADC). This is okay if UART2 is TX-only (SmartAudio/IRC Tramp), but please confirm intent and document to avoid confusion.

Optionally annotate the intent:

 #define UART2_TX_PIN                        PA2
+// No UART2_RX_PIN: PA3 is used for CURRENT ADC; UART2 intended as TX-only.

Also applies to: 69-70, 96-97


39-41: Flash/Blackbox wiring looks coherent.

SPI3 on PB3/PB4/PB5 with CS=PC13 and DEFAULT_BLACKBOX_DEVICE=FLASH is consistent with common designs.

Also applies to: 100-105, 122-125

@ot0tot
Copy link
Contributor

ot0tot commented Aug 25, 2025

Can you point me to the schematic for this please? I couldn't find it in the Discord.

@haslinghuis haslinghuis merged commit 2f7e33c into betaflight:master Sep 14, 2025
2 checks passed
@haslinghuis haslinghuis deleted the AIRBOTSUPERF4V2 branch September 14, 2025 17:03
@coderabbitai coderabbitai bot mentioned this pull request Sep 17, 2025
6 tasks
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