From 9e212661f2dbfe55698eaaf8046fefdba8858002 Mon Sep 17 00:00:00 2001 From: Sidi Liang <1467329765@qq.com> Date: Wed, 29 Jul 2020 13:29:40 +0800 Subject: [PATCH] Auto Speed: Fix the bug that prevents it to cut off when applying feet brake --- Nasal/auto_speed.nas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/auto_speed.nas b/Nasal/auto_speed.nas index 584a56d..b3b3534 100644 --- a/Nasal/auto_speed.nas +++ b/Nasal/auto_speed.nas @@ -11,7 +11,7 @@ var throttleNode = props.getNode("/controls/engines/engine/throttle",1); var lastDeltaSpeed = 0; var autoSpeedMainLoop = func(){ - if(leftBrakes.getValue() == 1 or rightBrakes.getValue() == 1 or throttleNode.getValue() == 1){ #//Stop if full brakes or full throttle are manually applied + if(leftBrakes.getValue() >= 0.8 or rightBrakes.getValue() >= 0.8 or throttleNode.getValue() == 1){ #//Stop if full brakes or full throttle are manually applied throttleNode.setValue(0); stopAutoSpeed(); } @@ -23,7 +23,7 @@ var autoSpeedMainLoop = func(){ throttle = calculateThrottle(deltaSpeed / targetSpeed); #// Max throttle 0.9 }else if(deltaSpeed <= -1.852){ throttle = 0; - brakes = ((0 - deltaSpeed) / targetSpeed) - 0.2; #// Max brake 0.8 + brakes = ((0 - deltaSpeed) / targetSpeed) - 0.21; #// Max brake 0.79 }else{ throttle = 0; }