1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Optimize processRcCommand()

This commit is contained in:
borisbstyle 2017-01-14 23:52:13 +01:00
parent 05e5beee7e
commit f3d2b37959

View file

@ -253,21 +253,23 @@ void processRcCommand(void)
}
// Interpolate steps of rcCommand
for (int channel=ROLL; channel < interpolationChannels; channel++) {
if (factor > 0) {
int channel;
if (factor > 0) {
for (channel=ROLL; channel < interpolationChannels; channel++)
rcCommand[channel] = lastCommand[channel] - deltaRC[channel] * factor/rcInterpolationFactor;
readyToCalculateRateAxisCnt = MAX(channel, FD_YAW); // throttle channel doesn't require rate calculation
} else {
factor = 0;
}
} else {
factor = 0;
}
readyToCalculateRateAxisCnt = MAX(channel, FD_YAW); // throttle channel doesn't require rate calculation
readyToCalculateRate = true;
} else {
factor = 0; // reset factor in case of level modes flip flopping
readyToCalculateRateAxisCnt = FD_YAW;
}
if (readyToCalculateRate || isRXDataNew) {
if (isRXDataNew)
readyToCalculateRateAxisCnt = FD_YAW;
// Scaling of AngleRate to camera angle (Mixing Roll and Yaw)
if (rxConfig()->fpvCamAngleDegrees && IS_RC_MODE_ACTIVE(BOXFPVANGLEMIX) && !FLIGHT_MODE(HEADFREE_MODE))
scaleRcCommandToFpvCamAngle();