diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 2009887ed..b6469c351 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -946,6 +946,13 @@ int expo(int x, int k) return neg? -y : y; } +#if defined(HELI) + int16_t cyc_anas[3] = {0}; +#if defined(PCBTARANIS) + int16_t heliAnas[4] = {0}; +#endif +#endif + void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) { #if !defined(PCBTARANIS) @@ -967,9 +974,20 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS) continue; if (getSwitch(ed->swtch)) { #if defined(PCBTARANIS) - int v = (ed->srcRaw == ovwrIdx ? ovwrValue : getValue(ed->srcRaw)); - if (ed->srcRaw != ovwrIdx && ed->srcRaw >= MIXSRC_FIRST_TELEM && ed->scale > 0) { - v = limit(-1024, int((v * 1024) / convertTelemValue(ed->srcRaw-MIXSRC_FIRST_TELEM+1, ed->scale)), 1024); + int v; + if (ed->srcRaw == ovwrIdx) + v = ovwrValue; +#if defined(HELI) + else if (ed->srcRaw == MIXSRC_Ele) + v = heliAnas[ELE_STICK]; + else if (ed->srcRaw == MIXSRC_Ail) + v = heliAnas[AIL_STICK]; +#endif + else { + v = getValue(ed->srcRaw); + if (ed->srcRaw >= MIXSRC_FIRST_TELEM && ed->scale > 0) { + v = limit(-1024, int((v * 1024) / convertTelemValue(ed->srcRaw-MIXSRC_FIRST_TELEM+1, ed->scale)), 1024); + } } #else int16_t v = anas2[ed->chn]; @@ -1193,9 +1211,6 @@ int16_t applyLimits(uint8_t channel, int32_t value) int16_t calibratedStick[NUM_STICKS+NUM_POTS]; int16_t channelOutputs[NUM_CHNOUT] = {0}; int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMain; -#ifdef HELI -int16_t cyc_anas[3] = {0}; -#endif // TODO same naming convention than the putsMixerSource @@ -3179,9 +3194,9 @@ void evalInputs(uint8_t mode) #if defined(HELI) if (d && (ch==ELE_STICK || ch==AIL_STICK)) { - v = (int32_t(v)*calc100toRESX(g_model.swashR.value))/int32_t(d); + v = (int32_t(v) * calc100toRESX(g_model.swashR.value)) / int32_t(d); #if defined(PCBTARANIS) - calibratedStick[ch] = v; + heliAnas[ch] = v; #endif } #endif @@ -3662,7 +3677,7 @@ void evalFunctions() } #if defined(PCBTARANIS) - #define HELI_ANAS_ARRAY calibratedStick + #define HELI_ANAS_ARRAY heliAnas #else #define HELI_ANAS_ARRAY anas #endif