Browse Source

compensate steps only if playSteps!=0

bugfix, prevented moving in one direction
titi 5 years ago
parent
commit
9939da2ec8
1 changed files with 5 additions and 5 deletions
  1. 5 5
      Atm_AccelStepper.cpp

+ 5 - 5
Atm_AccelStepper.cpp

@@ -490,7 +490,7 @@ Atm_AccelStepper& Atm_AccelStepper::position_refresh(long int refresh_ms){
 
 Atm_AccelStepper& Atm_AccelStepper::move( long int stepRel) {
   _targetStep   = _currentStep + stepRel;
-  compensatePlay();
+  if(playSteps){compensatePlay();}
   runMode = 0;
   // _isHoming = 0;
   //Serial.println(_targetStep);
@@ -502,7 +502,7 @@ Atm_AccelStepper& Atm_AccelStepper::move( long int stepRel) {
 
 Atm_AccelStepper& Atm_AccelStepper::moveTo( long int stepAbs) {
   _targetStep   = stepAbs;
-  compensatePlay();
+  if(playSteps){compensatePlay();}
   // _isHoming = 0 ;
   runMode = 0;
   stepper->moveTo(_targetStep);
@@ -515,7 +515,7 @@ Atm_AccelStepper& Atm_AccelStepper::movePercent( float percent) {
   // Serial.println(percent/100.)
 
   _targetStep   = (float)_currentStep + percent/100.*float(_maxStep);
-  compensatePlay();
+  if(playSteps){compensatePlay();}
   runMode = 0;
   // _isHoming = 0;
   Serial.println(_targetStep);
@@ -527,7 +527,7 @@ Atm_AccelStepper& Atm_AccelStepper::movePercent( float percent) {
 
 Atm_AccelStepper& Atm_AccelStepper::moveToPercent( float percent) {
   _targetStep   = (float) percent/100*float(_maxStep) ;
-  compensatePlay();
+  if(playSteps){compensatePlay();}
   // _isHoming = 0
   runMode = 0;
   stepper->moveTo(_targetStep);
@@ -540,7 +540,7 @@ Atm_AccelStepper& Atm_AccelStepper::rotate( long  int speed) {
   runMode = 1;
   // _isHoming = 0 ;
   stepper->setSpeed( speed);
-  compensatePlay();
+  if(playSteps){compensatePlay();}
   //stepper->runSpeed();
   enable();
   trigger( EVT_MOVE );