From 833585002b7703504ef848771303a82d3a2a1756 Mon Sep 17 00:00:00 2001 From: Kjell Kernen Date: Mon, 28 Apr 2014 15:43:10 +0200 Subject: [PATCH] Forgot these files in last commit --- companion/src/wizarddata.cpp | 35 ++++++++++++++++++++++++++++++----- companion/src/wizarddata.h | 4 ++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/companion/src/wizarddata.cpp b/companion/src/wizarddata.cpp index 28b028cd1..8b43edd9e 100644 --- a/companion/src/wizarddata.cpp +++ b/companion/src/wizarddata.cpp @@ -67,35 +67,60 @@ 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 ? 1 :-3 , weight); //SA-UP or ELE-UP - maxMixSwitch((char *)"Flaps Down", model.mixData[mixIndex++], channel+1, isTaranis ? 3 : 3 , -weight); //SA-DOWN or ELE-DOWN + maxMixSwitch((char *)"Flaps Up", model.mixData[mixIndex++], channel+1, isTaranis ? 1 :-3 , weight); //Taranis SA-UP, 9X ELE-UP + maxMixSwitch((char *)"Flaps Down", model.mixData[mixIndex++], channel+1, isTaranis ? 3 : 3 , -weight); //Taranis SA-DOWN, 9X ELE-DOWN } else if (input==AIRBRAKES_INPUT){ - maxMixSwitch((char *)"Airbrk Off", model.mixData[mixIndex++], channel+1, isTaranis ? 13 :-2 , -weight); //SE-UP or RUD-UP - maxMixSwitch((char *)"Airbrk On", model.mixData[mixIndex++], channel+1, isTaranis ? 15 : 2 , weight); //SE-DOWN or RUD-DOWN + maxMixSwitch((char *)"Airbrk Off", model.mixData[mixIndex++], channel+1, isTaranis ? 13 :-2 , -weight); //Taranis SE-UP, 9X RUD-UP + maxMixSwitch((char *)"Airbrk On", model.mixData[mixIndex++], channel+1, isTaranis ? 15 : 2 , weight); //Tatanis SE-DOWN, 9X RUD-DOWN } } } WizMix::operator ModelData() { + int throttleChannel = -1; + bool isTaranis = IS_TARANIS(GetEepromInterface()->getBoard()); + ModelData model; model.used = true; model.modelId = modelId; model.setDefaultInputs(settings); + int mixIndex = 0; + int switchIndex = 0; + int timerIndex = 0; + // Safe copy model name strncpy(model.name, name, WIZ_MODEL_NAME_LENGTH); model.name[WIZ_MODEL_NAME_LENGTH] = 0; - int mixIndex = 0; + // Add the channel mixes for (int i=0; i=0 ){ + model.funcSw[switchIndex].swtch.type = SWITCH_TYPE_SWITCH; + model.funcSw[switchIndex].swtch.index = isTaranis ? 16 : 1; // Taranis SF-UP, 9X THR-UP + model.funcSw[switchIndex].enabled = 1; + model.funcSw[switchIndex].func = (AssignFunc)throttleChannel; + } + + // Add the Throttle Timer option + if (options[THROTTLE_TIMER_OPTION] && throttleChannel >=0 ){ + model.timers[timerIndex].mode.type = SWITCH_TYPE_SWITCH; + model.timers[timerIndex].mode.index = isTaranis ? -16 : -1; // Taranis !SF-UP, 9X THR-DOWN + timerIndex++; + } return model; } diff --git a/companion/src/wizarddata.h b/companion/src/wizarddata.h index 19e421404..72b9d9fbb 100644 --- a/companion/src/wizarddata.h +++ b/companion/src/wizarddata.h @@ -41,8 +41,8 @@ enum Vehicle { }; enum Options { - THROTTLE_CUT, - THROTTLE_TIMER + THROTTLE_CUT_OPTION, + THROTTLE_TIMER_OPTION }; enum WizardPage {