fix speed/acceleration, only accelerate when doing the homing moves
authorJim Morris <morris@wolfman.com>
Thu, 7 Aug 2014 23:51:46 +0000 (16:51 -0700)
committerJim Morris <morris@wolfman.com>
Thu, 7 Aug 2014 23:51:46 +0000 (16:51 -0700)
src/modules/tools/endstops/Endstops.cpp

index f5c4141..a192d24 100644 (file)
 
 // Homing States
 enum{
-    NOT_HOMING,
     MOVING_TO_ORIGIN_FAST,
     MOVING_BACK,
     MOVING_TO_ORIGIN_SLOW,
+    NOT_HOMING,
     BACK_OFF_HOME,
     MOVE_TO_ZERO,
     LIMIT_TRIGGERED
@@ -286,6 +286,9 @@ void Endstops::move_to_zero(char axes_to_move)
 {
     if( (axes_to_move&0x03) != 3 ) return; // ignore if X and Y not homing
 
+    // Do we need to check if we are already at 0,0? probably not as the G0 will not do anything if we are
+    // float pos[3]; THEKERNEL->robot->get_axis_position(pos); if(pos[0] == 0 && pos[1] == 0) return;
+
     this->status = MOVE_TO_ZERO;
     // Move to center using a regular move, use slower of X and Y fast rate
     float rate= min(this->fast_rates[0], this->fast_rates[1])*60.0F;
@@ -698,7 +701,7 @@ void Endstops::on_gcode_received(void *argument)
 // Called periodically to change the speed to match acceleration
 uint32_t Endstops::acceleration_tick(uint32_t dummy)
 {
-    if(this->status == NOT_HOMING) return(0); // nothing to do
+    if(this->status >= NOT_HOMING) return(0); // nothing to do, only do this when moving for homing sequence
 
     // foreach stepper that is moving
     for ( int c = X_AXIS; c <= Z_AXIS; c++ ) {