mirror of
https://github.com/braillerap/BrailleRap.git
synced 2025-06-07 17:39:58 +02:00
Y Homing
This commit is contained in:
parent
3336f77f89
commit
5f285579dd
@ -157,6 +157,8 @@
|
|||||||
//#define LCD_FEEDBACK_FREQUENCY_HZ 440
|
//#define LCD_FEEDBACK_FREQUENCY_HZ 440
|
||||||
//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 250
|
//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 250
|
||||||
|
|
||||||
|
#define PAPER_LOADING_HOME_Y 1 // homing Y load paper, you mut use YMIN endstop
|
||||||
|
|
||||||
// FIN BRAILLE RAP CONFIG
|
// FIN BRAILLE RAP CONFIG
|
||||||
|
|
||||||
|
|
||||||
@ -505,7 +507,7 @@
|
|||||||
#define USE_YMIN_PLUG
|
#define USE_YMIN_PLUG
|
||||||
#define USE_ZMIN_PLUG
|
#define USE_ZMIN_PLUG
|
||||||
//#define USE_XMAX_PLUG
|
//#define USE_XMAX_PLUG
|
||||||
#define USE_YMAX_PLUG
|
//#define USE_YMAX_PLUG
|
||||||
//#define USE_ZMAX_PLUG
|
//#define USE_ZMAX_PLUG
|
||||||
|
|
||||||
// coarse Endstop Settings
|
// coarse Endstop Settings
|
||||||
@ -533,7 +535,7 @@
|
|||||||
|
|
||||||
// Enable this feature if all enabled endstop pins are interrupt-capable.
|
// Enable this feature if all enabled endstop pins are interrupt-capable.
|
||||||
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
|
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
|
||||||
//#define ENDSTOP_INTERRUPTS_FEATURE
|
#define ENDSTOP_INTERRUPTS_FEATURE
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//============================== Movement Settings ============================
|
//============================== Movement Settings ============================
|
||||||
@ -780,7 +782,7 @@
|
|||||||
|
|
||||||
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
|
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
|
||||||
#define INVERT_X_DIR false
|
#define INVERT_X_DIR false
|
||||||
#define INVERT_Y_DIR true
|
#define INVERT_Y_DIR false
|
||||||
#define INVERT_Z_DIR false
|
#define INVERT_Z_DIR false
|
||||||
|
|
||||||
// Enable this option for Toshiba stepper drivers
|
// Enable this option for Toshiba stepper drivers
|
||||||
@ -805,7 +807,7 @@
|
|||||||
// Direction of endstops when homing; 1=MAX, -1=MIN
|
// Direction of endstops when homing; 1=MAX, -1=MIN
|
||||||
// :[-1,1]
|
// :[-1,1]
|
||||||
#define X_HOME_DIR -1
|
#define X_HOME_DIR -1
|
||||||
#define Y_HOME_DIR -1
|
#define Y_HOME_DIR 1
|
||||||
#define Z_HOME_DIR -1
|
#define Z_HOME_DIR -1
|
||||||
|
|
||||||
// @section machine
|
// @section machine
|
||||||
@ -911,7 +913,7 @@
|
|||||||
* Turn on with the command 'M111 S32'.
|
* Turn on with the command 'M111 S32'.
|
||||||
* NOTE: Requires a lot of PROGMEM!
|
* NOTE: Requires a lot of PROGMEM!
|
||||||
*/
|
*/
|
||||||
//#define DEBUG_LEVELING_FEATURE
|
#define DEBUG_LEVELING_FEATURE
|
||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
// Gradually reduce leveling correction until a set height is reached,
|
// Gradually reduce leveling correction until a set height is reached,
|
||||||
@ -1050,7 +1052,7 @@
|
|||||||
// Manually set the home position. Leave these undefined for automatic settings.
|
// Manually set the home position. Leave these undefined for automatic settings.
|
||||||
// For DELTA this is the top-center of the Cartesian print volume.
|
// For DELTA this is the top-center of the Cartesian print volume.
|
||||||
//#define MANUAL_X_HOME_POS 0
|
//#define MANUAL_X_HOME_POS 0
|
||||||
//#define MANUAL_Y_HOME_POS 0
|
#define MANUAL_Y_HOME_POS 30
|
||||||
//#define MANUAL_Z_HOME_POS 0
|
//#define MANUAL_Z_HOME_POS 0
|
||||||
|
|
||||||
// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area.
|
// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area.
|
||||||
|
@ -2894,6 +2894,218 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if PAPER_LOADING_HOME_Y
|
||||||
|
static void homeaxis_paperload (const AxisEnum axis)
|
||||||
|
{
|
||||||
|
if (axis != Y_AXIS)
|
||||||
|
return;
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) {
|
||||||
|
SERIAL_ECHOPAIR(">>> homeaxis_paperload(", axis_codes[axis]);
|
||||||
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// update endstop
|
||||||
|
do_homing_move(axis, -home_dir(axis), get_homing_bump_feedrate(axis));
|
||||||
|
|
||||||
|
int ends = Endstops::current_endstop_bits;
|
||||||
|
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) {
|
||||||
|
SERIAL_ECHOPAIR(">>> endstop status (", ends );
|
||||||
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_ECHOLN (ends);
|
||||||
|
SERIAL_ECHOLN ("plop");
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
const int axis_home_dir = home_dir(axis);
|
||||||
|
|
||||||
|
while (Endstops::current_endstop_bits & _BV (Y_MIN))
|
||||||
|
{
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) {
|
||||||
|
SERIAL_ECHOPAIR(">>> bumping move (", -Y_HOME_BUMP_MM );
|
||||||
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
endstops.enable(false);
|
||||||
|
do_homing_move(axis, -Y_HOME_BUMP_MM, get_homing_bump_feedrate(axis));
|
||||||
|
endstops.enable(true);
|
||||||
|
do_homing_move(axis, -axis_home_dir, get_homing_bump_feedrate(axis));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) {
|
||||||
|
SERIAL_ECHOPAIR(">>> postbump endstop status (", Endstops::current_endstop_bits );
|
||||||
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_ECHOLN (ends);
|
||||||
|
SERIAL_ECHOLN ("plop");
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// Set flags for X, Y, Z motor locking
|
||||||
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||||
|
if (axis == X_AXIS) stepper.set_homing_flag_x(true);
|
||||||
|
#endif
|
||||||
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||||
|
if (axis == Y_AXIS) stepper.set_homing_flag_y(true);
|
||||||
|
#endif
|
||||||
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
|
if (axis == Z_AXIS) stepper.set_homing_flag_z(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Disable stealthChop if used. Enable diag1 pin on driver.
|
||||||
|
#if ENABLED(SENSORLESS_HOMING)
|
||||||
|
#if ENABLED(X_IS_TMC2130)
|
||||||
|
if (axis == X_AXIS) tmc_sensorless_homing(stepperX);
|
||||||
|
#endif
|
||||||
|
#if ENABLED(Y_IS_TMC2130)
|
||||||
|
if (axis == Y_AXIS) tmc_sensorless_homing(stepperY);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Fast move towards endstop until triggered
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 1 Fast:");
|
||||||
|
#endif
|
||||||
|
do_homing_move(axis, 1.5 * max_length(axis) * axis_home_dir);
|
||||||
|
|
||||||
|
//sgn
|
||||||
|
// For cartesian/core machines,
|
||||||
|
// set the axis to its home position
|
||||||
|
set_axis_is_at_home(axis);
|
||||||
|
sync_plan_position();
|
||||||
|
|
||||||
|
destination[axis] = current_position[axis];
|
||||||
|
// fsgn
|
||||||
|
|
||||||
|
// When homing Z with probe respect probe clearance
|
||||||
|
const float bump = axis_home_dir * (
|
||||||
|
#if HOMING_Z_WITH_PROBE
|
||||||
|
(axis == Z_AXIS) ? max(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) :
|
||||||
|
#endif
|
||||||
|
home_bump_mm(axis)
|
||||||
|
);
|
||||||
|
|
||||||
|
// If a second homing move is configured...
|
||||||
|
if (bump) {
|
||||||
|
// Move away from the endstop by the axis HOME_BUMP_MM
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Move Away:");
|
||||||
|
#endif
|
||||||
|
endstops.enable(false);
|
||||||
|
do_homing_move(axis, -bump);
|
||||||
|
|
||||||
|
// Slow move towards endstop until triggered
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 2 Slow:");
|
||||||
|
#endif
|
||||||
|
endstops.enable(true);
|
||||||
|
do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Home axes that have dual endstops... differently
|
||||||
|
*/
|
||||||
|
#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
|
const bool pos_dir = axis_home_dir > 0;
|
||||||
|
#if ENABLED(X_DUAL_ENDSTOPS)
|
||||||
|
if (axis == X_AXIS) {
|
||||||
|
const bool lock_x1 = pos_dir ? (x_endstop_adj > 0) : (x_endstop_adj < 0);
|
||||||
|
const float adj = FABS(x_endstop_adj);
|
||||||
|
if (lock_x1) stepper.set_x_lock(true); else stepper.set_x2_lock(true);
|
||||||
|
do_homing_move(axis, pos_dir ? -adj : adj);
|
||||||
|
if (lock_x1) stepper.set_x_lock(false); else stepper.set_x2_lock(false);
|
||||||
|
stepper.set_homing_flag_x(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||||
|
if (axis == Y_AXIS) {
|
||||||
|
const bool lock_y1 = pos_dir ? (y_endstop_adj > 0) : (y_endstop_adj < 0);
|
||||||
|
const float adj = FABS(y_endstop_adj);
|
||||||
|
if (lock_y1) stepper.set_y_lock(true); else stepper.set_y2_lock(true);
|
||||||
|
do_homing_move(axis, pos_dir ? -adj : adj);
|
||||||
|
if (lock_y1) stepper.set_y_lock(false); else stepper.set_y2_lock(false);
|
||||||
|
stepper.set_homing_flag_y(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
|
if (axis == Z_AXIS) {
|
||||||
|
const bool lock_z1 = pos_dir ? (z_endstop_adj > 0) : (z_endstop_adj < 0);
|
||||||
|
const float adj = FABS(z_endstop_adj);
|
||||||
|
if (lock_z1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
|
||||||
|
do_homing_move(axis, pos_dir ? -adj : adj);
|
||||||
|
if (lock_z1) stepper.set_z_lock(false); else stepper.set_z2_lock(false);
|
||||||
|
stepper.set_homing_flag_z(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if IS_SCARA
|
||||||
|
|
||||||
|
set_axis_is_at_home(axis);
|
||||||
|
SYNC_PLAN_POSITION_KINEMATIC();
|
||||||
|
|
||||||
|
#elif ENABLED(DELTA)
|
||||||
|
|
||||||
|
// Delta has already moved all three towers up in G28
|
||||||
|
// so here it re-homes each tower in turn.
|
||||||
|
// Delta homing treats the axes as normal linear axes.
|
||||||
|
|
||||||
|
// retrace by the amount specified in delta_endstop_adj + additional 0.1mm in order to have minimum steps
|
||||||
|
if (delta_endstop_adj[axis] * Z_HOME_DIR <= 0) {
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("delta_endstop_adj:");
|
||||||
|
#endif
|
||||||
|
do_homing_move(axis, delta_endstop_adj[axis] - 0.1 * Z_HOME_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// For cartesian/core machines,
|
||||||
|
// set the axis to its home position
|
||||||
|
set_axis_is_at_home(axis);
|
||||||
|
sync_plan_position();
|
||||||
|
|
||||||
|
destination[axis] = current_position[axis];
|
||||||
|
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Re-enable stealthChop if used. Disable diag1 pin on driver.
|
||||||
|
#if ENABLED(SENSORLESS_HOMING)
|
||||||
|
#if ENABLED(X_IS_TMC2130)
|
||||||
|
if (axis == X_AXIS) tmc_sensorless_homing(stepperX, false);
|
||||||
|
#endif
|
||||||
|
#if ENABLED(Y_IS_TMC2130)
|
||||||
|
if (axis == Y_AXIS) tmc_sensorless_homing(stepperY, false);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Put away the Z probe
|
||||||
|
#if HOMING_Z_WITH_PROBE
|
||||||
|
if (axis == Z_AXIS && STOW_PROBE()) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (DEBUGGING(LEVELING)) {
|
||||||
|
SERIAL_ECHOPAIR("<<< homeaxis(", axis_codes[axis]);
|
||||||
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Home an individual "raw axis" to its endstop.
|
* Home an individual "raw axis" to its endstop.
|
||||||
* This applies to XYZ on Cartesian and Core robots, and
|
* This applies to XYZ on Cartesian and Core robots, and
|
||||||
@ -4061,8 +4273,12 @@ inline void gcode_G28(const bool always_home_all) {
|
|||||||
|
|
||||||
// Home Y
|
// Home Y
|
||||||
if (home_all || homeY) {
|
if (home_all || homeY) {
|
||||||
|
#if PAPER_LOADING_HOME_Y
|
||||||
|
homeaxis_paperload(Y_AXIS);
|
||||||
|
#else
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#endif
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -4104,7 +4320,11 @@ inline void gcode_G28(const bool always_home_all) {
|
|||||||
#if DISABLED(HOME_Y_BEFORE_X)
|
#if DISABLED(HOME_Y_BEFORE_X)
|
||||||
// Home Y
|
// Home Y
|
||||||
if (home_all || homeY) {
|
if (home_all || homeY) {
|
||||||
|
#if PAPER_LOADING_HOME_Y
|
||||||
|
homeaxis_paperload(Y_AXIS);
|
||||||
|
#else
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
|
#endif
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1148,6 +1148,17 @@ static_assert(1 >= 0
|
|||||||
|
|
||||||
// Delta and Cartesian use 3 homing endstops
|
// Delta and Cartesian use 3 homing endstops
|
||||||
#if !IS_SCARA
|
#if !IS_SCARA
|
||||||
|
#if PAPER_LOADING_HOME_Y
|
||||||
|
#if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
|
||||||
|
#error "Enable USE_XMIN_PLUG when homing X to MIN."
|
||||||
|
#elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
|
||||||
|
#error "Enable USE_XMAX_PLUG when homing X to MAX."
|
||||||
|
#elif Y_HOME_DIR < 0 && DISABLED(USE_YMIN_PLUG)
|
||||||
|
#error "Enable USE_YMIN_PLUG when homing Y to MIN."
|
||||||
|
#elif Y_HOME_DIR > 0 && DISABLED(USE_YMIN_PLUG)
|
||||||
|
#error "Enable USE_YMIN_PLUG when homing Y from MAX."
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
#if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
|
#if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
|
||||||
#error "Enable USE_XMIN_PLUG when homing X to MIN."
|
#error "Enable USE_XMIN_PLUG when homing X to MIN."
|
||||||
#elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
|
#elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
|
||||||
@ -1157,6 +1168,7 @@ static_assert(1 >= 0
|
|||||||
#elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
|
#elif Y_HOME_DIR > 0 && DISABLED(USE_YMAX_PLUG)
|
||||||
#error "Enable USE_YMAX_PLUG when homing Y to MAX."
|
#error "Enable USE_YMAX_PLUG when homing Y to MAX."
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if Z_HOME_DIR < 0 && DISABLED(USE_ZMIN_PLUG)
|
#if Z_HOME_DIR < 0 && DISABLED(USE_ZMIN_PLUG)
|
||||||
#error "Enable USE_ZMIN_PLUG when homing Z to MIN."
|
#error "Enable USE_ZMIN_PLUG when homing Z to MIN."
|
||||||
|
@ -465,18 +465,25 @@ void Endstops::update() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else { // +direction
|
else { // +direction
|
||||||
#if HAS_Y_MAX
|
#if PAPER_LOADING_HOME_Y
|
||||||
#if ENABLED(Y_DUAL_ENDSTOPS)
|
#if HAS_Y_MIN
|
||||||
UPDATE_ENDSTOP_BIT(Y, MAX);
|
UPDATE_ENDSTOP(Y, MIN);
|
||||||
#if HAS_Y2_MAX
|
#endif
|
||||||
UPDATE_ENDSTOP_BIT(Y2, MAX);
|
#else
|
||||||
#else
|
#if HAS_Y_MAX
|
||||||
COPY_BIT(current_endstop_bits, Y_MAX, Y2_MAX);
|
#if ENABLED(Y_DUAL_ENDSTOPS)
|
||||||
#endif
|
UPDATE_ENDSTOP_BIT(Y, MAX);
|
||||||
test_dual_y_endstops(Y_MAX, Y2_MAX);
|
#if HAS_Y2_MAX
|
||||||
#else
|
UPDATE_ENDSTOP_BIT(Y2, MAX);
|
||||||
UPDATE_ENDSTOP(Y, MAX);
|
#else
|
||||||
#endif
|
COPY_BIT(current_endstop_bits, Y_MAX, Y2_MAX);
|
||||||
|
#endif
|
||||||
|
test_dual_y_endstops(Y_MAX, Y2_MAX);
|
||||||
|
#else
|
||||||
|
UPDATE_ENDSTOP(Y, MAX);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user