Buggy bois / Mbed 2 deprecated WORKING_TRIAL

Dependencies:   mbed

Revision:
3:01b5e80d842d
Parent:
1:813f4b17ae65
--- a/WheelControl/P.h	Sun Mar 03 00:55:10 2019 +0000
+++ b/WheelControl/P.h	Sat Mar 09 14:27:48 2019 +0000
@@ -40,7 +40,9 @@
     float compute(float curVal_)
     {
         float temp = ((control-curVal_)*gain)+curVal_; //amplify difference by gain and add to current value
-        temp = (((temp-inMin)/(inMin - inMin))*(outMax-outMin))+outMin; //scales temp to the correct output Limits
+        temp = (((temp-inMin)/(inMax - inMin))*(outMax-outMin))+outMin; //scales temp to the correct output Limits
+        if (temp > 1.0f ) {temp = 1.0f;}
+        if (temp < -1.0f) {temp = -1.0f;}
         return temp; //return the scaled value
     }