From 3c5cd0b1c33070a1da66a304d3b74b0be83f5cae Mon Sep 17 00:00:00 2001 From: Fisch Date: Sun, 14 Jul 2024 16:46:33 +0200 Subject: [PATCH] fix tank steering safety check --- controller_teensy/src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller_teensy/src/main.cpp b/controller_teensy/src/main.cpp index 275c94b..695752f 100644 --- a/controller_teensy/src/main.cpp +++ b/controller_teensy/src/main.cpp @@ -563,10 +563,10 @@ void calculateSetSpeed(unsigned long timediff){ - if (control_buttonA && !control_buttonB && !reverse_enabled && throttle_pos<=0) { //Right button (A) only. and throttle touched + if (control_buttonA && !control_buttonB && !reverse_enabled && throttle_pos>0) { //Right button (A) only. and throttle touched tanksteering_differential+=tanksteering_rate_increase*(timediff/1000.0); tanksteering_differential=constrain(tanksteering_differential,-1.0,1.0); //constrain between 0 and 1 - }else if(control_buttonB && !control_buttonA && !reverse_enabled && throttle_pos<=0) { //Left button (B) only. and throttle touched + }else if(control_buttonB && !control_buttonA && !reverse_enabled && throttle_pos>0) { //Left button (B) only. and throttle touched tanksteering_differential-=tanksteering_rate_increase*(timediff/1000.0); tanksteering_differential=constrain(tanksteering_differential,-1.0,1.0); //constrain between 0 and 1 }else{ //buttons released