Skip to content

Conversation

@EmaxModel
Copy link
Contributor

@EmaxModel EmaxModel commented Feb 26, 2025

add new target EMAX_F722

Summary by CodeRabbit

  • New Features
    • Added support for the EMAX F722 and EMAX G473 flight controller boards, including sensor, peripheral, and hardware configuration for each board.
    • Enabled features such as gyro, accelerometer, barometer, flash memory, OSD, and specific pin assignments for motors, LEDs, UARTs, and more.
    • Included default hardware settings for logging, voltage and current monitoring, and receiver protocols for both boards.

@EmaxModel
Copy link
Contributor Author

mcu

@ot0tot
Copy link
Contributor

ot0tot commented Feb 26, 2025

Please review the manufacturer design guidelines: https://betaflight.com/docs/development/manufacturer/manufacturer-design-guidelines and submit the schematic for review on the Discord.

Note that per the announcement made on 12/3/24, F7 FCs now support a maximum of 4 motor outputs.

@EmaxModel
Copy link
Contributor Author

Whether the led pin can be approved after the change

@ot0tot
Copy link
Contributor

ot0tot commented Mar 19, 2025

Whether the led pin can be approved after the change

Yes, should be ok. Have you made the other changes requested on the Discord?

@EmaxModel
Copy link
Contributor Author

Whether the led pin can be approved after the change

Yes, should be ok. Have you made the other changes requested on the Discord?

Yes, we have made changes

@EmaxModel
Copy link
Contributor Author

Whether the led pin can be approved after the change

Yes, should be ok. Have you made the other changes requested on the Discord?

What other information do we need to provide to pass f722

@ot0tot
Copy link
Contributor

ot0tot commented Mar 25, 2025

Can you post the updated schematic in the Discord?

@EmaxModel
Copy link
Contributor Author

Can you post the updated schematic in the Discord?

sure

@ot0tot
Copy link
Contributor

ot0tot commented Mar 25, 2025

Updated schematic does not follow the manufacturer design guidelines or the connector standard. Feedback provided in the Discord.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

Walkthrough

Two new configuration header files are introduced for the EMAX F722 and EMAX G473 AIO flight controller boards. Each file defines board-specific macros for MCU type, sensor and peripheral usage, pin assignments, timer mappings, DMA options, default hardware settings, and device alignments, centralizing all hardware-specific definitions required for Betaflight firmware support.

Changes

Cohort / File(s) Change Summary
EMAX F722 Board Configuration
configs/EMAX_F722/config.h
New configuration header for EMAX F722. Defines MCU as STM32F7X2, sets board and manufacturer identifiers, enables sensors (ICM42688P gyro/accel, DPS310 baro), flash (W25Q128FV), OSD (MAX7456), and assigns GPIOs for beeper, motors, LEDs, UARTs, I2C, SPI, ADC, flash, and gyro. Includes timer pin mapping, ADC3 DMA option, default hardware instances, DShot bitbang mode, current/voltage meter sources and scaling, SPI instances, gyro alignment (CW270), and beeper polarity.
EMAX G473 AIO Board Configuration
configs/EMAX_G473_AIO/config.h
New configuration header for EMAX G473 AIO. Defines MCU as STM32G47X, sets board and manufacturer identifiers, enables sensors (ICM42688P gyro/accel), flash (W25Q128FV), OSD (MAX7456), and assigns GPIOs for beeper, motors, LEDs, UARTs, I2C, SPI, ADC, flash, MAX7456, and gyro. Provides timer pin mapping, ADC1 DMA option, UART assignments, I2C instances, serial receiver protocol, default blackbox device, DShot settings, current/voltage meter sources and scaling, beeper polarity, system clock frequency, SPI instances, and gyro alignment (CW180).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BetaflightFW
    participant EMAX_F722_Config
    participant EMAX_G473_Config

    User->>BetaflightFW: Select EMAX_F722 or EMAX_G473_AIO target
    BetaflightFW->>EMAX_F722_Config: Load config.h (if EMAX_F722)
    BetaflightFW->>EMAX_G473_Config: Load config.h (if EMAX_G473_AIO)
    EMAX_F722_Config-->>BetaflightFW: Provide board macros, pinouts, sensor/peripheral settings
    EMAX_G473_Config-->>BetaflightFW: Provide board macros, pinouts, sensor/peripheral settings
    BetaflightFW->>User: Build firmware with board-specific configuration
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • add new sensors to target for Hobbywing #838: Adds support for ICM42688P sensor and DPS310 barometer in board configs, similar to sensor enablement and hardware definitions in this PR.
  • Add AIKONF4V3 #715: Introduces new board config headers with macros for MCU, sensors, pins, and peripherals, paralleling the structure and purpose of this PR.
  • Add New Target DAKEFPVH743Pro #793: Adds configuration headers for other flight controller boards with similar macro definitions for hardware setup, directly related in approach and content.

