190711

Revision:
5:15d0276d7e21
Parent:
4:a629f46d6594
Child:
6:366ec55e64fe
--- a/motor.h	Thu May 23 23:02:14 2019 +0000
+++ b/motor.h	Tue Jun 25 11:01:39 2019 +0000
@@ -15,6 +15,8 @@
         ~MotorCtl();
 
         int getRPM();
+        float CalculateCumDis();
+        float CalculateRelaDis();
         int getTarget();
         int getError();
         float getKP();
@@ -28,6 +30,7 @@
         void setPID(float p, float i, float d);
         void setDirection(); // set the direction
         
+        
         //Control Methods
         void UpdateCurrentPosition();
         void PIDControl();
@@ -42,9 +45,9 @@
         DigitalInOut _tachoB;
         Ticker _tick;
         
-        long CurrentPosition, PreviousPosition; // Position Value
+        long CurrentPosition, PreviousPosition, DistancePosition; // Position Value
         int CurrentSpeed, Error,PreviousError; // Speed Data
-        unsigned int duty; // Duty level ( 0-1024)
+        float duty; // Duty level ( 0-1024)
         unsigned int pwmPeriod; // default 50ms
         unsigned char pwmpin; // PB2 ( 10 )
         unsigned char ppin, npin,dr;  // dr =10 means ccwise, dr=0 means clockwise
@@ -55,6 +58,7 @@
         int integ, derv,control,cw0[MaxBuf];
         unsigned char cpidx;
         float CalculateRPM(int DeltaCnt); // Calculate RPM value
+
         float vel;
         int TargetSpeed;