Make cut use mixer instead of override (#5799)

Make cut use mixer instead of override
This commit is contained in:
3djc
2018-04-23 13:15:14 +02:00
committed by Bertrand Songis
parent 697403b841
commit 4f8f00c4e2
+12 -11
View File
@@ -98,7 +98,6 @@ WizMix::operator ModelData()
model.setDefaultInputs(settings); model.setDefaultInputs(settings);
int mixIndex = 0; int mixIndex = 0;
int switchIndex = 0;
int timerIndex = 0; int timerIndex = 0;
// Safe copy model name // Safe copy model name
@@ -109,20 +108,22 @@ WizMix::operator ModelData()
for (int i=0; i<WIZ_MAX_CHANNELS; i++ ) for (int i=0; i<WIZ_MAX_CHANNELS; i++ )
{ {
Channel ch = channel[i]; Channel ch = channel[i];
if (ch.input1 == THROTTLE_INPUT || ch.input2 == THROTTLE_INPUT)
throttleChannel = i;
addMix(model, ch.input1, ch.weight1, i, mixIndex); addMix(model, ch.input1, ch.weight1, i, mixIndex);
addMix(model, ch.input2, ch.weight2, i, mixIndex); addMix(model, ch.input2, ch.weight2, i, mixIndex);
}
// Add the Throttle Cut option if ((ch.input1 == THROTTLE_INPUT || ch.input2 == THROTTLE_INPUT) && options[THROTTLE_CUT_OPTION]) {
if( options[THROTTLE_CUT_OPTION] && throttleChannel >=0 ){ // Add the Throttle Cut option
model.customFn[switchIndex].swtch.type = SWITCH_TYPE_SWITCH; MixData & mix = model.mixData[mixIndex++];
model.customFn[switchIndex].swtch.index = IS_ARM(getCurrentBoard()) ? SWITCH_SF0 : SWITCH_THR; mix.destCh = i+1;
model.customFn[switchIndex].enabled = 1; mix.srcRaw = SOURCE_TYPE_MAX;
model.customFn[switchIndex].func = (AssignFunc)throttleChannel; mix.weight = -100;
model.customFn[switchIndex].param = -100; mix.swtch.type = SWITCH_TYPE_SWITCH;
mix.swtch.index = IS_ARM(getCurrentBoard()) ? SWITCH_SF0 : SWITCH_THR;
mix.mltpx = MLTPX_REP;
strncpy(mix.name, "Cut", MIXDATA_NAME_LEN);
mix.name[MIXDATA_NAME_LEN] = '\0';
}
} }
// Add the Flight Timer option // Add the Flight Timer option