Suggested reviewers

  • ot0tot
  • haslinghuis
  • nerdCopter

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
  • 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 src/utils.ts and explain its main purpose.
    • @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 comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

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

@haslinghuis haslinghuis requested a review from ot0tot June 26, 2025 06:54
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: 1

🧹 Nitpick comments (1)
configs/EMAX_G473_AIO/config.h (1)

89-91: Consider adding voltage meter scale.

While current meter scale is defined, consider adding a voltage meter scale for consistency with other board configurations.

 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
 #define DEFAULT_CURRENT_METER_SCALE 750
+#define DEFAULT_VOLTAGE_METER_SCALE 110
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdea267 and 5dc269f.

📒 Files selected for processing (1)
  • configs/EMAX_G473_AIO/config.h (1 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
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.
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.
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T15:17:30.040Z
Learning: In Betaflight configurations, when a target name suggests dual IMUs (like JHEF7DUAL) but specific hardware variants only have one gyro available, the preferred solution is to use DEFAULT_GYRO_TO_USE macro to specify which gyro to use by default rather than pruning gyro defines or creating redundant configurations. This approach maintains compatibility when the same target is used by multiple hardware variants from the same manufacturer.
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.
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: 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: haslinghuis
PR: betaflight/config#656
File: configs/IFLIGHT_F745_AIO/config.h:31-35
Timestamp: 2025-07-28T16:44:59.686Z
Learning: In Betaflight board configurations, when a board design uses the same physical gyro socket but different sensor variants across production batches (e.g., MPU6000 in older batches, ICM42688P in newer batches), the correct approach is to enable both sensor drivers (USE_GYRO_SPI_MPU6000 and USE_GYRO_SPI_ICM42688P) in the same configuration. This allows runtime auto-detection of which sensor is actually present without requiring separate board configurations for each hardware variant.
Learnt from: haslinghuis
PR: betaflight/config#822
File: configs/AXISFLYINGH7MINI/config.h:121-129
Timestamp: 2025-06-23T18:44:59.162Z
Learning: In Betaflight configuration files, USE_OSD_HD and USE_MAX7456 are for different OSD systems: USE_MAX7456 enables the MAX7456 analog OSD chip, while USE_OSD_HD enables HD/digital OSD via MSP. MSP_DISPLAYPORT_UART should be guarded by USE_OSD_HD, not USE_MAX7456, as they serve different OSD implementations.
Learnt from: ot0tot
PR: betaflight/config#681
File: configs/NYX405V1/config.h:26-28
Timestamp: 2025-07-14T15:47:16.394Z
Learning: In Betaflight configuration files, MANUFACTURER_ID values must be exactly 4 ASCII characters long, not 3 characters. All manufacturer IDs in the codebase consistently use 4-character identifiers like AIRB, FOSS, SPBE, MTKS, NERC, etc.
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: For Betaflight configurations, blackbox logging via SPI3 and LED_STRIP functionality can be mutually exclusive due to DMA stream conflicts on STM32F4 targets. This hardware limitation should be identified during timer configuration reviews.
📚 Learning: for betaflight board configurations of boards already in production, pin assignments in config.h fil...
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/EMAX_G473_AIO/config.h
📚 Learning: in betaflight configurations, when a target name suggests dual imus (like jhef7dual) but specific ha...
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T15:17:30.040Z
Learning: In Betaflight configurations, when a target name suggests dual IMUs (like JHEF7DUAL) but specific hardware variants only have one gyro available, the preferred solution is to use DEFAULT_GYRO_TO_USE macro to specify which gyro to use by default rather than pruning gyro defines or creating redundant configurations. This approach maintains compatibility when the same target is used by multiple hardware variants from the same manufacturer.

Applied to files:

  • configs/EMAX_G473_AIO/config.h
📚 Learning: always verify that the board_name define in each config.h matches the directory name it resides in (...
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/EMAX_G473_AIO/config.h
📚 Learning: always verify that the `board_name` define in config.h files exactly matches the directory name wher...
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/EMAX_G473_AIO/config.h
📚 Learning: in betaflight configuration files, feature enablement macros like use_mag are build options that can...
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/EMAX_G473_AIO/config.h
📚 Learning: in betaflight board configurations, when a board design uses the same physical gyro socket but diffe...
Learnt from: haslinghuis
PR: betaflight/config#656
File: configs/IFLIGHT_F745_AIO/config.h:31-35
Timestamp: 2025-07-28T16:44:59.686Z
Learning: In Betaflight board configurations, when a board design uses the same physical gyro socket but different sensor variants across production batches (e.g., MPU6000 in older batches, ICM42688P in newer batches), the correct approach is to enable both sensor drivers (USE_GYRO_SPI_MPU6000 and USE_GYRO_SPI_ICM42688P) in the same configuration. This allows runtime auto-detection of which sensor is actually present without requiring separate board configurations for each hardware variant.

Applied to files:

  • configs/EMAX_G473_AIO/config.h
📚 Learning: the default_gyro_enabled macro with both gyros enabled (gyro_mask(0) | gyro_mask(1)) should only be ...
Learnt from: haslinghuis
PR: betaflight/config#792
File: configs/BEEROTORF4/config.h:30-30
Timestamp: 2025-05-28T15:42:05.402Z
Learning: The DEFAULT_GYRO_ENABLED macro with both gyros enabled (GYRO_MASK(0) | GYRO_MASK(1)) should only be added to board configurations that have DEFAULT_GYRO_TO_USE set to GYRO_CONFIG_USE_GYRO_BOTH. Boards without this setting should only get the GYRO_COUNT definition to specify the number of available gyros.

Applied to files:

  • configs/EMAX_G473_AIO/config.h
📚 Learning: gyro_1_spi_clock_divider is not used in any betaflight target configuration files. spi clock frequen...
Learnt from: haslinghuis
PR: betaflight/config#835
File: configs/HDZERO_HALO_MPU6000/config.h:29-35
Timestamp: 2025-07-14T16:16:50.628Z
Learning: GYRO_1_SPI_CLOCK_DIVIDER is not used in any Betaflight target configuration files. SPI clock frequency settings are not commonly configured at the target level.

Applied to files:

  • configs/EMAX_G473_AIO/config.h
📚 Learning: for betaflight board configuration reviews, always verify that serial port defines (like esc_sensor_...
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/EMAX_G473_AIO/config.h
📚 Learning: the default_gyro_enabled macro with both gyros enabled (gyro_mask(0) | gyro_mask(1)) should only be ...
Learnt from: haslinghuis
PR: betaflight/config#792
File: configs/BEEROTORF4/config.h:30-30
Timestamp: 2025-05-28T15:42:05.402Z
Learning: The DEFAULT_GYRO_ENABLED macro with both gyros enabled (GYRO_MASK(0) | GYRO_MASK(1)) should only be added to board configurations that have DEFAULT_GYRO_TO_USE set to GYRO_CONFIG_USE_GYRO_BOTH. Boards without this setting should only get the GYRO_COUNT definition.

Applied to files:

  • configs/EMAX_G473_AIO/config.h
📚 Learning: in stm32f405-based flight controller configurations, timer pin mappings must be carefully analyzed f...
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/EMAX_G473_AIO/config.h
📚 Learning: for betaflight board configuration reviews, always verify that serial port defines use valid identif...
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/EMAX_G473_AIO/config.h
📚 Learning: for betaflight configurations, blackbox logging via spi3 and led_strip functionality can be mutually...
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: For Betaflight configurations, blackbox logging via SPI3 and LED_STRIP functionality can be mutually exclusive due to DMA stream conflicts on STM32F4 targets. This hardware limitation should be identified during timer configuration reviews.

Applied to files:

  • configs/EMAX_G473_AIO/config.h
🔇 Additional comments (5)
configs/EMAX_G473_AIO/config.h (5)

29-36: LGTM on feature enables.

The sensor and peripheral feature enables are appropriate for a modern flight controller with ICM42688P IMU, W25Q128FV flash, and MAX7456 OSD.


37-70: Pin assignments look well-structured.

The pin assignments are comprehensive and appropriate for an AIO flight controller. The 4-motor configuration aligns with current Betaflight standards, and peripheral pin assignments appear conflict-free.


71-77: Timer mapping is well-configured.

The timer pin mapping correctly includes LED strip and motor outputs using TIM1 with appropriate channel assignments.


80-81: Serial port identifiers are correct.

The serial port assignments use valid SERIAL_PORT_USART2 and SERIAL_PORT_USART3 identifiers that match the Betaflight codebase.


87-98: Default settings are appropriate for STM32G47X.

The DSHOT, SPI instance assignments, and system clock settings are well-configured for the G4 platform. The gyro alignment and other defaults appear reasonable.


#define FC_TARGET_MCU STM32G47X

#define BOARD_NAME EMAX_G473
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix BOARD_NAME to match directory name.

The BOARD_NAME should match the directory name exactly. The config file is located in configs/EMAX_G473_AIO/ but BOARD_NAME is defined as EMAX_G473.

-#define BOARD_NAME 	EMAX_G473
+#define BOARD_NAME 	EMAX_G473_AIO
🤖 Prompt for AI Agents
In configs/EMAX_G473_AIO/config.h at line 26, the BOARD_NAME macro is defined as
EMAX_G473 but should exactly match the directory name EMAX_G473_AIO. Update the
BOARD_NAME definition to EMAX_G473_AIO to ensure consistency with the directory
structure.

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.

3 participants