Fixes #1425
This commit is contained in:
+15
-7
@@ -3085,18 +3085,26 @@ void instantTrim()
|
|||||||
{
|
{
|
||||||
evalInputs(e_perout_mode_notrainer);
|
evalInputs(e_perout_mode_notrainer);
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
for (uint8_t stick=0; stick<NUM_STICKS; stick++) {
|
||||||
if (i!=THR_STICK) {
|
if (stick!=THR_STICK) {
|
||||||
// don't instant trim the throttle stick
|
// don't instant trim the throttle stick
|
||||||
uint8_t trim_phase = getTrimFlightPhase(mixerCurrentFlightMode, i);
|
uint8_t trim_phase = getTrimFlightPhase(mixerCurrentFlightMode, stick);
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
int16_t delta = calibratedStick[i];
|
int16_t delta = 0;
|
||||||
|
for (int e=0; e<MAX_EXPOS; e++) {
|
||||||
|
ExpoData * ed = expoAddress(e);
|
||||||
|
if (!EXPO_VALID(ed)) break; // end of list
|
||||||
|
if (ed->srcRaw-MIXSRC_Rud == stick) {
|
||||||
|
delta = anas[ed->chn];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int16_t delta = anas[i];
|
int16_t delta = anas[stick];
|
||||||
#endif
|
#endif
|
||||||
if (abs(delta) >= INSTANT_TRIM_MARGIN) {
|
if (abs(delta) >= INSTANT_TRIM_MARGIN) {
|
||||||
int16_t trim = limit<int16_t>(TRIM_EXTENDED_MIN, (delta + trims[i]) / 2, TRIM_EXTENDED_MAX);
|
int16_t trim = limit<int16_t>(TRIM_EXTENDED_MIN, (delta + trims[stick]) / 2, TRIM_EXTENDED_MAX);
|
||||||
setTrimValue(trim_phase, i, trim);
|
setTrimValue(trim_phase, stick, trim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user