From 63bacf04f8b08b5d9421bcf789171042adc7ab45 Mon Sep 17 00:00:00 2001 From: Kjell Kernen Date: Fri, 4 Apr 2014 14:41:09 +0200 Subject: [PATCH] This takes care of connection sources to the right channels. BUt I have a terribel feeling that I must be duplicating code. This code just has to exist somewhere. --- companion/src/eeprominterface.cpp | 9 +++++++++ companion/src/eeprominterface.h | 1 + companion/src/wizarddata.cpp | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 7bc945aef..6dd7bef7a 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -916,6 +916,15 @@ RawSource GeneralSettings::getDefaultSource(unsigned int channel) const return RawSource(SOURCE_TYPE_STICK, stick_index); } +int GeneralSettings::translateSource(unsigned int channel) const +{ + for(int i=0; i<4; i++){ + if (chout_ar[4*templateSetup + i]==(channel+1)) + return i; + } + return -1; +} + void FrSkyData::clear() { memset(this, 0, sizeof(FrSkyData)); diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index ef41134d2..e18902e74 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -417,6 +417,7 @@ class GeneralSettings { GeneralSettings(); RawSource getDefaultSource(unsigned int channel) const; + int translateSource(unsigned int channel) const; unsigned int version; unsigned int variant; diff --git a/companion/src/wizarddata.cpp b/companion/src/wizarddata.cpp index 7d0202e9c..ae8303b58 100644 --- a/companion/src/wizarddata.cpp +++ b/companion/src/wizarddata.cpp @@ -56,8 +56,8 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int MixData & mix = model.mixData[mixIndex++]; mix.destCh = channel+1; if (isTaranis){ - RawSource tmpSource = settings.getDefaultSource( input-1 ); - mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, tmpSource.index, &model); + int source = settings.translateSource(input-1); + mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, source, &model); } else mix.srcRaw = RawSource(SOURCE_TYPE_STICK, input-1);