Fixed soft limits when the origin is in the middle.
HOME_POS is now always where the endstop is and can be outside the limits. The limits are now defined by MIN_POS and MAX_POS rather than HOME_POS and MAX_LENGTH. The Z is axis now homed first if direction is away from the bed. Saguinololu limit pins change from MIN to MAX according to the homing direction.
This commit is contained in:
parent
686011a548
commit
538189cc19
|
@ -187,9 +187,17 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||||
|
|
||||||
#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
|
#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
|
||||||
#define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below.
|
#define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below.
|
||||||
#define X_MAX_LENGTH 205
|
// Travel limits after homing
|
||||||
#define Y_MAX_LENGTH 205
|
#define X_MAX_POS 205
|
||||||
#define Z_MAX_LENGTH 200
|
#define X_MIN_POS 0
|
||||||
|
#define Y_MAX_POS 205
|
||||||
|
#define Y_MIN_POS 0
|
||||||
|
#define Z_MAX_POS 200
|
||||||
|
#define Z_MIN_POS 0
|
||||||
|
|
||||||
|
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
|
||||||
|
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
|
||||||
|
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
|
||||||
|
|
||||||
// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
|
// The position of the homing switches. Use MAX_LENGTH * -0.5 if the center should be 0, 0, 0
|
||||||
#define X_HOME_POS 0
|
#define X_HOME_POS 0
|
||||||
|
|
|
@ -562,7 +562,7 @@ bool code_seen(char code)
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder); \
|
||||||
st_synchronize();\
|
st_synchronize();\
|
||||||
\
|
\
|
||||||
current_position[LETTER##_AXIS] = (LETTER##_HOME_DIR == -1) ? LETTER##_HOME_POS : LETTER##_MAX_LENGTH;\
|
current_position[LETTER##_AXIS] = LETTER##_HOME_POS;\
|
||||||
destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
|
destination[LETTER##_AXIS] = current_position[LETTER##_AXIS];\
|
||||||
feedrate = 0.0;\
|
feedrate = 0.0;\
|
||||||
endstops_hit_on_purpose();\
|
endstops_hit_on_purpose();\
|
||||||
|
@ -656,6 +656,13 @@ void process_commands()
|
||||||
}
|
}
|
||||||
feedrate = 0.0;
|
feedrate = 0.0;
|
||||||
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
|
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
|
||||||
|
|
||||||
|
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
|
||||||
|
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
||||||
|
HOMEAXIS(Z);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef QUICK_HOME
|
#ifdef QUICK_HOME
|
||||||
if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) ) //first diagonal move
|
if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) ) //first diagonal move
|
||||||
{
|
{
|
||||||
|
@ -669,8 +676,8 @@ void process_commands()
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
current_position[X_AXIS] = (X_HOME_DIR == -1) ? X_HOME_POS : X_MAX_LENGTH;
|
current_position[X_AXIS] = X_HOME_POS;
|
||||||
current_position[Y_AXIS] = (Y_HOME_DIR == -1) ? Y_HOME_POS : Y_MAX_LENGTH;
|
current_position[Y_AXIS] = Y_HOME_POS;
|
||||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
destination[X_AXIS] = current_position[X_AXIS];
|
destination[X_AXIS] = current_position[X_AXIS];
|
||||||
destination[Y_AXIS] = current_position[Y_AXIS];
|
destination[Y_AXIS] = current_position[Y_AXIS];
|
||||||
|
@ -690,9 +697,11 @@ void process_commands()
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if Z_HOME_DIR < 0 // If homing towards BED do Z last
|
||||||
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
||||||
HOMEAXIS(Z);
|
HOMEAXIS(Z);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(code_seen(axis_codes[X_AXIS]))
|
if(code_seen(axis_codes[X_AXIS]))
|
||||||
{
|
{
|
||||||
|
@ -1533,15 +1542,15 @@ void get_arc_coordinates()
|
||||||
void prepare_move()
|
void prepare_move()
|
||||||
{
|
{
|
||||||
if (min_software_endstops) {
|
if (min_software_endstops) {
|
||||||
if (destination[X_AXIS] < X_HOME_POS) destination[X_AXIS] = X_HOME_POS;
|
if (destination[X_AXIS] < X_MIN_POS) destination[X_AXIS] = X_MIN_POS;
|
||||||
if (destination[Y_AXIS] < Y_HOME_POS) destination[Y_AXIS] = Y_HOME_POS;
|
if (destination[Y_AXIS] < Y_MIN_POS) destination[Y_AXIS] = Y_MIN_POS;
|
||||||
if (destination[Z_AXIS] < Z_HOME_POS) destination[Z_AXIS] = Z_HOME_POS;
|
if (destination[Z_AXIS] < Z_MIN_POS) destination[Z_AXIS] = Z_MIN_POS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_software_endstops) {
|
if (max_software_endstops) {
|
||||||
if (destination[X_AXIS] > X_MAX_LENGTH) destination[X_AXIS] = X_MAX_LENGTH;
|
if (destination[X_AXIS] > X_MAX_POS) destination[X_AXIS] = X_MAX_POS;
|
||||||
if (destination[Y_AXIS] > Y_MAX_LENGTH) destination[Y_AXIS] = Y_MAX_LENGTH;
|
if (destination[Y_AXIS] > Y_MAX_POS) destination[Y_AXIS] = Y_MAX_POS;
|
||||||
if (destination[Z_AXIS] > Z_MAX_LENGTH) destination[Z_AXIS] = Z_MAX_LENGTH;
|
if (destination[Z_AXIS] > Z_MAX_POS) destination[Z_AXIS] = Z_MAX_POS;
|
||||||
}
|
}
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
|
||||||
|
|
|
@ -572,18 +572,33 @@
|
||||||
|
|
||||||
#define X_STEP_PIN 15
|
#define X_STEP_PIN 15
|
||||||
#define X_DIR_PIN 21
|
#define X_DIR_PIN 21
|
||||||
|
#if X_HOME_DIR < 0
|
||||||
# define X_MIN_PIN 18
|
# define X_MIN_PIN 18
|
||||||
# define X_MAX_PIN -1
|
# define X_MAX_PIN -1
|
||||||
|
#else
|
||||||
|
# define X_MIN_PIN -1
|
||||||
|
# define X_MAX_PIN 18
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Y_STEP_PIN 22
|
#define Y_STEP_PIN 22
|
||||||
#define Y_DIR_PIN 23
|
#define Y_DIR_PIN 23
|
||||||
|
#if Y_HOME_DIR < 0
|
||||||
# define Y_MIN_PIN 19
|
# define Y_MIN_PIN 19
|
||||||
# define Y_MAX_PIN -1
|
# define Y_MAX_PIN -1
|
||||||
|
#else
|
||||||
|
# define Y_MIN_PIN -1
|
||||||
|
# define Y_MAX_PIN 19
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Z_STEP_PIN 3
|
#define Z_STEP_PIN 3
|
||||||
#define Z_DIR_PIN 2
|
#define Z_DIR_PIN 2
|
||||||
|
#if Z_HOME_DIR < 0
|
||||||
# define Z_MIN_PIN 20
|
# define Z_MIN_PIN 20
|
||||||
# define Z_MAX_PIN -1
|
# define Z_MAX_PIN -1
|
||||||
|
#else
|
||||||
|
# define Z_MIN_PIN -1
|
||||||
|
# define Z_MAX_PIN 20
|
||||||
|
#endif
|
||||||
|
|
||||||
#define E0_STEP_PIN 1
|
#define E0_STEP_PIN 1
|
||||||
#define E0_DIR_PIN 0
|
#define E0_DIR_PIN 0
|
||||||
|
|
Loading…
Reference in a new issue