Tarek Lule / MotorLib

Fork of MotorLib by CreaLab

Revision:
8:4dd59b6f4e92
Parent:
7:439458133bba
Child:
9:5983c10d5f8e
--- a/motor.cpp	Thu Mar 09 11:58:10 2017 +0000
+++ b/motor.cpp	Mon Jul 17 11:45:44 2017 +0000
@@ -57,7 +57,7 @@
 
 void Motor::RunDegrees(MotorDir dir, float degree) {
     SetDirection( dir);
-    NumSteps = (int)(degree * MotorFullTurn / 360.0);
+    NumSteps = (int)(degree * (float)MotorFullTurn / (float)360.0);
     SetCommand(MOTOR_start);
 }
 void Motor::SetDirection(MotorDir dir) {
@@ -137,7 +137,7 @@
             if (command == MOTOR_pause) {
                 state = Motor_PAUSE;
                 }
-            else if ((command == MOTOR_stop)||(NumSteps<=0)) {
+            else if ((command == MOTOR_stop)||(NumSteps==0)) {
                 StopMotor();
                 state = Motor_IDLE;
                 }