1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

maybe more efficient?

This commit is contained in:
ctzsnooze 2020-09-13 12:11:09 +10:00
parent 73663f7fae
commit 0833aab886

View file

@ -102,19 +102,21 @@ FAST_CODE_NOINLINE float interpolatedSpApply(int axis, bool newRcFrame, ffInterp
} }
} else { } else {
// we have movement; let's consider what happened on previous packets, using ffStatus // we have movement; let's consider what happened on previous packets, using ffStatus
if (ffStatus[axis] == 1) { if (ffStatus[axis] != 0) {
// was interpolated forward after previous dropped packet after small step if (ffStatus[axis] == 1) {
// this step is likely twice as tall as it should be // was interpolated forward after previous dropped packet after small step
setpointSpeed = setpointSpeed / 2.0f; // this step is likely twice as tall as it should be
} else if (ffStatus[axis] == 2) { setpointSpeed = setpointSpeed / 2.0f;
// we are doing nothing for these to avoid exaggerating the FrSky early packet problem } else if (ffStatus[axis] == 2) {
} else if (ffStatus[axis] == 3) { // we are doing nothing for these to avoid exaggerating the FrSky early packet problem
// movement after nothing on previous two packets } else if (ffStatus[axis] == 3) {
// reduce boost when higher averaging is used to improve slow stick smoothness // movement after nothing on previous two packets
setpointAccelerationModifier /= (averagingCount + 1); // reduce boost when higher averaging is used to improve slow stick smoothness
setpointAccelerationModifier /= (averagingCount + 1);
}
ffStatus[axis] = 0;
// all is normal
} }
ffStatus[axis] = 0;
// all is normal
} }
float setpointAcceleration = setpointSpeed - prevSetpointSpeed[axis]; float setpointAcceleration = setpointSpeed - prevSetpointSpeed[axis];