⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Feb 9, 2026

User description

Summary

Fix a safety issue where reversed throttle servos and servos with negative mixer weights go to the wrong position when disarmed.

When disarmed, the servo mixer was unconditionally overwriting servo outputs with motorConfig()->mincommand (typically 1000µs) for any servo with a throttle mixer rule. This ignored servo reversal (negative servoParams rate) and negative mixer weights, causing certain servo configurations to output full throttle instead of minimum on disarm.

Changes

  • Force throttle inputs (INPUT_STABILIZED_THROTTLE and INPUT_RC_THROTTLE) to -500 (minimum) before the mixer loop when disarmed, so the existing mixer pipeline correctly computes safe positions accounting for servo reversal and negative weights
  • Remove the post-hoc override at the end of servoMixer() that was setting servo[target] = motorConfig()->mincommand

Testing

Tested with SITL using automated MSP test script covering 5 scenarios:

Scenario Before (Bug) After (Fix) Expected
Normal servo + normal weight 1000 1000 1000
Reversed servo + normal weight 1000 2000 2000
Normal servo + negative weight 1000 2000 2000
Reversed + negative (double inversion) 1000 1000 1000
Non-throttle servo (pitch only) 1500 1500 1500

All 5 tests pass after the fix. The two previously failing cases (reversed servo, negative weight) now correctly compute the safe position.

Built successfully for SITL, MATEKF405, and SPEEDYBEEF405WING.


PR Type

Bug fix


Description

  • Fixes safety issue where reversed throttle servos output wrong position when disarmed

  • Forces throttle inputs to minimum before mixer pipeline instead of post-hoc override

  • Ensures servo reversal and negative mixer weights are correctly accounted for

  • Removes broken unconditional mincommand override that ignored servo configuration


Diagram Walkthrough

flowchart LR
  A["Disarmed State"] --> B["Force Throttle Inputs to -500"]
  B --> C["Mixer Pipeline Processes Inputs"]
  C --> D["Applies Servo Reversal & Weights"]
  D --> E["Correct Safe Position Output"]
  F["Old Approach: Post-hoc Override"] -.->|removed| G["Ignored Reversal & Weights"]
Loading

File Walkthrough

Relevant files
Bug fix
servos.c
Replace post-hoc override with input forcing                         

src/main/flight/servos.c

  • Added logic to force throttle inputs (INPUT_STABILIZED_THROTTLE and
    INPUT_RC_THROTTLE) to -500 when disarmed, before the mixer loop
    executes
  • Removed the broken post-hoc override that unconditionally set servo
    outputs to motorConfig()->mincommand for throttle-mixed servos
  • This allows the existing mixer pipeline to correctly compute safe
    positions accounting for servo reversal and negative mixer weights
+10/-13 

When disarmed, the servo mixer was unconditionally setting servo outputs
to motorConfig()->mincommand for any servo with a throttle mixer rule.
This ignored servo reversal (negative servoParams rate) and negative
mixer weights, causing reversed throttle servos to go to full output
instead of minimum on disarm - a safety hazard.

Fix by forcing throttle inputs to minimum (-500) before the mixer loop
so the normal pipeline correctly computes safe positions accounting for
reversal and negative weights. Remove the broken post-hoc override.
@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

@sensei-hacker sensei-hacker added this to the 9.1 milestone Feb 9, 2026
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.

1 participant