chiark / gitweb /
Software endstps added
authorErik van der Zalm <erik@vdzalm.eu>
Thu, 15 Sep 2011 15:37:58 +0000 (17:37 +0200)
committerErik van der Zalm <erik@vdzalm.eu>
Thu, 15 Sep 2011 15:37:58 +0000 (17:37 +0200)
Marlin/Marlin.pde

index c6d1ff69131b25fd2382eeee94ee7f03f6a2e1ce..97c120d5a4a4df041bf2f1656707b326b06214c8 100644 (file)
@@ -33,7 +33,7 @@
 #include "Marlin.h"
 #include "speed_lookuptable.h"
 
-char version_string[] = "0.9.8";
+char version_string[] = "0.9.9";
 
 #ifdef SDSUPPORT
 #include "SdFat.h"
@@ -947,6 +947,18 @@ inline void get_coordinates()
 
 void prepare_move()
 {
+  if (min_software_endstops) {
+    if (destination[X_AXIS] < 0) destination[X_AXIS] = 0.0;
+    if (destination[Y_AXIS] < 0) destination[Y_AXIS] = 0.0;
+    if (destination[Z_AXIS] < 0) destination[Z_AXIS] = 0.0;
+  }
+
+  if (max_software_endstops) {
+    if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH;
+    if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH;
+    if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH;
+  }
+
   plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60.0);
   for(int i=0; i < NUM_AXIS; i++) {
     current_position[i] = destination[i];