diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index d942047b76..754dc3618c 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -1035,6 +1035,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]; diff --git a/Marlin/planner.h b/Marlin/planner.h index ec497d5064..52a6fba813 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -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