Skip to content

Update RX lua #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Aug 17, 2025

bytes parameter deprecated
1 serial_rx_provider
2-3 maxcheck
4-5 midrc
6-7 mincheck
8 spektrum_sat_bind
9-10 rx_min_usec
11-12 rx_max_usec
13 rcInterpolation 1.44
14 rcInterpolationInterval 1.44
15-16 airmodeActiveThreshold
17 rx_spi_protocol
18-21 rx_spi_id
22 rx_spi_rf_channel_count
23 fpvcamAngleDegrees
24 rcSmoothingChannels 1.44
25 rc_smoothing_type 1.44
26 rc_smoothing_setpoint_cutoff
27 rc_smoothing_feedforward_cutoff 1.47
28 rc_smoothing_input_type 1.44
29 rc_smoothing_derivative_type 1.44
30 usbDevConfig()->type
31 rc_smoothing_auto_factor_rpy
32 rc_smoothing_mode
33-38 rxExpressLrsSpiConfig()->UID
39 rxExpressLrsSpiConfig()->modelId

Summary by CodeRabbit

  • New Features
    • RX UI now adapts to firmware/API versions:
      • Interpolation and Interval controls limited to API 1.20–1.42.
      • Cam Angle control added for API ≥1.31.
      • RC Smoothing split into two branches:
        • API ≥1.47: new RC Smoothing block with Mode, Cutoffs, Setpoint (with Auto and Auto Smoothness) and a new Setpoint AF.
        • API 1.44–1.46: retains older RC Smoothing fields, including Feedforward.
      • Earlier pre-1.44 UI path has been superseded.

@haslinghuis haslinghuis added this to the 1.8 milestone Aug 17, 2025
@haslinghuis haslinghuis self-assigned this Aug 17, 2025
Copy link

coderabbitai bot commented Aug 17, 2025

Walkthrough

RX UI gating in src/SCRIPTS/BF/PAGES/rx.lua was reorganized by apiVersion: Interpolation/Interval limited to 1.20–1.42; Cam Angle added for >=1.31; RC Smoothing split into 1.47+ (new block with Setpoint AF id31), 1.44–1.46 (legacy RC Smoothing fields), and older pre-1.44 paths removed/restructured.

Changes

Cohort / File(s) Summary of Changes
RX page + RC Smoothing / API gating
src/SCRIPTS/BF/PAGES/rx.lua
Reworked UI gating by apiVersion: Interpolation (id13) & Interval (id14) shown only for 1.20–1.42. Cam Angle (id23) added for apiVersion >= 1.31. RC Smoothing split: 1.47+ introduces new RC Smoothing block (Mode id25, Cutoffs, Setpoint id26 with Auto, Auto Smoothness, new Setpoint AF id31); 1.44–1.46 retains older RC Smoothing fields (Mode id25, Cutoffs, Setpoint id26 with Auto, Feedforward id27 with Auto, Auto Smoothness). Pre-1.44 legacy UI/1.40-era path removed or superseded. No exported/public signatures changed; return structure unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant RX as RX Page UI
  participant API as apiVersion

  U->>RX: Open RX / RC Smoothing section
  RX->>API: Query apiVersion
  alt apiVersion >= 1.47
    RX-->>U: Render new RC Smoothing block (Mode id25, Cutoffs, Setpoint id26 w/Auto, Auto Smoothness, Setpoint AF id31)
  else apiVersion >= 1.44 and <= 1.46
    RX-->>U: Render legacy RC Smoothing fields (Mode id25, Cutoffs, Setpoint id26 w/Auto, Feedforward id27 w/Auto, Auto Smoothness)
  else
    RX-->>U: Render older/legacy layout (pre-1.44 paths removed/restructured)
  end
  alt apiVersion >= 1.31
    RX-->>U: Show Cam Angle (id23)
  end
  alt apiVersion >= 1.20 and <= 1.42
    RX-->>U: Show Interpolation (id13) and Interval (id14)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I hop through versions, shifting fields with care,
