mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Halved motor_output_limit for 3D modes.
This commit is contained in:
parent
a3cf7e0cf7
commit
73d18ede66
2 changed files with 7 additions and 6 deletions
|
@ -381,23 +381,24 @@ void initEscEndpoints(void)
|
||||||
case PWM_TYPE_DSHOT300:
|
case PWM_TYPE_DSHOT300:
|
||||||
case PWM_TYPE_DSHOT150:
|
case PWM_TYPE_DSHOT150:
|
||||||
{
|
{
|
||||||
float outputLimitOffset = ((DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) * (1 - motorOutputLimit));
|
float outputLimitOffset = (DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) * (1 - motorOutputLimit);
|
||||||
disarmMotorOutput = DSHOT_CMD_MOTOR_STOP;
|
disarmMotorOutput = DSHOT_CMD_MOTOR_STOP;
|
||||||
if (featureIsEnabled(FEATURE_3D)) {
|
if (featureIsEnabled(FEATURE_3D)) {
|
||||||
motorOutputLow = DSHOT_MIN_THROTTLE + ((DSHOT_3D_FORWARD_MIN_THROTTLE - 1 - DSHOT_MIN_THROTTLE) / 100.0f) * CONVERT_PARAMETER_TO_PERCENT(motorConfig()->digitalIdleOffsetValue);
|
motorOutputLow = DSHOT_MIN_THROTTLE + ((DSHOT_3D_FORWARD_MIN_THROTTLE - 1 - DSHOT_MIN_THROTTLE) / 100.0f) * CONVERT_PARAMETER_TO_PERCENT(motorConfig()->digitalIdleOffsetValue);
|
||||||
|
motorOutputHigh = DSHOT_MAX_THROTTLE - outputLimitOffset / 2;
|
||||||
|
deadbandMotor3dHigh = DSHOT_3D_FORWARD_MIN_THROTTLE + ((DSHOT_MAX_THROTTLE - DSHOT_3D_FORWARD_MIN_THROTTLE) / 100.0f) * CONVERT_PARAMETER_TO_PERCENT(motorConfig()->digitalIdleOffsetValue);
|
||||||
|
deadbandMotor3dLow = DSHOT_3D_FORWARD_MIN_THROTTLE - 1 - outputLimitOffset / 2;
|
||||||
} else {
|
} else {
|
||||||
motorOutputLow = DSHOT_MIN_THROTTLE + ((DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) / 100.0f) * CONVERT_PARAMETER_TO_PERCENT(motorConfig()->digitalIdleOffsetValue);
|
motorOutputLow = DSHOT_MIN_THROTTLE + ((DSHOT_MAX_THROTTLE - DSHOT_MIN_THROTTLE) / 100.0f) * CONVERT_PARAMETER_TO_PERCENT(motorConfig()->digitalIdleOffsetValue);
|
||||||
}
|
|
||||||
motorOutputHigh = DSHOT_MAX_THROTTLE - outputLimitOffset;
|
motorOutputHigh = DSHOT_MAX_THROTTLE - outputLimitOffset;
|
||||||
deadbandMotor3dHigh = DSHOT_3D_FORWARD_MIN_THROTTLE + ((DSHOT_MAX_THROTTLE - DSHOT_3D_FORWARD_MIN_THROTTLE) / 100.0f) * CONVERT_PARAMETER_TO_PERCENT(motorConfig()->digitalIdleOffsetValue);
|
}
|
||||||
deadbandMotor3dLow = DSHOT_3D_FORWARD_MIN_THROTTLE - 1 - outputLimitOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
if (featureIsEnabled(FEATURE_3D)) {
|
if (featureIsEnabled(FEATURE_3D)) {
|
||||||
float outputLimitOffset = ((flight3DConfig()->limit3d_high - flight3DConfig()->limit3d_low) * (1 - motorOutputLimit));
|
float outputLimitOffset = (flight3DConfig()->limit3d_high - flight3DConfig()->limit3d_low) * (1 - motorOutputLimit) / 2;
|
||||||
disarmMotorOutput = flight3DConfig()->neutral3d;
|
disarmMotorOutput = flight3DConfig()->neutral3d;
|
||||||
motorOutputLow = flight3DConfig()->limit3d_low + outputLimitOffset;
|
motorOutputLow = flight3DConfig()->limit3d_low + outputLimitOffset;
|
||||||
motorOutputHigh = flight3DConfig()->limit3d_high - outputLimitOffset;
|
motorOutputHigh = flight3DConfig()->limit3d_high - outputLimitOffset;
|
||||||
|
|
|
@ -191,6 +191,7 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
.dterm_cut_gain = 15,
|
.dterm_cut_gain = 15,
|
||||||
.dterm_cut_range_hz = 40,
|
.dterm_cut_range_hz = 40,
|
||||||
.dterm_cut_lowpass_hz = 7,
|
.dterm_cut_lowpass_hz = 7,
|
||||||
|
.motor_output_limit = 100,
|
||||||
);
|
);
|
||||||
#ifdef USE_DYN_LPF
|
#ifdef USE_DYN_LPF
|
||||||
pidProfile->dterm_lowpass_hz = 150;
|
pidProfile->dterm_lowpass_hz = 150;
|
||||||
|
@ -202,7 +203,6 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
pidProfile->pid[PID_ROLL].D = 30;
|
pidProfile->pid[PID_ROLL].D = 30;
|
||||||
pidProfile->pid[PID_PITCH].D = 32;
|
pidProfile->pid[PID_PITCH].D = 32;
|
||||||
#endif
|
#endif
|
||||||
pidProfile->motor_output_limit = 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pgResetFn_pidProfiles(pidProfile_t *pidProfiles)
|
void pgResetFn_pidProfiles(pidProfile_t *pidProfiles)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue