Skip to content

Conversation

Williangalvani
Copy link
Member

@Williangalvani Williangalvani commented Aug 25, 2025

updating the enum with the newer joystick button functions in ArduSub

Summary by Sourcery

Update the BTN_FUNCTION enum to include new joystick mappings for running scripts and controlling servo channels 4–6.

New Features:

  • Add joystick button functions for script execution (SCRIPT_1 through SCRIPT_4)
  • Add joystick button functions for servo channels 4, 5, and 6 with min, max, center, increment, decrement, momentary, and toggle modes

Copy link

sourcery-ai bot commented Aug 25, 2025

Reviewer's Guide

This PR extends the BTN_FUNCTION enum by adding new joystick button mappings for script triggers and detailed servo controls for channels 4 through 6, aligning the frontend with recent ArduSub updates.

Class diagram for updated BTN_FUNCTION enum with new joystick button functions

classDiagram
    class BTN_FUNCTION {
        <<enum>>
        RELAY_2_MOMENTARY
        RELAY_3_MOMENTARY
        RELAY_4_MOMENTARY
        SCRIPT_1
        SCRIPT_2
        SCRIPT_3
        SCRIPT_4
        SERVO_4_MIN
        SERVO_4_MAX
        SERVO_4_CENTER
        SERVO_4_INC
        SERVO_4_DEC
        SERVO_4_MIN_MOMENTARY
        SERVO_4_MAX_MOMENTARY
        SERVO_4_MIN_TOGGLE
        SERVO_4_MAX_TOGGLE
        SERVO_5_MIN
        SERVO_5_MAX
        SERVO_5_CENTER
        SERVO_5_INC
        SERVO_5_DEC
        SERVO_5_MIN_MOMENTARY
        SERVO_5_MAX_MOMENTARY
        SERVO_5_MIN_TOGGLE
        SERVO_5_MAX_TOGGLE
        SERVO_6_MIN
        SERVO_6_MAX
        SERVO_6_CENTER
        SERVO_6_INC
        SERVO_6_DEC
        SERVO_6_MIN_MOMENTARY
        SERVO_6_MAX_MOMENTARY
        SERVO_6_MIN_TOGGLE
        SERVO_6_MAX_TOGGLE
    }
Loading

File-Level Changes

Change Details Files
Added joystick script button mappings
  • Introduced SCRIPT_1 through SCRIPT_4 entries
core/frontend/src/types/autopilot/parameter-sub-enums.ts
Added servo control functions for channels 4, 5, and 6
  • Added SERVO_4_* entries (MIN, MAX, CENTER, INC, DEC, MIN_MOMENTARY, MAX_MOMENTARY, MIN_TOGGLE, MAX_TOGGLE)
  • Added SERVO_5_* entries (MIN, MAX, CENTER, INC, DEC, MIN_MOMENTARY, MAX_MOMENTARY, MIN_TOGGLE, MAX_TOGGLE)
  • Added SERVO_6_* entries (MIN, MAX, CENTER, INC, DEC, MIN_MOMENTARY, MAX_MOMENTARY, MIN_TOGGLE, MAX_TOGGLE)
core/frontend/src/types/autopilot/parameter-sub-enums.ts

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

@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 there - I've reviewed your changes - here's some feedback:

  • Consider refactoring the repeated SERVO_N_* enum entries into a computed helper or generator pattern to reduce manual duplication and prevent potential indexing errors.
  • Double-check that the numeric values for SCRIPT and SERVO ranges exactly align with the upstream ArduSub definitions to avoid any off-by-one mismatches.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider refactoring the repeated SERVO_N_* enum entries into a computed helper or generator pattern to reduce manual duplication and prevent potential indexing errors.
- Double-check that the numeric values for SCRIPT and SERVO ranges exactly align with the upstream ArduSub definitions to avoid any off-by-one mismatches.

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.

@patrickelectric patrickelectric merged commit 62305d8 into bluerobotics:master Aug 25, 2025
6 checks passed
@ES-Alexander
Copy link
Collaborator

Relevant to #3501

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