Merge PR #4 from Dicion: fix throttle zero handling in CRIOMAIN
Removes the if(lT!=0) guard in UpdateThrottle that made an exact-zero throttle reading keep the previous throttle value; adds a negative clamp. Zero now falls into the deadzone branch -> ZERO_THROTTLE. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2392,20 +2392,18 @@ void CRIOMAIN::UpdateThrottle (DIJOYSTATE &js)
|
||||
|
||||
lT = (LONG)g_ThrottleStart - g_Throttle;
|
||||
|
||||
if (lT > 800L)
|
||||
lT = 800L;
|
||||
|
||||
if (lT != 0) {
|
||||
lT = lT * 1000L / 800L;
|
||||
if (lT < 0L) lT = 0L; // g_ThrottleStart >= g_Throttle always; clamp for safety
|
||||
if (lT > 800L) lT = 800L;
|
||||
|
||||
if ((lT > -DEADZONE_THROTTLE) && (lT < DEADZONE_THROTTLE)) {
|
||||
g_ThrottleLast = ZERO_THROTTLE;
|
||||
} else {
|
||||
if (g_ThrottleResult > 0L) { // back
|
||||
g_ThrottleLast = 900L + (lT * g_ThrottleResult * 0.1L);
|
||||
} else { // front
|
||||
g_ThrottleLast = lT * g_ThrottleResult;
|
||||
}
|
||||
lT = lT * 1000L / 800L;
|
||||
|
||||
if ((lT > -DEADZONE_THROTTLE) && (lT < DEADZONE_THROTTLE)) {
|
||||
g_ThrottleLast = ZERO_THROTTLE;
|
||||
} else {
|
||||
if (g_ThrottleResult > 0L) { // back
|
||||
g_ThrottleLast = 900L + (lT * g_ThrottleResult * 0.1L);
|
||||
} else { // front
|
||||
g_ThrottleLast = lT * g_ThrottleResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user