1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 13:25:20 +03:00

[Taranis] Inputs / Mixes now correctly created on a fresh model

This commit is contained in:
Bertrand Songis 2014-01-27 09:35:00 +01:00
parent 0c015f321a
commit 6fd9c47649

View file

@ -64,8 +64,9 @@ MixData* setDest(uint8_t dch, uint8_t src, bool clear=false)
while (1) {
mix = mixAddress(i);
if (mix->srcRaw && mix->destCh <= dch) {
if (clear && mix->destCh == dch)
if (clear && mix->destCh == dch) {
deleteExpoMix(0, i);
}
else {
if (++i==MAX_MIXERS) {
// TODO should return null pointer but needs to be tested then
@ -106,10 +107,14 @@ void defaultInputs()
clearInputs();
for (int i=0; i<NUM_STICKS; i++) {
s_currCh = i+1;
insertExpoMix(1, i);
uint8_t stick_index = channel_order(i+1);
ExpoData *expo = expoAddress(i);
expo->srcRaw = MIXSRC_Rud - 1 + stick_index;
expo->curve.type = CURVE_REF_EXPO;
expo->chn = i;
expo->weight = 100;
for (int c=0; c<4; c++) {
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*(expoAddress(i)->srcRaw-MIXSRC_Rud+1)+c]);
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*stick_index+c]);
}
}
eeDirty(EE_MODEL);
@ -163,7 +168,7 @@ void applyTemplate(uint8_t idx)
uint8_t icc[4] = {0};
for (uint8_t i=0; i<4; i++) { //generate inverse array
for(uint8_t j=0; j<4; j++)
if(CC(i+1)==j+1) icc[j]=i;
if(CC(i+1)==j+MIXSRC_Rud) icc[j]=i;
}
switch (idx) {
@ -177,7 +182,7 @@ void applyTemplate(uint8_t idx)
switch (idx) {
// Simple 4-Ch
case TMPL_SIMPLE_4CH:
clearInputs();
defaultInputs();
#if defined(PCBTARANIS)
#pragma message("Templates with virtual inputs (FrSky Taranis) are not implemented!")
#endif