Преглед на файлове

changed update rate + accelstepper move% bugfix

titi преди 5 години
родител
ревизия
cae6cad9d1
променени са 2 файла, в които са добавени 7 реда и са изтрити 7 реда
  1. 6 6
      Atm_AccelStepper.cpp
  2. 1 1
      Atm_encoderInt.h

+ 6 - 6
Atm_AccelStepper.cpp

@@ -484,11 +484,12 @@ Atm_AccelStepper& Atm_AccelStepper::moveTo( long int stepAbs) {
 }
 
 Atm_AccelStepper& Atm_AccelStepper::movePercent( float percent) {
-  
-  _targetStep   = _currentStep + percent*_maxStep;
+  // Serial.println(percent/100.)
+
+  _targetStep   = (float)_currentStep + percent/100.*float(_maxStep);
   runMode = 0;
   // _isHoming = 0;
-  //Serial.println(_targetStep);
+  Serial.println(_targetStep);
   stepper->moveTo(_targetStep);
   enable();
   trigger( EVT_MOVE );
@@ -496,9 +497,8 @@ Atm_AccelStepper& Atm_AccelStepper::movePercent( float percent) {
 }
 
 Atm_AccelStepper& Atm_AccelStepper::moveToPercent( float percent) {
-
-  _targetStep   = percent*_maxStep;
-  // _isHoming = 0 ;
+  _targetStep   = (float) percent/100*float(_maxStep) ;
+  // _isHoming = 0
   runMode = 0;
   stepper->moveTo(_targetStep);
   enable();

+ 1 - 1
Atm_encoderInt.h

@@ -32,7 +32,7 @@ class Atm_encoderInt : public Machine {
   bool wrap, range_invert;
   atm_connector onup, ondown;
   // atm_timer_millis sendTimer;
-  int send_rate = 30;
+  int send_rate = 20;
   int send_last = 0;