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; } } }