Added software endstops

This commit is contained in:
Erik van der Zalm 2011-11-19 21:32:47 +01:00
parent e02af3e66a
commit 915ef2d4a1
2 changed files with 13 additions and 1 deletions

View 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];

View 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