mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 01:35:35 +03:00
Allow PASSTHROUGH for motor mixer as well - allow differential thrust mixing for airplanes
This commit is contained in:
parent
35fd7e9b14
commit
9a46e56ba3
1 changed files with 20 additions and 6 deletions
|
@ -416,11 +416,25 @@ void stopPwmAllMotors()
|
||||||
|
|
||||||
void mixTable(void)
|
void mixTable(void)
|
||||||
{
|
{
|
||||||
|
int16_t input[3]; // RPY, range [-500:+500]
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (motorCount >= 4 && mixerConfig()->yaw_jump_prevention_limit < YAW_JUMP_PREVENTION_LIMIT_HIGH) {
|
// Allow direct stick input to motors in passthrough mode on airplanes
|
||||||
// prevent "yaw jump" during yaw correction
|
if (STATE(FIXED_WING) && FLIGHT_MODE(PASSTHRU_MODE)) {
|
||||||
axisPID[YAW] = constrain(axisPID[YAW], -mixerConfig()->yaw_jump_prevention_limit - ABS(rcCommand[YAW]), mixerConfig()->yaw_jump_prevention_limit + ABS(rcCommand[YAW]));
|
// Direct passthru from RX
|
||||||
|
input[ROLL] = rcCommand[ROLL];
|
||||||
|
input[PITCH] = rcCommand[PITCH];
|
||||||
|
input[YAW] = rcCommand[YAW];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
input[ROLL] = axisPID[ROLL];
|
||||||
|
input[PITCH] = axisPID[PITCH];
|
||||||
|
input[YAW] = axisPID[YAW];
|
||||||
|
|
||||||
|
if (motorCount >= 4 && mixerConfig()->yaw_jump_prevention_limit < YAW_JUMP_PREVENTION_LIMIT_HIGH) {
|
||||||
|
// prevent "yaw jump" during yaw correction
|
||||||
|
input[YAW] = constrain(input[YAW], -mixerConfig()->yaw_jump_prevention_limit - ABS(rcCommand[YAW]), mixerConfig()->yaw_jump_prevention_limit + ABS(rcCommand[YAW]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial mixer concept by bdoiron74 reused and optimized for Air Mode
|
// Initial mixer concept by bdoiron74 reused and optimized for Air Mode
|
||||||
|
@ -431,9 +445,9 @@ void mixTable(void)
|
||||||
// motors for non-servo mixes
|
// motors for non-servo mixes
|
||||||
for (i = 0; i < motorCount; i++) {
|
for (i = 0; i < motorCount; i++) {
|
||||||
rpyMix[i] =
|
rpyMix[i] =
|
||||||
axisPID[PITCH] * currentMixer[i].pitch +
|
input[PITCH] * currentMixer[i].pitch +
|
||||||
axisPID[ROLL] * currentMixer[i].roll +
|
input[ROLL] * currentMixer[i].roll +
|
||||||
-mixerConfig()->yaw_motor_direction * axisPID[YAW] * currentMixer[i].yaw;
|
-mixerConfig()->yaw_motor_direction * input[YAW] * currentMixer[i].yaw;
|
||||||
|
|
||||||
if (rpyMix[i] > rpyMixMax) rpyMixMax = rpyMix[i];
|
if (rpyMix[i] > rpyMixMax) rpyMixMax = rpyMix[i];
|
||||||
if (rpyMix[i] < rpyMixMin) rpyMixMin = rpyMix[i];
|
if (rpyMix[i] < rpyMixMin) rpyMixMin = rpyMix[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue