From aecd7d15f1001257cbb61c4dc021a7d1488d3ad7 Mon Sep 17 00:00:00 2001 From: 3djc Date: Thu, 16 Feb 2017 09:19:34 +0100 Subject: [PATCH] Fix companion wizard behavior for Horus (#4467) * Fix wizard behavior for Horus (was treated like an 9X) * Cosmetics --- companion/src/wizarddata.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/companion/src/wizarddata.cpp b/companion/src/wizarddata.cpp index 0b5f4c39e..bfed27032 100644 --- a/companion/src/wizarddata.cpp +++ b/companion/src/wizarddata.cpp @@ -33,7 +33,7 @@ void Channel::clear() prebooked = false; input1 = NO_INPUT; input2 = NO_INPUT; - weight1 = 0; + weight1 = 0; weight2 = 0; } @@ -60,12 +60,11 @@ void WizMix::maxMixSwitch(char *name, MixData &mix, int channel, int sw, int wei void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int & mixIndex) { if (input != NO_INPUT) { - bool isTaranis = IS_TARANIS(getCurrentBoard()); - + bool isHorusOrTaranis = IS_HORUS_OR_TARANIS(getCurrentBoard()); if (input >= RUDDER_INPUT && input <= AILERONS_INPUT) { MixData & mix = model.mixData[mixIndex++]; mix.destCh = channel+1; - if (isTaranis){ + if (isHorusOrTaranis){ int channel = settings.getDefaultChannel(input-1); mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel); } @@ -75,13 +74,13 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int } else if (input==FLAPS_INPUT){ // There ought to be some kind of constants for switches somewhere... - maxMixSwitch((char *)"Flaps Up", model.mixData[mixIndex++], channel+1, isTaranis ? SWITCH_SA0 :-SWITCH_ELE , weight); //Taranis SA-UP, 9X ELE-UP - maxMixSwitch((char *)"Flaps Dn", model.mixData[mixIndex++], channel+1, isTaranis ? SWITCH_SA2 : SWITCH_ELE , -weight); //Taranis SA-DOWN, 9X ELE-DOWN + maxMixSwitch((char *)"Flaps Up", model.mixData[mixIndex++], channel+1, isHorusOrTaranis ? SWITCH_SA0 :-SWITCH_ELE , weight); //Taranis-Horus SA-UP, 9X ELE-UP + maxMixSwitch((char *)"Flaps Dn", model.mixData[mixIndex++], channel+1, isHorusOrTaranis ? SWITCH_SA2 : SWITCH_ELE , -weight); //Taranis-Horus SA-DOWN, 9X ELE-DOWN } - else if (input==AIRBRAKES_INPUT){ - maxMixSwitch((char *)"AirbkOff", model.mixData[mixIndex++], channel+1, isTaranis ? SWITCH_SE0 :-SWITCH_RUD , -weight); //Taranis SE-UP, 9X RUD-UP - maxMixSwitch((char *)"AirbkOn", model.mixData[mixIndex++], channel+1, isTaranis ? SWITCH_SE2 : SWITCH_RUD , weight); //Tatanis SE-DOWN, 9X RUD-DOWN + else if (input==AIRBRAKES_INPUT){ + maxMixSwitch((char *)"AirbkOff", model.mixData[mixIndex++], channel+1, isHorusOrTaranis ? SWITCH_SE0 :-SWITCH_RUD , -weight); //Taranis-Horus SE-UP, 9X RUD-UP + maxMixSwitch((char *)"AirbkOn", model.mixData[mixIndex++], channel+1, isHorusOrTaranis ? SWITCH_SE2 : SWITCH_RUD , weight); //Tatanis-Horus SE-DOWN, 9X RUD-DOWN } } } @@ -89,7 +88,6 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int WizMix::operator ModelData() { int throttleChannel = -1; - bool isTaranis = IS_TARANIS(getCurrentBoard()); ModelData model; model.used = true; @@ -105,7 +103,7 @@ WizMix::operator ModelData() model.name[WIZ_MODEL_NAME_LENGTH] = 0; // Add the channel mixes - for (int i=0; i=0 ){ model.customFn[switchIndex].swtch.type = SWITCH_TYPE_SWITCH; - model.customFn[switchIndex].swtch.index = isTaranis ? SWITCH_SF0 : SWITCH_THR; + model.customFn[switchIndex].swtch.index = IS_HORUS_OR_TARANIS(getCurrentBoard()) ? SWITCH_SF0 : SWITCH_THR; model.customFn[switchIndex].enabled = 1; model.customFn[switchIndex].func = (AssignFunc)throttleChannel; model.customFn[switchIndex].param = -100; @@ -140,5 +138,3 @@ WizMix::operator ModelData() return model; } - -