chiark / gitweb /
Added software endstops
authorErik van der Zalm <erik@vdzalm.eu>
Sat, 19 Nov 2011 20:32:47 +0000 (21:32 +0100)
committerErik van der Zalm <erik@vdzalm.eu>
Sat, 19 Nov 2011 20:32:47 +0000 (21:32 +0100)
Marlin/Marlin.pde
Marlin/planner.h

index f619854da3625a04efdb20ca2fca09dca25514e5..aee00ac4a5107609737fe4ea295030134595a3e5 100644 (file)
@@ -1024,6 +1024,18 @@ inline void get_arc_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*feedmultiply/60/100.0);
   for(int8_t i=0; i < NUM_AXIS; i++) {
     current_position[i] = destination[i];
index ec497d50648171974487cef8c20b1c55bdccb9da..52a6fba81318d0da9f8f90b7d89e9b50916a5cba 100644 (file)
@@ -31,7 +31,7 @@
 typedef struct {
   // Fields used by the bresenham algorithm for tracing the line
   long steps_x, steps_y, steps_z, steps_e;  // Step count along each axis
-  long step_event_count;                    // The number of step events required to complete this block
+  unsigned long step_event_count;           // The number of step events required to complete this block
   long accelerate_until;                    // The index of the step event on which to stop acceleration
   long decelerate_after;                    // The index of the step event on which to start decelerating
   long acceleration_rate;                   // The acceleration rate used for acceleration calculation