ec

Dependents:   F3RC

Fork of EC by ROBOSTEP_LIBRARY

Revision:
34:b34dc495b3c8
Parent:
32:297384f9d261
diff -r 5fe65de5684c -r b34dc495b3c8 EC.cpp
--- a/EC.cpp	Wed Jul 04 04:36:42 2018 +0000
+++ b/EC.cpp	Thu Jul 05 01:23:58 2018 +0000
@@ -108,6 +108,7 @@
     RPM_th=250;
     count_to_distance_mm_ = 0;
     gear_rate_ = 1;
+    is_diameter_set = 0;
 }
 
 int Ec::getCount()
@@ -170,6 +171,7 @@
 
 double Ec::getDistance_mm()
 {
+    if(is_diameter_set == 0) printf("please set diameter\r\n");
     distance_mm_= count * count_to_distance_mm_;
     return distance_mm_;
 }
@@ -177,6 +179,7 @@
 {
     diameter_mm_ = diameter_mm;
     setCountToDistance_mm();
+    is_diameter_set = 1;
 }
 void Ec::setGearRate(double gear_rate){
     gear_rate_ = gear_rate;