patch throttle trim
This commit is contained in:
+23
-8
@@ -536,14 +536,25 @@ int getStickTrimValue(int stick, int stickValue)
|
|||||||
return trim;
|
return trim;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getSourceTrimValue(int source, int stickValue=0)
|
int getSourceTrimOrigin(int source)
|
||||||
{
|
{
|
||||||
if (source >= MIXSRC_Rud && source <= MIXSRC_Ail)
|
if (source >= MIXSRC_Rud && source <= MIXSRC_Ail)
|
||||||
return getStickTrimValue(source - MIXSRC_Rud, stickValue);
|
return source - MIXSRC_Rud;
|
||||||
else if (source >= MIXSRC_FIRST_INPUT && source <= MIXSRC_LAST_INPUT)
|
else if (source >= MIXSRC_FIRST_INPUT && source <= MIXSRC_LAST_INPUT)
|
||||||
return getStickTrimValue(virtualInputsTrims[source - MIXSRC_FIRST_INPUT], stickValue);
|
return virtualInputsTrims[source - MIXSRC_FIRST_INPUT];
|
||||||
else
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSourceTrimValue(int source, int stickValue=0)
|
||||||
|
{
|
||||||
|
auto origin = getSourceTrimOrigin(source);
|
||||||
|
if (origin >= 0) {
|
||||||
|
return getStickTrimValue(origin, stickValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t mixerCurrentFlightMode;
|
uint8_t mixerCurrentFlightMode;
|
||||||
@@ -735,13 +746,17 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (applyOffsetAndCurve) {
|
if (applyOffsetAndCurve) {
|
||||||
|
bool applyTrims = !(mode & e_perout_mode_notrims);
|
||||||
//========== TRIMS ================
|
if (!applyTrims && g_model.thrTrim) {
|
||||||
if (!(mode & e_perout_mode_notrims)) {
|
auto origin = getSourceTrimOrigin(md->srcRaw);
|
||||||
if (md->carryTrim == 0) {
|
TRACE("thrTrim=%d srcRaw=%d origin=%d stick=%d", g_model.thrTrim, md->srcRaw, origin, g_model.getThrottleStickTrimSource() - MIXSRC_FIRST_TRIM);
|
||||||
v += getSourceTrimValue(md->srcRaw, v);
|
if (origin == g_model.getThrottleStickTrimSource() - MIXSRC_FIRST_TRIM) {
|
||||||
|
applyTrims = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (applyTrims && md->carryTrim == 0) {
|
||||||
|
v += getSourceTrimValue(md->srcRaw, v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t weight = GET_GVAR_PREC1(MD_WEIGHT(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
int32_t weight = GET_GVAR_PREC1(MD_WEIGHT(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user