Skip to content

Conversation

demvlad
Copy link
Contributor

@demvlad demvlad commented Oct 1, 2025

The additions for MAVLink serial RX provider PR

Summary by CodeRabbit

  • New Features
    • Added MAVLINK as a supported receiver protocol (API ≥ 1.46), showing up in available and supported RX types when firmware includes it.
    • Telemetry now auto-enabled and locked when MAVLINK is selected, consistent with other telemetry-capable protocols.
    • Firmware Flasher UI reflects MAVLINK’s telemetry inclusion and disables manual telemetry selection accordingly.
    • Added “MAVLINK” to Debug modes for improved diagnostics.

Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Adds MAVLINK as a recognized RX protocol across UI and core logic: build option constant, supported/available serial RX types, telemetry enablement conditions, firmware flasher telemetry UI behavior, and a DEBUG mode string. No other control flow or public API changes.

Changes

Cohort / File(s) Summary
Telemetry enablement logic
src/js/Features.js, src/js/tabs/firmware_flasher.js
Include MAVLINK in protocol checks that auto-enable/assume telemetry when API >= 1.46 or when selected in flasher UI.
Serial RX MAVLINK support
src/js/fc.js
Added FIRMWARE_BUILD_OPTIONS.USE_SERIALRX_MAVLINK (4109). FC.getSerialRxTypes appends "MAVLINK" for API >= 1.46. FC.getSupportedSerialRxTypes adds "MAVLINK" when build options include the new flag.
Debug modes update
src/js/debug.js
Added "MAVLINK" to DEBUG.modes. Minor whitespace only; no other logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Flasher UI
  participant Features
  participant FC

  User->>Flasher UI: Select RX protocol = MAVLINK
  Flasher UI->>Features: Evaluate telemetry rules (API >= 1.46)
  Note over Features: MAVLINK included in telemetry-enabling protocols
  Features-->>Flasher UI: Telemetry implied (disable manual selection)
  Flasher UI-->>User: Telemetry option auto-set/disabled
Loading
sequenceDiagram
  autonumber
  participant App
  participant FC

  App->>FC: getSerialRxTypes()
  alt API >= 1.46
    FC-->>App: [..., "MAVLINK"]
  else
    FC-->>App: [...]
  end

  App->>FC: getSupportedSerialRxTypes(buildOptions)
  alt buildOptions includes USE_SERIALRX_MAVLINK
    FC-->>App: supported + "MAVLINK"
  else
    FC-->>App: supported (unchanged)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

RN: IMPROVEMENT

Suggested reviewers

  • haslinghuis
  • nerdCopter
  • KarateBrot

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository’s template and only provides a brief link to a related Betaflight core PR without any details on the changes, testing, or adherence to coding style and branching guidelines. Please flesh out the PR description to include the template’s required sections such as a detailed change summary, any CI or testing steps, reference issues or fixes, and confirmation of branch and style guideline compliance.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately and concisely describes the primary change introduced by the pull request: adding MAVLink serial RX provider settings. It is clear, specific, and free of unnecessary noise.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

Comment @coderabbitai help to get the list of available commands and usage tips.

@demvlad demvlad marked this pull request as draft October 1, 2025 20:20
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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5a3604 and de4914c.

📒 Files selected for processing (4)
  • src/js/Features.js (1 hunks)
  • src/js/debug.js (1 hunks)
  • src/js/fc.js (3 hunks)
  • src/js/tabs/firmware_flasher.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/js/fc.js (2)
src/js/serial_backend.js (1)
  • options (546-546)
src/js/tabs/receiver.js (1)
  • supportedRxTypes (254-254)
src/js/Features.js (1)
src/js/data_storage.js (2)
  • API_VERSION_1_46 (4-4)
  • API_VERSION_1_46 (4-4)
src/js/debug.js (1)
src/js/utils/array.js (2)
  • addArrayElement (65-69)
  • replaceArrayElement (78-83)
🔇 Additional comments (6)
src/js/debug.js (1)

858-858: LGTM!

Minor whitespace improvement that enhances code readability.

src/js/Features.js (1)

64-74: LGTM!

The TELEMETRY enablement logic correctly includes MAVLINK alongside existing protocols (CRSF, GHST, FPORT, JETI). The implementation is consistent with the established pattern and properly gated by API version checks.

src/js/tabs/firmware_flasher.js (1)

294-294: LGTM!

MAVLINK is correctly added to the list of radio protocols with built-in telemetry support. This ensures the UI properly disables telemetry protocol selection when MAVLINK is selected, consistent with other protocols like CRSF and GHST.

src/js/fc.js (3)

87-87: LGTM!

The USE_SERIALRX_MAVLINK constant is properly defined with sequential value 4109, following the established pattern for serial RX protocol build options.


807-807: LGTM!

MAVLINK is correctly added to the serial RX types list for API version 1.46+, following the same pattern as other RX type additions in this block.


856-858: LGTM!

The build option check for MAVLINK support is correctly implemented, following the established pattern for other serial RX protocols. The logic properly adds MAVLINK to supported types when the USE_SERIALRX_MAVLINK build option is present.

@demvlad
Copy link
Contributor Author

demvlad commented Oct 2, 2025

@haslinghuis
I am looking, the congigurator is opened at Android smartphone. Does that mean it can work by Android now?
It had opening error some time ago.

@haslinghuis
Copy link
Member

Only BT for now

Copy link

sonarqubecloud bot commented Oct 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
25.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Contributor

github-actions bot commented Oct 3, 2025

Preview URL: https://pr4643.betaflight-app.pages.dev

@demvlad
Copy link
Contributor Author

demvlad commented Oct 3, 2025

What is interested.
The telemetries type options are disabled in uart setup list when I use mavlink rx provider. Even if i've used manual define in auto generated build config files. IIRC, its can be enabled if DUSE_TELEMETRY_XXXX is defined in firmware build.
How can I set auto generated build config files to debug code at local build? Are it's auto generated by using cloud build option or can I do something? Probably I can have some script for this.

I will add mavlink debug in BBExplorer for the curent versions compatibility

@haslinghuis
Copy link
Member

  • Local build should work
  • When using cloud build + custom defines, it won't be catched 😭
  • Cloud build server options needs to be updated before we can run the script to include this.

@haslinghuis haslinghuis changed the title Added MAVLIK serial RX provider settings Added MAVLink serial RX provider settings Oct 3, 2025
@haslinghuis
Copy link
Member

@demvlad when merged you can use this define - betaflight/betaflight#14693

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: App
Development

Successfully merging this pull request may close these issues.

2 participants