Skip to content

[1.4-backport] only rename RCIN9/RCIN10 when relevant#3875

Merged
patrickelectric merged 1 commit intobluerobotics:1.4from
ES-Alexander:1.4-backport-lights-rename-fix
Apr 15, 2026
Merged

[1.4-backport] only rename RCIN9/RCIN10 when relevant#3875
patrickelectric merged 1 commit intobluerobotics:1.4from
ES-Alexander:1.4-backport-lights-rename-fix

Conversation

@ES-Alexander
Copy link
Copy Markdown
Collaborator

@ES-Alexander ES-Alexander commented Apr 15, 2026

Backport of #3860.

Summary by Sourcery

Make PWM setup treat RCIN9/RCIN10 as light controls only for legacy ArduSub firmware versions while preserving existing behavior for other vehicles and newer firmware.

New Features:

  • Add firmware-version-aware mapping of submarine PWM parameters to user-friendly labels.

Bug Fixes:

  • Restrict renaming of RCIN9 and RCIN10 to lights controls to legacy ArduSub versions that used these channels.

Note

Low Risk
Low risk UI-labeling change gated to ArduSub firmware versions <= 4.5.5; main risk is incorrect version parsing/comparison causing mislabeling.

Overview
Makes PWM setup’s user-friendly parameter naming firmware-version aware for ArduSub.

RCIN9/RCIN10 are now labeled as Lights 1/2 only when connected to legacy ArduSub firmware (<= 4.5.5), while newer ArduSub versions and other vehicle types keep their existing naming behavior.

Reviewed by Cursor Bugbot for commit afa77b1. Bugbot is set up for automated code reviews on this repo. Configure here.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Backports logic to only rename RCIN9/RCIN10 channel functions for ArduSub vehicles running firmware versions up to 4.5.5 by introducing a version-aware parameter map and semver-based comparison, ensuring newer firmware that handles lights natively is unaffected.

Class diagram for updated PwmSetup parameter mapping logic

classDiagram
  class PwmSetup {
    +effective_param_value_map() Dictionary
    +servo_function_parameters() Parameter[]
    +stringToUserFriendlyText(text string) string
  }

  class ParamValueMaps {
    +param_value_map Dictionary
    +legacy_sub_param_value_map Dictionary
    +LEGACY_SUB_LIGHTS_MAX_VERSION string
  }

  class SemVer {
    +sem_ver_lte(version string, maxVersion string) bool
  }

  PwmSetup --> ParamValueMaps : uses
  PwmSetup --> SemVer : uses
Loading

File-Level Changes

Change Details Files
Make RCIN9/RCIN10 lights renaming conditional on legacy ArduSub firmware version.
  • Import semver lte helper to compare firmware versions against a legacy cutoff
  • Introduce LEGACY_SUB_LIGHTS_MAX_VERSION and legacy_sub_param_value_map for older ArduSub light channel labels
  • Add computed effective_param_value_map that merges legacy Submarine labels only when vehicle is Sub and firmware version is <= 4.5.5
  • Update usages of param_value_map to use effective_param_value_map in both Submarine motor naming and generic user-friendly text conversion
core/frontend/src/components/vehiclesetup/PwmSetup.vue

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The comment on LEGACY_SUB_LIGHTS_MAX_VERSION says ArduSub <= 4.5.4 but the constant is set to '4.5.5' and used with sem_ver_lte, which includes 4.5.5; please either adjust the version or the comment/condition so they are consistent with the actual boundary you intend.
  • In effective_param_value_map, the logic branches on autopilot.firmware_info?.version, which is read from an imported singleton rather than Vue-reactive state; if the firmware version can change at runtime, consider wiring this through a reactive source so the computed map updates correctly.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The comment on `LEGACY_SUB_LIGHTS_MAX_VERSION` says ArduSub <= 4.5.4 but the constant is set to '4.5.5' and used with `sem_ver_lte`, which includes 4.5.5; please either adjust the version or the comment/condition so they are consistent with the actual boundary you intend.
- In `effective_param_value_map`, the logic branches on `autopilot.firmware_info?.version`, which is read from an imported singleton rather than Vue-reactive state; if the firmware version can change at runtime, consider wiring this through a reactive source so the computed map updates correctly.

## Individual Comments

### Comment 1
<location path="core/frontend/src/components/vehiclesetup/PwmSetup.vue" line_range="205-206" />
<code_context>
   },
 } as Dictionary<Dictionary<string>>

+// ArduSub <= 4.5.4 used RCIN9/RCIN10 for lights control; newer versions handle lights natively
+const LEGACY_SUB_LIGHTS_MAX_VERSION = '4.5.5'
+const legacy_sub_param_value_map: Dictionary<string> = {
+  RCIN9: 'Lights 1',
</code_context>
<issue_to_address>
**issue:** Align the legacy lights comment with the version boundary constant or adjust the boundary.

`LEGACY_SUB_LIGHTS_MAX_VERSION` is `'4.5.5'` and used with `sem_ver_lte`, so the legacy mapping currently applies through 4.5.5, not 4.5.4 as the comment suggests. Please either change the constant to `'4.5.4'` or update the comment so they describe the same version range.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread core/frontend/src/components/vehiclesetup/PwmSetup.vue Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6550963. Configure here.

Comment thread core/frontend/src/components/vehiclesetup/PwmSetup.vue
@ES-Alexander ES-Alexander force-pushed the 1.4-backport-lights-rename-fix branch from 6550963 to afa77b1 Compare April 15, 2026 00:56
@patrickelectric patrickelectric merged commit b77d91a into bluerobotics:1.4 Apr 15, 2026
8 checks passed
@ES-Alexander ES-Alexander deleted the 1.4-backport-lights-rename-fix branch April 15, 2026 14:19
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