diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 60f3f1324..711b68764 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -795,7 +795,8 @@ GeneralSettings::GeneralSettings() int potsnum=GetEepromInterface()->getCapability(Pots); if (t_calib.isEmpty()) { return; - } else { + } + else { QString t_trainercalib=g.profile[g.id()].trainerCalib(); int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib(); int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib(); @@ -891,6 +892,12 @@ GeneralSettings::GeneralSettings() } +RawSource GeneralSettings::getDefaultSource(unsigned int channel) +{ + unsigned int stick_index = chout_ar[4*templateSetup + channel] - 1; + return RawSource(SOURCE_TYPE_STICK, stick_index); +} + ModelData::ModelData() { clear(); @@ -930,7 +937,7 @@ void ModelData::clear() moduleData[0].ppmDelay = 300; moduleData[1].ppmDelay = 300; moduleData[2].ppmDelay = 300; - int board=GetEepromInterface()->getBoard(); + int board = GetEepromInterface()->getBoard(); if (IS_TARANIS(board)) { moduleData[0].protocol=PXX_XJT_X16; moduleData[1].protocol=OFF; @@ -964,12 +971,38 @@ bool ModelData::isempty() return !used; } -void ModelData::setDefault(uint8_t id) +void ModelData::setDefaultMixes(GeneralSettings & settings) +{ + if (IS_TARANIS(GetEepromInterface()->getBoard())) { + for (int i=0; ichn = i; + expo->mode = INPUT_MODE_BOTH; + expo->srcRaw = settings.getDefaultSource(i); + expo->weight = 100; + strncpy(inputNames[i], expo->srcRaw.toString().toLatin1().constData(), sizeof(inputNames[i])-1); + MixData * mix = &mixData[i]; + mix->destCh = i+1; + mix->weight = 100; + mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this); + } + } + else { + for (int i=0; i template setup, Second is relevant channel out -1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2, -2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1, -3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1, -4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1 }; // TODO delete it? + 1,2,3,4 , 1,2,4,3 , 1,3,2,4 , 1,3,4,2 , 1,4,2,3 , 1,4,3,2, + 2,1,3,4 , 2,1,4,3 , 2,3,1,4 , 2,3,4,1 , 2,4,1,3 , 2,4,3,1, + 3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1, + 4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1 +}; // TODO delete it? // Beep center bits #define BC_BIT_RUD (0x01) @@ -400,6 +401,9 @@ enum BeeperMode { class GeneralSettings { public: GeneralSettings(); + + RawSource getDefaultSource(unsigned int channel); + unsigned int version; unsigned int variant; int calibMid[NUM_STICKS+C9X_NUM_POTS]; @@ -437,7 +441,7 @@ class GeneralSettings { unsigned int backlightDelay; bool blightinv; bool stickScroll; - unsigned int templateSetup; //RETA order according to chout_ar array // TODO enum + unsigned int templateSetup; //RETA order according to chout_ar array int PPM_Multiplier; int hapticLength; unsigned int reNavigation; @@ -946,7 +950,8 @@ class ModelData { void clear(); bool isempty(); - void setDefault(uint8_t id); + void setDefaultMixes(GeneralSettings & settings); + void setDefaultValues(unsigned int id, GeneralSettings & settings); int getTrimValue(int phaseIdx, int trimIdx); void setTrimValue(int phaseIdx, int trimIdx, int value); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 91a5ba3e1..3af585369 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -155,7 +155,7 @@ void MdiChild::OpenEditWindow(bool wizard=false) ModelData &model = radioData.models[row - 1]; if (model.isempty()) { - model.setDefault(row - 1); + model.setDefaultValues(row - 1, radioData.generalSettings); isNew = true; //modeledit - clear mixes, apply first template setModified(); }