ソースを参照

moved previous correction to rotate()

prevent one step from being done if we really are on a limit
still allows immediate start on rotate()
eLandon 4 年 前
コミット
b870a32101
1 ファイル変更2 行追加2 行削除
  1. 2 2
      Atm_AccelStepper.cpp

+ 2 - 2
Atm_AccelStepper.cpp

@@ -165,7 +165,7 @@ void Atm_AccelStepper::action( int id ) {
 
     case ENT_RUNNING:
       push(connectors, ON_CHANGESTATE, 0,  state(), 0);
-      _currentSpeed = stepper->speed();
+      
       if (last_trigger!=EVT_ON_LIMIT_LOW && last_trigger!=EVT_ON_LIMIT_HIGH){compensatePlay(_currentSpeed);}
       if (runMode){stepper->setSpeed( _currentSpeed);}
       else{stepper->moveTo(_targetStep);}
@@ -501,8 +501,8 @@ Atm_AccelStepper& Atm_AccelStepper::moveToPercent( float percent) {
 
 Atm_AccelStepper& Atm_AccelStepper::rotate( long  int speed) {
   runMode = 1;
-
   stepper->setSpeed( speed);
+  _currentSpeed = stepper->speed();
   enable();
   trigger( EVT_MOVE );
   return *this;