Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Jul 6, 2025

PR Type

Enhancement


Description

  • Add gimbal sensitivity control via programming framework

  • Fix gimbal trim data types from uint16_t to int16_t

  • Enable runtime gimbal sensitivity adjustment through logic conditions


Changes diagram

flowchart LR
  A["Programming Framework"] --> B["Logic Condition 55"]
  B --> C["setGimbalSensitivity()"]
  C --> D["gimbalConfigMutable()"]
  D --> E["Gimbal Sensitivity Updated"]
Loading

Changes walkthrough 📝

Relevant files
Enhancement
gimbal_common.c
Add gimbal sensitivity setter function                                     

src/main/drivers/gimbal_common.c

  • Add setGimbalSensitivity() function to update gimbal sensitivity at
    runtime
  • +5/-0     
    gimbal_common.h
    Update gimbal config types and add function declaration   

    src/main/drivers/gimbal_common.h

  • Change gimbal trim fields from uint16_t to int16_t for signed values
  • Add function declaration for setGimbalSensitivity()
  • +4/-3     
    logic_condition.c
    Implement gimbal sensitivity logic condition                         

    src/main/programming/logic_condition.c

  • Include gimbal_common.h header
  • Add LOGIC_CONDITION_SET_GIMBAL_SENSITIVITY case handler
  • Implement gimbal sensitivity setting with value constraints
  • +11/-0   
    logic_condition.h
    Add gimbal sensitivity logic condition enum                           

    src/main/programming/logic_condition.h

  • Add LOGIC_CONDITION_SET_GIMBAL_SENSITIVITY enum value (55)
  • Increment LOGIC_CONDITION_LAST to 56
  • +2/-1     
    Documentation
    Programming Framework.md
    Document gimbal sensitivity programming feature                   

    docs/Programming Framework.md

  • Document new logic condition 55 for gimbal sensitivity
  • Specify operand A range from -16 to 15
  • +1/-0     
    Configuration changes
    settings.yaml
    Specify explicit types for gimbal settings                             

    src/main/fc/settings.yaml

  • Add explicit int8_t type for gimbal_sensitivity setting
  • Add explicit int16_t type for gimbal trim settings
  • +3/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @sensei-hacker sensei-hacker marked this pull request as ready for review July 6, 2025 21:07
    @sensei-hacker sensei-hacker merged commit 832ed32 into iNavFlight:maintenance-8.x.x Jul 6, 2025
    44 checks passed
    @qodo-code-review
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Constants

    The code uses SETTING_GIMBAL_SENSITIVITY_MIN and SETTING_GIMBAL_SENSITIVITY_MAX constants in the constrain function, but these constants are not defined or imported in the visible code changes. This could cause compilation errors.

    setGimbalSensitivity(constrain(operandA, SETTING_GIMBAL_SENSITIVITY_MIN, SETTING_GIMBAL_SENSITIVITY_MAX));
    return true;
    Incomplete Documentation

    The documentation for logic condition 55 appears incomplete - the description ends abruptly with "Scales Operand A from [-16 : 15]" without explaining what the function does or its expected behavior.

    | 55            | Set Gimbal Sensitivity        | Scales `Operand A` from [`-16` : `15`]
    

    @qodo-code-review
    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Remove unreachable break statement

    The break statement after return true is unreachable code. Remove the break
    statement since the function returns before reaching it.

    src/main/programming/logic_condition.c [347-354]

     case LOGIC_CONDITION_SET_GIMBAL_SENSITIVITY:
     #ifdef USE_SERIAL_GIMBAL
         setGimbalSensitivity(constrain(operandA, SETTING_GIMBAL_SENSITIVITY_MIN, SETTING_GIMBAL_SENSITIVITY_MAX));
         return true;
    -    break;
     #else
         return false;
     #endif
    • Apply / Chat
    Suggestion importance[1-10]: 4

    __

    Why: The suggestion correctly identifies that the break statement on line 351 is unreachable due to the preceding return statement, and removing it improves code quality.

    Low
    Complete incomplete documentation sentence

    The documentation line is incomplete and missing proper formatting. Complete the
    sentence with a period and ensure consistent table formatting.

    docs/Programming Framework.md [104]

    -| 55            | Set Gimbal Sensitivity        | Scales `Operand A` from [`-16` : `15`]
    +| 55            | Set Gimbal Sensitivity        | Scales `Operand A` from [`-16` : `15`]. |
    • Apply / Chat
    Suggestion importance[1-10]: 3

    __

    Why: The suggestion correctly points out missing table formatting (a closing pipe |) and a period, improving documentation consistency and readability.

    Low
    • More

    @error414 error414 deleted the change-gimbal-sensitivity-from-programming-framework branch October 14, 2025 18:21
    @MrD-RC MrD-RC added this to the 9.0 milestone Oct 26, 2025
    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.

    3 participants