Dependents:   YMotor

Revision:
2:871d1f6d311e
Parent:
1:c8ed08beefb9
Child:
3:22f19e076931
--- a/YMotorDriverBase.cpp	Wed Oct 14 06:04:34 2015 +0000
+++ b/YMotorDriverBase.cpp	Fri Nov 13 07:47:35 2015 +0000
@@ -23,7 +23,6 @@
     0.285f, //
     0.0f,   // shooter
     0.3f,   // general
-    //0.25f   // supplier
     0.22f   // supplier
 };
 const float YMotorDriverBase::mMaxDutyList[] = {
@@ -107,7 +106,7 @@
 }
 
 void YMotorDriverBase::write(){
-    updatePwmDuty();
+    mMotorDrivePwm->setDuty( middle( mMinDuty, mDuty, mMaxDuty ) );
     
     switch ( mAction ){
         case FORWARD:
@@ -148,16 +147,6 @@
     }
 }
 
-void YMotorDriverBase::updatePwmDuty(){
-    static float prevDuty = mMinDuty;
-    float d = middle( mMinDuty, mDuty, mMaxDuty );
-    
-    if ( d != prevDuty ){
-        mMotorDrivePwm->setDuty( d );
-    }
-    prevDuty = d;
-}
-
 void YMotorDriverBase::setPercent( float p ){
     p = middle( 0.0f, p, 1.0f );
     mDuty = p * mMaxDuty + ( 1.0f - p ) * mMinDuty;