From ca92b344ac3b8e5c68deb3c8c66c417e2a029a5e Mon Sep 17 00:00:00 2001 From: Lukas Reichwein Date: Sat, 18 Jan 2020 05:22:47 +0100 Subject: [PATCH] higest and lowest values of a motor should be used instead of 255 and -255 --- Code/libraries/Joystick/Steuerung.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Code/libraries/Joystick/Steuerung.cpp b/Code/libraries/Joystick/Steuerung.cpp index ea015b2..a257a67 100644 --- a/Code/libraries/Joystick/Steuerung.cpp +++ b/Code/libraries/Joystick/Steuerung.cpp @@ -19,16 +19,16 @@ void Steuerung::applyPWMValuesDependingOnReadings() { (left -> PWMValue) = this -> yValue; (right -> PWMValue) = (this -> yValue) - (this -> xValue); if ((this -> xValue) >= (this -> yValue)) { - (left -> PWMValue) = 255; - (right -> PWMValue) = -255; + (left -> PWMValue) = left -> highestValue; + (right -> PWMValue) = right -> lowestValue; } } else { //+y , -x (left -> PWMValue) = this -> yValue; (right -> PWMValue) = (this -> yValue) + (this -> xValue); if (abs(this -> xValue) >= (this -> yValue)) { - (left -> PWMValue) = -255; - (right -> PWMValue) = 255; + (left -> PWMValue) = left -> lowestValue; + (right -> PWMValue) = right -> highestValue; } } } else { @@ -37,16 +37,16 @@ void Steuerung::applyPWMValuesDependingOnReadings() { (left -> PWMValue) = this -> yValue; (right -> PWMValue) = (this -> yValue) + (this -> xValue); if (this -> xValue >= abs(this -> yValue)) { - (left -> PWMValue) = 255; - (right -> PWMValue) = -255; + (left -> PWMValue) = left -> highestValue; + (right -> PWMValue) = right -> lowestValue; } } else { //-y , -x (left -> PWMValue) = this -> yValue; (right -> PWMValue) = (this -> yValue) - (this -> xValue); if (abs(this -> xValue) >= abs(this -> yValue)) { - (left -> PWMValue) = -255; - (right -> PWMValue) = 255; + (left -> PWMValue) = left -> lowestValue; + (right -> PWMValue) = right -> highestValue; } } }