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

Replicate center trim beep behavior also when crossing trims (#5693)

* Replicate center trim beep behavior also when crossing trims

* Cosmetics
This commit is contained in:
3djc 2018-03-04 13:11:22 +01:00 committed by Andre Bernet
parent a9716a340d
commit 6bd38ce13a
3 changed files with 9 additions and 3 deletions

View file

@ -647,7 +647,7 @@ int getStickTrimValue(int stick, int stickValue)
return 0; return 0;
int trim = trims[stick]; int trim = trims[stick];
if (stick == virtualInputsTrims[THR_STICK]) { if (IS_THROTTLE_TRIM(stick)) {
if (g_model.thrTrim) { if (g_model.thrTrim) {
int trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN; int trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN;
trim = ((g_model.throttleReversed ? (trim+trimMin) : (trim-trimMin)) * (RESX-stickValue)) >> (RESX_SHIFT+1); trim = ((g_model.throttleReversed ? (trim+trimMin) : (trim-trimMin)) * (RESX-stickValue)) >> (RESX_SHIFT+1);

View file

@ -1352,7 +1352,7 @@ uint8_t checkTrim(event_t event)
#else #else
before = getRawTrimValue(phase, idx); before = getRawTrimValue(phase, idx);
#endif #endif
thro = (idx==THR_STICK && g_model.thrTrim); thro = (IS_THROTTLE_TRIM(idx) && g_model.thrTrim);
} }
#else #else
phase = getTrimFlightMode(mixerCurrentFlightMode, idx); phase = getTrimFlightMode(mixerCurrentFlightMode, idx);
@ -1361,7 +1361,7 @@ uint8_t checkTrim(event_t event)
#else #else
before = getRawTrimValue(phase, idx); before = getRawTrimValue(phase, idx);
#endif #endif
thro = (idx==THR_STICK && g_model.thrTrim); thro = (IS_THROTTLE_TRIM(idx) && g_model.thrTrim);
#endif #endif
int8_t trimInc = g_model.trimInc + 1; int8_t trimInc = g_model.trimInc + 1;
int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc); // TODO flash saving if (trimInc < 0) int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc); // TODO flash saving if (trimInc < 0)

View file

@ -338,6 +338,12 @@ void memswap(void * a, void * b, uint8_t size);
#define IS_MULTIPOS_CALIBRATED(cal) (false) #define IS_MULTIPOS_CALIBRATED(cal) (false)
#endif #endif
#if defined(VIRTUAL_INPUTS)
#define IS_THROTTLE_TRIM(x) (x == virtualInputsTrims[THR_STICK])
#else
#define IS_THROTTLE_TRIM(x) (x == THR_STICK)
#endif
#if defined(PWR_BUTTON_PRESS) #if defined(PWR_BUTTON_PRESS)
#define pwrOffPressed() pwrPressed() #define pwrOffPressed() pwrPressed()
#else #else