Skip to content

Commit

Permalink
3D-mode fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter committed Jun 15, 2024
1 parent 94e9f5a commit bfec265
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/flight/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,29 +865,29 @@ void mixThingsUp(const float scaledAxisPidRoll, const float scaledAxisPidPitch,
float controllerMixMin = 0, controllerMixMax = 0;

for (int i = 0; i < motorCount; i++) {
float yawMixVal = controllerMix3DModeSign * scaledAxisPidYaw * currentMixer[i].yaw;
float yawMixVal = scaledAxisPidYaw * currentMixer[i].yaw;
if (yawMixVal > yawMixMax) {
yawMixMax = yawMixVal;
} else if (yawMixVal < yawMixMin) {
yawMixMin = yawMixVal;
}
yawMix[i] = yawMixVal;
yawMix[i] = yawMixVal * controllerMix3DModeSign;

float rollPitchMixVal = scaledAxisPidRoll * currentMixer[i].roll + scaledAxisPidPitch * currentMixer[i].pitch;
if (rollPitchMixVal > rollPitchMixMax) {
rollPitchMixMax = rollPitchMixVal;
} else if (rollPitchMixVal < rollPitchMixMin) {
rollPitchMixMin = rollPitchMixVal;
}
rollPitchMix[i] = rollPitchMixVal;
rollPitchMix[i] = rollPitchMixVal * controllerMix3DModeSign;

float controllerMixVal = controllerMix3DModeSign * (rollPitchMixVal + yawMixVal);
float controllerMixVal = (rollPitchMixVal + yawMixVal);
if (controllerMixVal > controllerMixMax) {
controllerMixMax = controllerMixVal;
} else if (controllerMixVal < controllerMixMin) {
controllerMixMin = controllerMixVal;
}
controllerMix[i] = controllerMixVal;
controllerMix[i] = controllerMixVal * controllerMix3DModeSign;
}

controllerMixRange = controllerMixMax - controllerMixMin; // measures how much the controller is trying to compensate
Expand Down

0 comments on commit bfec265

Please sign in to comment.