Adjust audio announcements on trim limits
This commit is contained in:
+11
-5
@@ -1003,21 +1003,26 @@ void checkTrims()
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (before>TRIM_MIN && after<=TRIM_MIN) {
|
int16_t tMax = g_model.extendedTrims ? TRIM_EXTENDED_MAX : TRIM_MAX;
|
||||||
|
int16_t tMin = g_model.extendedTrims ? TRIM_EXTENDED_MIN : TRIM_MIN;
|
||||||
|
if (before > tMin && after <= tMin) {
|
||||||
beepTrim = true;
|
beepTrim = true;
|
||||||
AUDIO_TRIM_MIN();
|
AUDIO_TRIM_MIN();
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
}
|
}
|
||||||
else if (before<TRIM_MAX && after>=TRIM_MAX) {
|
else if (before < tMax && after >= tMax) {
|
||||||
beepTrim = true;
|
beepTrim = true;
|
||||||
AUDIO_TRIM_MAX();
|
AUDIO_TRIM_MAX();
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((before<after && after>TRIM_MAX) || (before>after && after<TRIM_MIN)) {
|
// Allow only move into the right direction if over the limits
|
||||||
if (!g_model.extendedTrims) after = before;
|
if ((before < after && after > tMax) || // increasing over tMax
|
||||||
|
(before > after && after < tMin)) { // decreasing under tMin
|
||||||
|
after = before;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clip at hard limits
|
||||||
if (after < TRIM_EXTENDED_MIN) {
|
if (after < TRIM_EXTENDED_MIN) {
|
||||||
after = TRIM_EXTENDED_MIN;
|
after = TRIM_EXTENDED_MIN;
|
||||||
}
|
}
|
||||||
@@ -1586,7 +1591,8 @@ void instantTrim()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (addTrim && abs(delta) >= INSTANT_TRIM_MARGIN) {
|
if (addTrim && abs(delta) >= INSTANT_TRIM_MARGIN) {
|
||||||
int16_t trim = limit<int16_t>(TRIM_EXTENDED_MIN, (delta + trims[stick]) / 2, TRIM_EXTENDED_MAX);
|
int16_t trim = limit<int16_t>(
|
||||||
|
TRIM_EXTENDED_MIN, (delta + trims[stick]) / 2, TRIM_EXTENDED_MAX);
|
||||||
setTrimValue(trimFlightMode, stick, trim);
|
setTrimValue(trimFlightMode, stick, trim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user