Skip to content

Conversation

@bdherouville
Copy link

@bdherouville bdherouville commented Jan 12, 2026

User description

Hi,

Using an elrs RX and OpenIPC the ADC RSSI needs to be remapped to TX4 for being able to output OSD to the camera.
Remapping the pad and mposd worked on betaflight, now the target needs to be ported on Inav.


PR Type

Enhancement, New Target


Description

  • Add OMNIBUSF4PRO_MPOSD target variant for OpenIPC camera support

  • Configure UART4 with TX on PA0 for MPOSD output

  • Remap ADC channel 3 pin to avoid conflict with UART4_TX

  • Inherit OMNIBUSF4PRO_LEDSTRIPM5 configuration for new target


Diagram Walkthrough

flowchart LR
  A["OMNIBUSF4PRO_MPOSD<br/>New Target"] -->|"Inherits from"| B["OMNIBUSF4PRO_LEDSTRIPM5"]
  A -->|"Configures"| C["UART4 on PA0"]
  A -->|"Disables"| D["ADC_CHANNEL_3_PIN<br/>on PA0"]
  C -->|"Outputs to"| E["MPOSD/Camera"]
Loading

File Walkthrough

Relevant files
Configuration changes
target.h
Configure UART4 and remap ADC for MPOSD                                   

src/main/target/OMNIBUSF4/target.h

  • Added conditional block for OMNIBUSF4PRO_MPOSD target that inherits
    OMNIBUSF4PRO_LEDSTRIPM5 configuration
  • Configured UART4 with TX pin on PA0 and RX pin set to NONE for MPOSD
    output
  • Modified ADC_CHANNEL_3_PIN definition to exclude PA0 when
    OMNIBUSF4PRO_MPOSD is defined, preventing pin conflict
  • Added documentation comment explaining OMNIBUSF4PRO_MPOSD purpose for
    OpenIPC camera integration
+16/-1   
CMakeLists.txt
Register new OMNIBUSF4PRO_MPOSD build target                         

src/main/target/OMNIBUSF4/CMakeLists.txt

  • Added OMNIBUSF4PRO_MPOSD as a new STM32F405 target variant
+1/-0     

@github-actions
Copy link

Branch Targeting Suggestion

You've targeted the master branch with this PR. Please consider if a version branch might be more appropriate:

  • maintenance-9.x - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release.

  • maintenance-10.x - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x

If master is the correct target for this change, no action is needed.


This is an automated suggestion to help route contributions to the appropriate branch.

@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

Copy link
Contributor

Choose a reason for hiding this comment

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

High-level Suggestion

To avoid increasing maintenance overhead from adding numerous specific targets, consider using custom defines for niche configurations. This allows users to enable features like the MPOSD pin remapping during their build process on an existing target, rather than creating a new official one. [High-level, importance: 8]

Solution Walkthrough:

Before:

// CMakeLists.txt
target_stm32f405xg(OMNIBUSF4PRO)
target_stm32f405xg(OMNIBUSF4PRO_MPOSD) // New target added

// target.h
#ifdef OMNIBUSF4PRO_MPOSD
#define OMNIBUSF4PRO_LEDSTRIPM5
#endif

#if defined(OMNIBUSF4PRO_MPOSD)
#define USE_UART4
#define UART4_TX_PIN PA0
#endif

#if !defined(OMNIBUSF4PRO_MPOSD)
    #define ADC_CHANNEL_3_PIN PA0
#endif

After:

// No new target in CMakeLists.txt
// User builds with e.g. `make OMNIBUSF4PRO CUSTOM_DEFINES=USE_MPOSD_ON_PA0`

// target.h
// No OMNIBUSF4PRO_MPOSD target definition

#if defined(USE_MPOSD_ON_PA0)
#define USE_UART4
#define UART4_TX_PIN PA0
#endif

#if !defined(USE_MPOSD_ON_PA0)
    #define ADC_CHANNEL_3_PIN PA0
#endif


#define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
#define VBAT_ADC_CHANNEL ADC_CHN_2
#define RSSI_ADC_CHANNEL ADC_CHN_3
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Conditionally define RSSI_ADC_CHANNEL as ADC_CHN_NONE when OMNIBUSF4PRO_MPOSD is active to prevent using an ADC channel with an unassigned pin. [possible issue, importance: 8]

Suggested change
#define RSSI_ADC_CHANNEL ADC_CHN_3
#if defined(OMNIBUSF4PRO_MPOSD)
#define RSSI_ADC_CHANNEL ADC_CHN_NONE
#else
#define RSSI_ADC_CHANNEL ADC_CHN_3
#endif

Comment on lines +20 to +23
//OMNIBUSF4PRO_MPOSD = OMNIBUSF4PRO_LEDSTRIPM5 and MPOSD on adc rssi pin for openipc camera
#ifdef OMNIBUSF4PRO_MPOSD
#define OMNIBUSF4PRO_LEDSTRIPM5
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Prefer defining the effective base target directly (and keep comments consistent) so the variant’s semantics are explicit and less likely to drift when other targets/macros change. [Learned best practice, importance: 5]

Suggested change
//OMNIBUSF4PRO_MPOSD = OMNIBUSF4PRO_LEDSTRIPM5 and MPOSD on adc rssi pin for openipc camera
#ifdef OMNIBUSF4PRO_MPOSD
#define OMNIBUSF4PRO_LEDSTRIPM5
#endif
// OMNIBUSF4PRO_MPOSD: OMNIBUSF4PRO with LED strip on M5 and MPOSD on PA0 (OpenIPC).
#ifdef OMNIBUSF4PRO_MPOSD
#define OMNIBUSF4PRO
#define OMNIBUSF4PRO_LEDSTRIPM5
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant