mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
Fixes #1569
This commit is contained in:
parent
5a19e147fd
commit
189becfbb2
2 changed files with 25 additions and 11 deletions
|
@ -509,17 +509,17 @@ void evalInputs(uint8_t mode)
|
||||||
|
|
||||||
#if !defined(PCBTARANIS)
|
#if !defined(PCBTARANIS)
|
||||||
rawAnas[ch] = v;
|
rawAnas[ch] = v;
|
||||||
anas[ch] = v; //set values for mixer
|
anas[ch] = v; // set values for mixer
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TRIMs */
|
|
||||||
evalTrims();
|
|
||||||
|
|
||||||
/* EXPOs */
|
/* EXPOs */
|
||||||
applyExpos(anas, mode);
|
applyExpos(anas, mode);
|
||||||
|
|
||||||
|
/* TRIMs */
|
||||||
|
evalTrims(); // when no virtual inputs, the trims need the anas array calculated above (when throttle trim enabled)
|
||||||
|
|
||||||
if (mode == e_perout_mode_normal) {
|
if (mode == e_perout_mode_normal) {
|
||||||
#if !defined(CPUARM)
|
#if !defined(CPUARM)
|
||||||
anaCenter &= g_model.beepANACenter;
|
anaCenter &= g_model.beepANACenter;
|
||||||
|
@ -749,11 +749,19 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
else
|
else
|
||||||
mix_trim = -1;
|
mix_trim = -1;
|
||||||
if (mix_trim >= 0) {
|
if (mix_trim >= 0) {
|
||||||
int16_t trim = trims[mix_trim];
|
int32_t trim = trims[mix_trim];
|
||||||
if (mix_trim == THR_STICK && g_model.throttleReversed)
|
if (mix_trim == THR_STICK) {
|
||||||
v -= trim;
|
if (g_model.thrTrim) {
|
||||||
else
|
if (g_model.throttleReversed) {
|
||||||
v += trim;
|
trim = -trim;
|
||||||
|
}
|
||||||
|
trim = ((trim-2*TRIM_MIN) * (RESX-v)) >> (RESX_SHIFT+1);
|
||||||
|
}
|
||||||
|
if (g_model.throttleReversed) {
|
||||||
|
trim = -trim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v += trim;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1659,10 +1659,16 @@ FORCEINLINE void evalTrims()
|
||||||
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
||||||
// do trim -> throttle trim if applicable
|
// do trim -> throttle trim if applicable
|
||||||
int16_t trim = getTrimValue(phase, i);
|
int16_t trim = getTrimValue(phase, i);
|
||||||
|
#if !defined(PCBTARANIS)
|
||||||
if (i==THR_STICK && g_model.thrTrim) {
|
if (i==THR_STICK && g_model.thrTrim) {
|
||||||
trim = (((g_model.throttleReversed)?(int32_t)(trim+TRIM_MIN):(int32_t)(trim-TRIM_MIN)) * (RESX-getValue(MIXSRC_Thr))) >> (RESX_SHIFT+1);
|
if (g_model.throttleReversed)
|
||||||
|
trim = -trim;
|
||||||
|
int16_t v = anas[i];
|
||||||
|
int32_t vv = ((int32_t)trim-TRIM_MIN)*(RESX-v)>>(RESX_SHIFT+1);
|
||||||
|
trim = vv;
|
||||||
}
|
}
|
||||||
else if (trimsCheckTimer > 0) {
|
#endif
|
||||||
|
if (trimsCheckTimer > 0) {
|
||||||
trim = 0;
|
trim = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue