Fix companion wizard behavior for Horus (#4467)

* Fix wizard behavior for Horus (was treated like an 9X)

* Cosmetics
This commit is contained in:
3djc
2017-02-16 09:19:34 +01:00
committed by Bertrand Songis
parent ee43d3fb97
commit aecd7d15f1
+10 -14
View File
@@ -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<WIZ_MAX_CHANNELS; i++ )
for (int i=0; i<WIZ_MAX_CHANNELS; i++ )
{
Channel ch = channel[i];
if (ch.input1 == THROTTLE_INPUT || ch.input2 == THROTTLE_INPUT)
@@ -118,7 +116,7 @@ WizMix::operator ModelData()
// Add the Throttle Cut option
if( options[THROTTLE_CUT_OPTION] && throttleChannel >=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;
}