Revert "Removed some unnecessary code"

This reverts commit 6261fbf317.
This commit is contained in:
bsongis
2014-06-04 21:22:43 +02:00
parent 8267ac2fc2
commit 0a5c3f42c5
+28 -1
View File
@@ -62,11 +62,18 @@ int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMa
#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)
#if defined(HELI)
int16_t heliAnasCopy[4];
memcpy(heliAnasCopy, heliAnas, sizeof(heliAnasCopy));
#endif
#else
int16_t anas2[NUM_INPUTS]; // values before expo, to ensure same expo base when multiple expo lines are used
memcpy(anas2, anas, sizeof(anas2));
@@ -89,6 +96,12 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
int v;
if (ed->srcRaw == ovwrIdx)
v = ovwrValue;
#if defined(HELI)
else if (ed->srcRaw == MIXSRC_Ele)
v = heliAnasCopy[ELE_STICK];
else if (ed->srcRaw == MIXSRC_Ail)
v = heliAnasCopy[AIL_STICK];
#endif
else {
v = getValue(ed->srcRaw);
if (ed->srcRaw >= MIXSRC_FIRST_TELEM && ed->scale > 0) {
@@ -136,6 +149,13 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
virtualInputsTrims[cur_chn] = ed->srcRaw - MIXSRC_Rud;
else
virtualInputsTrims[cur_chn] = -1;
#if defined(HELI)
if (ed->srcRaw == MIXSRC_Ele)
heliAnas[ELE_STICK] = v;
else if (ed->srcRaw == MIXSRC_Ail)
heliAnas[AIL_STICK] = v;
#endif
#endif
anas[cur_chn] = v;
@@ -477,6 +497,9 @@ void evalInputs(uint8_t mode)
if (d && (ch==ELE_STICK || ch==AIL_STICK)) {
v = (int32_t(v) * calc100toRESX(g_model.swashR.value)) / int32_t(d);
}
#if defined(PCBTARANIS)
heliAnas[ch] = v;
#endif
#endif
#if !defined(PCBTARANIS)
@@ -501,7 +524,11 @@ void evalInputs(uint8_t mode)
}
}
#define HELI_ANAS_ARRAY anas
#if defined(PCBTARANIS)
#define HELI_ANAS_ARRAY heliAnas
#else
#define HELI_ANAS_ARRAY anas
#endif
uint8_t s_current_mixer_flight_mode;
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)