ec

Dependents:   F3RC

Fork of EC by ROBOSTEP_LIBRARY

Revision:
14:28b6628fe90f
Parent:
13:caa6db604077
diff -r caa6db604077 -r 28b6628fe90f SpeedController.cpp
--- a/SpeedController.cpp	Sat Jan 21 07:11:08 2017 +0000
+++ b/SpeedController.cpp	Mon Apr 10 08:10:33 2017 +0000
@@ -41,6 +41,7 @@
     if(duty>0.95) {
         pwm_F_=0.95;
         pwm_B_=0;
+        duty=0.95;
     } else {
         pwm_F_=duty;
         pwm_B_=0;
@@ -106,7 +107,7 @@
 
 void SpeedControl::ScZ(double target_RPM){
     now_RPM=getRPM();
-    if(fabs(now_RPM-target_RPM)>300) Accelarate(target_RPM/C);
+    //if(fabs(now_RPM-target_RPM)>300) Accelarate(target_RPM/C);
     diff=target_RPM-now_RPM;
     integral+=diff;
     out_duty=0.01*(Kv_p*diff+Kv_d*(diff-diff_old)+Kv_i*integral);
@@ -114,7 +115,7 @@
     if(out_duty>0.01)out_duty=0.01;
     if(out_duty<-0.01)out_duty=-0.01;
     out+=out_duty;
-    duty=0.0001*out+target_RPM/C;
+    duty=0.0001*out/*+target_RPM/C*/;
     turnF(duty);
 }