fix: Throttle stick not being detected properly (#3733)
* Fix thottle timer * More THR source fixes
This commit is contained in:
+3
-3
@@ -527,7 +527,7 @@ void evalInputs(uint8_t mode)
|
||||
#if defined(STICK_DEAD_ZONE)
|
||||
// dead zone invented by FlySky in my opinion it should goes into ADC
|
||||
// float calculations are not efficient
|
||||
if (g_eeGeneral.stickDeadZone && ch != THR_STICK) {
|
||||
if (g_eeGeneral.stickDeadZone && ch != inputMappingConvertMode(inputMappingGetThrottle())) {
|
||||
if (v > P_OFFSET) {
|
||||
// y=ax+b
|
||||
v = (int)((aParam * (float)v) - bParam);
|
||||
@@ -540,7 +540,7 @@ void evalInputs(uint8_t mode)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_model.throttleReversed && ch==THR_STICK) {
|
||||
if (g_model.throttleReversed && ch==inputMappingConvertMode(inputMappingGetThrottle())) {
|
||||
v = -v;
|
||||
}
|
||||
|
||||
@@ -1174,7 +1174,7 @@ void doMixerPeriodicUpdates()
|
||||
val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
|
||||
}
|
||||
else {
|
||||
val = RESX + calibratedAnalogs[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc + MAX_STICKS - 1];
|
||||
val = RESX + calibratedAnalogs[g_model.thrTraceSrc == 0 ? inputMappingConvertMode(inputMappingGetThrottle()) : g_model.thrTraceSrc + MAX_STICKS - 1];
|
||||
}
|
||||
|
||||
val >>= (RESX_SHIFT-6); // calibrate it (resolution increased by factor 4)
|
||||
|
||||
@@ -939,7 +939,7 @@ void checkTrims()
|
||||
#else
|
||||
phase = getTrimFlightMode(mixerCurrentFlightMode, idx);
|
||||
before = getTrimValue(phase, idx);
|
||||
thro = (idx==THR_STICK && g_model.thrTrim);
|
||||
thro = (idx==inputMappingConvertMode(inputMappingGetThrottle()) && g_model.thrTrim);
|
||||
#endif
|
||||
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)
|
||||
@@ -1223,7 +1223,7 @@ void instantTrim()
|
||||
|
||||
auto controls = adcGetMaxInputs(ADC_INPUT_MAIN);
|
||||
for (uint8_t stick = 0; stick < controls; stick++) {
|
||||
if (stick != THR_STICK) { // don't instant trim the throttle stick
|
||||
if (stick != inputMappingConvertMode(inputMappingGetThrottle())) { // don't instant trim the throttle stick
|
||||
bool addTrim = false;
|
||||
int16_t delta = 0;
|
||||
uint8_t trimFlightMode = getTrimFlightMode(mixerCurrentFlightMode, stick);
|
||||
|
||||
@@ -352,7 +352,7 @@ getvalue_t getValueForLogicalSwitch(mixsrc_t i)
|
||||
int8_t trimIdx = virtualInputsTrims[i-MIXSRC_FIRST_INPUT];
|
||||
if (trimIdx >= 0) {
|
||||
int16_t trim = trims[trimIdx];
|
||||
if (trimIdx == THR_STICK && g_model.throttleReversed)
|
||||
if (trimIdx == inputMappingConvertMode(inputMappingGetThrottle()) && g_model.throttleReversed)
|
||||
result -= trim;
|
||||
else
|
||||
result += trim;
|
||||
|
||||
Reference in New Issue
Block a user