Setpoints find new burrows, old paths thin in air.
Smoothness blooms for newer rows, cam angles take their place,
A rabbit's nimble tweak that keeps each UI in its race. 🐇✨

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@haslinghuis haslinghuis force-pushed the filter-update branch 10 times, most recently from 26189f0 to 6223f90 Compare August 17, 2025 15:23
@haslinghuis haslinghuis changed the title Update RC filter Update RX lua Aug 17, 2025
Copy link

@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

♻️ Duplicate comments (1)
src/SCRIPTS/BF/PAGES/rx.lua (1)

47-50: LGTM: Interpolation/Interval correctly gated to 1.20–1.42.

This matches the previous review note that interpolation was removed in 4.3 and avoids showing obsolete controls on newer API versions.

🧹 Nitpick comments (2)
src/SCRIPTS/BF/PAGES/rx.lua (2)

23-23: Likely inverted ON/OFF mapping for Mode (0 should be OFF, 1 should be ON).

In both branches, Mode uses table = { [0] = "ON", "OFF" }. Conventionally, 0 maps to OFF and 1 to ON. As-is, the UI labels will be misleading.

Apply this diff in both places:

-    fields[#fields + 1] = { t = "Mode",            x = x + indent,   y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 1, vals = { 25 }, table = { [0] = "ON", "OFF" } }
+    fields[#fields + 1] = { t = "Mode",            x = x + indent,   y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 1, vals = { 25 }, table = { [0] = "OFF", "ON" } }

Also applies to: 30-30


21-27: Confirm: Is Feedforward setpoint intentionally removed for API ≥ 1.47?

The 1.44–1.46 branch includes a Feedforward cutoff (vals {27}); the ≥1.47 branch does not. If upstream removed FF in that API, this is fine; otherwise, it’s a regression.

If FF is still applicable in ≥1.47, mirror the 1.44–1.46 entry under the “Cutoffs” label:

     labels[#labels + 1] = { t = "Cutoffs",         x = x + indent,   y = inc.y(lineSpacing) }
     fields[#fields + 1] = { t = "Setpoint",        x = x + indent*2, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 255, vals = { 26 }, table = { [0] = "Auto" } }
+    fields[#fields + 1] = { t = "Feedforward",     x = x + indent*2, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 255, vals = { 27 }, table = { [0] = "Auto" } }

Would you like me to cross-check BF PR 14411 and adjust accordingly?

📜 Review details

Configuration used: CodeRabbit UI
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 1f0582a and 382e24c.

📒 Files selected for processing (1)
  • src/SCRIPTS/BF/PAGES/rx.lua (1 hunks)

Copy link

@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: 0

🧹 Nitpick comments (1)
src/SCRIPTS/BF/PAGES/rx.lua (1)

47-50: Verify scope: Interpolation/Interval currently only shown for 1.40–1.42 due to nesting

Because this check is inside the apiVersion >= 1.40 branch, versions 1.20–1.39 won’t show Interpolation/Interval despite the condition suggesting 1.20–1.42. If that’s intended, consider simplifying the condition to reduce confusion; if not, move the block outside the 1.40+ branch.

Minimal simplification if keeping it within the 1.40–1.42 scope:

-    if apiVersion >= 1.20 and apiVersion <= 1.42 then
+    if apiVersion <= 1.42 then
📜 Review details

Configuration used: CodeRabbit UI
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 382e24c and c8c3588.

📒 Files selected for processing (1)
  • src/SCRIPTS/BF/PAGES/rx.lua (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:27-27
Timestamp: 2025-08-17T18:27:20.457Z
Learning: The Auto Smoothness setpoint field (id 31) in rx.lua uses max = 255 for firmware 4.3 and up, which corresponds to API version 1.47+.
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:35-35
Timestamp: 2025-08-17T18:27:06.194Z
Learning: In Betaflight firmware 4.3 and up (corresponding to apiVersion >= 1.44), the Auto Smoothness setpoint max value should be 255, not 50 or 250.
📚 Learning: 2025-08-17T18:27:20.457Z
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:27-27
Timestamp: 2025-08-17T18:27:20.457Z
Learning: The Auto Smoothness setpoint field (id 31) in rx.lua uses max = 255 for firmware 4.3 and up, which corresponds to API version 1.47+.

Applied to files:

  • src/SCRIPTS/BF/PAGES/rx.lua
📚 Learning: 2025-08-17T18:27:06.194Z
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:35-35
Timestamp: 2025-08-17T18:27:06.194Z
Learning: In Betaflight firmware 4.3 and up (corresponding to apiVersion >= 1.44), the Auto Smoothness setpoint max value should be 255, not 50 or 250.

Applied to files:

  • src/SCRIPTS/BF/PAGES/rx.lua
🔇 Additional comments (3)
src/SCRIPTS/BF/PAGES/rx.lua (3)

21-27: RC Smoothing (API ≥1.47) block aligns with 4.3+ behavior — looks good

  • Setpoint (id 26) and Auto Smoothness Setpoint (id 31) both use 0–255, which matches the clarified 4.3+ range.
  • Feedforward cutoff (id 27) is removed here compared to the 1.44–1.46 branch, which aligns with the upstream direction.

35-35: Auto Smoothness Setpoint 0–255 for API 1.44–1.46 is correct

Using max = 255 for id 31 in 4.3-era APIs is consistent with the clarified firmware behavior.


36-45: Legacy RC Smoothing (API ≥1.40) block looks consistent

Enums and ranges (Type, Channels, Input/Derivative filters) appear correct and consistent with prior layouts.

Copy link

@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 (1)
src/SCRIPTS/BF/PAGES/rx.lua (1)

47-50: Interpolation/Interval UI is effectively gated to 1.40–1.42 (not 1.20–1.42)

This block is nested inside the elseif apiVersion >= 1.40 branch, so even with if apiVersion <= 1.42 it only shows for 1.40–1.42. If the intent is to show Interpolation/Interval for 1.20–1.39 as well, you’ll need a separate branch for 1.20–1.39.

If 1.20–1.39 should retain Interpolation, consider appending a legacy block after the 1.40+ branch:

elseif apiVersion >= 1.20 then
    -- Legacy interpolation-only UI for 1.20–1.39
    fields[#fields + 1] = { t = "Interpolation", x = x,          y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 3, vals = { 13 }, table={ [0]="Off", "Preset", "Auto", "Manual"} }
    fields[#fields + 1] = { t = "Interval",      x = x + indent, y = inc.y(lineSpacing), sp = x + sp, min = 1, max = 50, vals = { 14 } }

Please confirm whether 1.20–1.39 should be covered, or if support for those API versions is intentionally dropped here.

📜 Review details

Configuration used: CodeRabbit UI
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 c8c3588 and 2c850b9.

📒 Files selected for processing (1)
  • src/SCRIPTS/BF/PAGES/rx.lua (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:27-27
Timestamp: 2025-08-17T18:27:20.457Z
Learning: The Auto Smoothness setpoint field (id 31) in rx.lua uses max = 255 for firmware 4.3 and up, which corresponds to API version 1.47+.
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:35-35
Timestamp: 2025-08-17T18:27:06.194Z
Learning: In Betaflight firmware 4.3 and up (corresponding to apiVersion >= 1.44), the Auto Smoothness setpoint max value should be 255, not 50 or 250.
📚 Learning: 2025-08-17T18:27:20.457Z
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:27-27
Timestamp: 2025-08-17T18:27:20.457Z
Learning: The Auto Smoothness setpoint field (id 31) in rx.lua uses max = 255 for firmware 4.3 and up, which corresponds to API version 1.47+.

Applied to files:

  • src/SCRIPTS/BF/PAGES/rx.lua
📚 Learning: 2025-08-17T18:27:06.194Z
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:35-35
Timestamp: 2025-08-17T18:27:06.194Z
Learning: In Betaflight firmware 4.3 and up (corresponding to apiVersion >= 1.44), the Auto Smoothness setpoint max value should be 255, not 50 or 250.

Applied to files:

  • src/SCRIPTS/BF/PAGES/rx.lua
🔇 Additional comments (1)
src/SCRIPTS/BF/PAGES/rx.lua (1)

21-26: RC Smoothing (API ≥ 1.47) block looks correct

  • Good separation for 1.47+.
  • Setpoint (id 26) range 0–255 with “Auto” at 0 aligns with the firmware change.

Copy link

@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: 0

🧹 Nitpick comments (1)
src/SCRIPTS/BF/PAGES/rx.lua (1)

30-37: Optional: include “(AutoFactor)” for clarity if UI space allows

The PR description mentions “Setpoint AF (AutoFactor)”. If layout permits, consider the full label for discoverability.

-    fields[#fields + 1] = { t = "Setpoint AF",     x = x + indent*2, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 250, vals = { 31 } }
+    fields[#fields + 1] = { t = "Setpoint AF (AutoFactor)", x = x + indent*2, y = inc.y(lineSpacing), sp = x + sp, min = 0, max = 250, vals = { 31 } }
📜 Review details

Configuration used: CodeRabbit UI
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 2c850b9 and 261ce0a.

📒 Files selected for processing (1)
  • src/SCRIPTS/BF/PAGES/rx.lua (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:27-27
Timestamp: 2025-08-17T19:28:48.890Z
Learning: The Auto Smoothness setpoint field (rc_smoothing_auto_factor_rpy, id 31) in rx.lua uses max = 250 (range 0-250) in Betaflight firmware as defined by RC_SMOOTHING_AUTO_FACTOR_MAX constant in src/main/fc/rc.h, confirmed by firmware source code verification.
📚 Learning: 2025-08-17T19:28:48.890Z
Learnt from: haslinghuis
PR: betaflight/betaflight-tx-lua-scripts#527
File: src/SCRIPTS/BF/PAGES/rx.lua:27-27
Timestamp: 2025-08-17T19:28:48.890Z
Learning: The Auto Smoothness setpoint field (rc_smoothing_auto_factor_rpy, id 31) in rx.lua uses max = 250 (range 0-250) in Betaflight firmware as defined by RC_SMOOTHING_AUTO_FACTOR_MAX constant in src/main/fc/rc.h, confirmed by firmware source code verification.

Applied to files:

  • src/SCRIPTS/BF/PAGES/rx.lua
🔇 Additional comments (6)
src/SCRIPTS/BF/PAGES/rx.lua (6)

21-24: Correctly gated Interpolation/Interval to 1.20–1.42

Matches the stated removal in newer firmware and avoids surfacing controls for 4.3+.


26-28: Cam Angle addition for apiVersion ≥ 1.31 looks good

Field id 23 with 0–90 range is consistent with expected constraints.


30-37: RC Smoothing (≥1.47): Setpoint AF id 31 range 0–250 is correct

The rename to “Setpoint AF” and the 0–250 limit align with firmware constants (RC_SMOOTHING_AUTO_FACTOR_MAX = 250).


44-44: API 1.44–1.46: Setpoint AF id 31 range 0–250 confirmed

Consistent with firmware (0–250) and with the ≥1.47 branch.


45-55: Legacy 1.40–1.43 path is coherent and preserves older semantics

  • Keeps Type/Channels/Input/Derivative filters where applicable.
  • Adds Auto Smoothness for ≥1.42 with the expected 0–50 range (pre-4.3 behavior).

Looks good.


30-37: Verify ON/OFF mapping for Mode (id 25)
I’ve confirmed that in both the 1.47+ and 1.44+ branches of src/SCRIPTS/BF/PAGES/rx.lua, field 25 is rendered as { [0] = "ON", "OFF" } and there are no other ON/OFF definitions for id 25 elsewhere in the repo. Since many upstream protocols use 0=OFF, 1=ON, please double-check against the Betaflight/FRSKY spec to ensure these labels aren’t inverted.

If 0 should indeed mean OFF and 1 = ON, update both occurrences as follows:

-    fields[#fields + 1] = { t = "Mode", x = x + indent, y = inc.y(lineSpacing),
-        sp = x + sp, min = 0, max = 1, vals = { 25 }, table = { [0] = "ON",  "OFF" } }
+    fields[#fields + 1] = { t = "Mode", x = x + indent, y = inc.y(lineSpacing),
+        sp = x + sp, min = 0, max = 1, vals = { 25 }, table = { [0] = "OFF", "ON"  } }

• src/SCRIPTS/BF/PAGES/rx.lua @ lines 32 and 39

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.

2 participants