mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 06:13:33 +08:00
fix(dshot): send motor stop for 3D mode deadzone instead of min throttle
In DShot 3D mode, convert_output_to_3d_scaling() returns DSHOT_DISARM_VALUE (0) for deadzone inputs. But up_dshot_motor_data_set() adds the MIN_throttle offset (+48), causing motors to spin at minimum throttle instead of stopping. Check the result of calculate_output_value() for DSHOT_DISARM_VALUE and send an explicit motor stop command, bypassing the +48 offset.
This commit is contained in:
@@ -368,7 +368,15 @@ void DShot::update_motor_outputs(uint16_t outputs[MAX_ACTUATORS], int num_output
|
||||
up_dshot_motor_command(i, DSHOT_CMD_MOTOR_STOP, set_telemetry_bit);
|
||||
|
||||
} else {
|
||||
up_dshot_motor_data_set(i, calculate_output_value(outputs[i], i), set_telemetry_bit);
|
||||
uint16_t output = calculate_output_value(outputs[i], i);
|
||||
|
||||
// 3D deadzone: send motor stop to avoid MIN_throttle offset in up_dshot_motor_data_set
|
||||
if (output == DSHOT_DISARM_VALUE) {
|
||||
up_dshot_motor_command(i, DSHOT_CMD_MOTOR_STOP, set_telemetry_bit);
|
||||
|
||||
} else {
|
||||
up_dshot_motor_data_set(i, output, set_telemetry_bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user