mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 16:25:26 +03:00
Correctly handle reversible motors in mixer
This commit is contained in:
parent
9b146470a9
commit
0ffcac2974
11 changed files with 105 additions and 33 deletions
|
@ -99,12 +99,19 @@ bool areSticksDeflectedMoreThanPosHoldDeadband(void)
|
|||
return (ABS(rcCommand[ROLL]) > rcControlsConfig()->pos_hold_deadband) || (ABS(rcCommand[PITCH]) > rcControlsConfig()->pos_hold_deadband);
|
||||
}
|
||||
|
||||
throttleStatus_e calculateThrottleStatus(void)
|
||||
throttleStatus_e calculateThrottleStatus(throttleStatusType_e type)
|
||||
{
|
||||
int value;
|
||||
if (type == THROTTLE_STATUS_TYPE_RC) {
|
||||
value = rxGetChannelValue(THROTTLE);
|
||||
} else {
|
||||
value = rcCommand[THROTTLE];
|
||||
}
|
||||
|
||||
const uint16_t mid_throttle_deadband = rcControlsConfig()->mid_throttle_deadband;
|
||||
if (feature(FEATURE_REVERSIBLE_MOTORS) && (rxGetChannelValue(THROTTLE) > (PWM_RANGE_MIDDLE - mid_throttle_deadband) && rxGetChannelValue(THROTTLE) < (PWM_RANGE_MIDDLE + mid_throttle_deadband)))
|
||||
if (feature(FEATURE_REVERSIBLE_MOTORS) && (value > (PWM_RANGE_MIDDLE - mid_throttle_deadband) && value < (PWM_RANGE_MIDDLE + mid_throttle_deadband)))
|
||||
return THROTTLE_LOW;
|
||||
else if (!feature(FEATURE_REVERSIBLE_MOTORS) && (rxGetChannelValue(THROTTLE) < rxConfig()->mincheck))
|
||||
else if (!feature(FEATURE_REVERSIBLE_MOTORS) && (value < rxConfig()->mincheck))
|
||||
return THROTTLE_LOW;
|
||||
|
||||
return THROTTLE_HIGH;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue