mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
max rate independent of deadband
This commit is contained in:
parent
d9fedb5024
commit
04e5e3bf24
1 changed files with 4 additions and 2 deletions
|
@ -244,8 +244,9 @@ static void calculateSetpointRate(int axis)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
const uint8_t deadband = axis == FD_YAW ? rcControlsConfig()->yaw_deadband : rcControlsConfig()->deadband;
|
||||||
// scale rcCommandf to range [-1.0, 1.0]
|
// scale rcCommandf to range [-1.0, 1.0]
|
||||||
float rcCommandf = rcCommand[axis] / 500.0f;
|
float rcCommandf = rcCommand[axis] / (500.0f - deadband);
|
||||||
rcDeflection[axis] = rcCommandf;
|
rcDeflection[axis] = rcCommandf;
|
||||||
const float rcCommandfAbs = fabsf(rcCommandf);
|
const float rcCommandfAbs = fabsf(rcCommandf);
|
||||||
rcDeflectionAbs[axis] = rcCommandfAbs;
|
rcDeflectionAbs[axis] = rcCommandfAbs;
|
||||||
|
@ -684,7 +685,8 @@ FAST_CODE void processRcCommand(void)
|
||||||
if (isRxDataNew) {
|
if (isRxDataNew) {
|
||||||
for (int i = FD_ROLL; i <= FD_YAW; i++) {
|
for (int i = FD_ROLL; i <= FD_YAW; i++) {
|
||||||
oldRcCommand[i] = rcCommand[i];
|
oldRcCommand[i] = rcCommand[i];
|
||||||
const float rcCommandf = rcCommand[i] / 500.0f;
|
const uint8_t deadband = i == FD_YAW ? rcControlsConfig()->yaw_deadband : rcControlsConfig()->deadband;
|
||||||
|
const float rcCommandf = rcCommand[i] / (500.0f - deadband);
|
||||||
const float rcCommandfAbs = fabsf(rcCommandf);
|
const float rcCommandfAbs = fabsf(rcCommandf);
|
||||||
rawSetpoint[i] = applyRates(i, rcCommandf, rcCommandfAbs);
|
rawSetpoint[i] = applyRates(i, rcCommandf, rcCommandfAbs);
|
||||||
rawDeflection[i] = rcCommandf;
|
rawDeflection[i] = rcCommandf;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue