chiark / gitweb /
software endstops: use *_MIN_POS and *_MAX_POS for arcs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 9 Aug 2012 17:15:32 +0000 (18:15 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 9 Aug 2012 17:15:32 +0000 (18:15 +0100)
If [XYZ]_HOME_POS and [XYZ]_MIN_POS aren't 0, these corrections are
wrong.  Use the same logic as in Marlin.pde:prepare_move: ie, clamp to
[XYZ]_{MIN,MAX}_POS.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Marlin/motion_control.cpp

index f11d8c8b8e5ec6b24e7cf512d6f6a8b8a96c6f04..a10d73f8cd786ab1db875d8eab14f5f8459075cf 100644 (file)
@@ -126,15 +126,15 @@ void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8
     arc_target[E_AXIS] += extruder_per_segment;
 
     if (min_software_endstops) {
-      if (arc_target[X_AXIS] < X_HOME_POS) arc_target[X_AXIS] = X_HOME_POS;
-      if (arc_target[Y_AXIS] < Y_HOME_POS) arc_target[Y_AXIS] = Y_HOME_POS;
-      if (arc_target[Z_AXIS] < Z_HOME_POS) arc_target[Z_AXIS] = Z_HOME_POS;
+      if (arc_target[X_AXIS] < X_MIN_POS) arc_target[X_AXIS] = X_MIN_POS;
+      if (arc_target[Y_AXIS] < Y_MIN_POS) arc_target[Y_AXIS] = Y_MIN_POS;
+      if (arc_target[Z_AXIS] < Z_MIN_POS) arc_target[Z_AXIS] = Z_MIN_POS;
     }
 
     if (max_software_endstops) {
-      if (arc_target[X_AXIS] > X_MAX_LENGTH) arc_target[X_AXIS] = X_MAX_LENGTH;
-      if (arc_target[Y_AXIS] > Y_MAX_LENGTH) arc_target[Y_AXIS] = Y_MAX_LENGTH;
-      if (arc_target[Z_AXIS] > Z_MAX_LENGTH) arc_target[Z_AXIS] = Z_MAX_LENGTH;
+      if (arc_target[X_AXIS] > X_MAX_POS) arc_target[X_AXIS] = X_MAX_POS;
+      if (arc_target[Y_AXIS] > Y_MAX_POS) arc_target[Y_AXIS] = Y_MAX_POS;
+      if (arc_target[Z_AXIS] > Z_MAX_POS) arc_target[Z_AXIS] = Z_MAX_POS;
     }
     plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, extruder);