Merge pull request #2063 from chris-bo/autobed_sled
improve sled handling
This commit is contained in:
commit
bd20bd5444
|
@ -276,6 +276,13 @@
|
||||||
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
|
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sled Options
|
||||||
|
*/
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
#define Z_SAFE_HOMING
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MAX_STEP_FREQUENCY differs for TOSHIBA
|
* MAX_STEP_FREQUENCY differs for TOSHIBA
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -650,8 +650,8 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_PROBE_SLED
|
#ifdef Z_PROBE_SLED
|
||||||
pinMode(SERVO0_PIN, OUTPUT);
|
pinMode(SLED_PIN, OUTPUT);
|
||||||
digitalWrite(SERVO0_PIN, LOW); // turn it off
|
digitalWrite(SLED_PIN, LOW); // turn it off
|
||||||
#endif // Z_PROBE_SLED
|
#endif // Z_PROBE_SLED
|
||||||
|
|
||||||
setup_homepin();
|
setup_homepin();
|
||||||
|
@ -1516,6 +1516,47 @@ static void setup_for_endstop_move() {
|
||||||
|
|
||||||
#endif // ENABLE_AUTO_BED_LEVELING
|
#endif // ENABLE_AUTO_BED_LEVELING
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
|
||||||
|
#ifndef SLED_DOCKING_OFFSET
|
||||||
|
#define SLED_DOCKING_OFFSET 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to dock/undock a sled designed by Charles Bell.
|
||||||
|
*
|
||||||
|
* dock[in] If true, move to MAX_X and engage the electromagnet
|
||||||
|
* offset[in] The additional distance to move to adjust docking location
|
||||||
|
*/
|
||||||
|
static void dock_sled(bool dock, int offset=0) {
|
||||||
|
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
||||||
|
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
||||||
|
SERIAL_ECHO_START;
|
||||||
|
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dock) {
|
||||||
|
float oldXpos = current_position[X_AXIS]; // save x position
|
||||||
|
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); // rise Z
|
||||||
|
do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset - 1, current_position[Y_AXIS], current_position[Z_AXIS]); // Dock sled a bit closer to ensure proper capturing
|
||||||
|
digitalWrite(SLED_PIN, LOW); // turn off magnet
|
||||||
|
do_blocking_move_to(oldXpos, current_position[Y_AXIS], current_position[Z_AXIS]); // return to position before docking
|
||||||
|
} else {
|
||||||
|
float oldXpos = current_position[X_AXIS]; // save x position
|
||||||
|
float z_loc = current_position[Z_AXIS];
|
||||||
|
if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING;
|
||||||
|
do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], z_loc); // this also updates current_position
|
||||||
|
digitalWrite(SLED_PIN, HIGH); // turn on magnet
|
||||||
|
do_blocking_move_to(oldXpos, current_position[Y_AXIS], current_position[Z_AXIS]); // return to position before docking
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // Z_PROBE_SLED
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Home an individual axis
|
* Home an individual axis
|
||||||
*/
|
*/
|
||||||
|
@ -1538,6 +1579,13 @@ static void homeaxis(AxisEnum axis) {
|
||||||
current_position[axis] = 0;
|
current_position[axis] = 0;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
// Get Probe
|
||||||
|
if (axis == Z_AXIS) {
|
||||||
|
if (axis_home_dir < 0) dock_sled(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SERVO_LEVELING && !defined(Z_PROBE_SLED)
|
#if SERVO_LEVELING && !defined(Z_PROBE_SLED)
|
||||||
|
|
||||||
// Deploy a probe if there is one, and homing towards the bed
|
// Deploy a probe if there is one, and homing towards the bed
|
||||||
|
@ -1634,6 +1682,13 @@ static void homeaxis(AxisEnum axis) {
|
||||||
endstops_hit_on_purpose(); // clear endstop hit flags
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
||||||
axis_known_position[axis] = true;
|
axis_known_position[axis] = true;
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
// bring probe back
|
||||||
|
if (axis == Z_AXIS) {
|
||||||
|
if (axis_home_dir < 0) dock_sled(true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SERVO_LEVELING && !defined(Z_PROBE_SLED)
|
#if SERVO_LEVELING && !defined(Z_PROBE_SLED)
|
||||||
|
|
||||||
// Deploy a probe if there is one, and homing towards the bed
|
// Deploy a probe if there is one, and homing towards the bed
|
||||||
|
@ -1708,39 +1763,6 @@ static void homeaxis(AxisEnum axis) {
|
||||||
|
|
||||||
#endif // FWRETRACT
|
#endif // FWRETRACT
|
||||||
|
|
||||||
#ifdef Z_PROBE_SLED
|
|
||||||
|
|
||||||
#ifndef SLED_DOCKING_OFFSET
|
|
||||||
#define SLED_DOCKING_OFFSET 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to dock/undock a sled designed by Charles Bell.
|
|
||||||
*
|
|
||||||
* dock[in] If true, move to MAX_X and engage the electromagnet
|
|
||||||
* offset[in] The additional distance to move to adjust docking location
|
|
||||||
*/
|
|
||||||
static void dock_sled(bool dock, int offset=0) {
|
|
||||||
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
|
||||||
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
|
||||||
SERIAL_ECHO_START;
|
|
||||||
SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dock) {
|
|
||||||
do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, current_position[Y_AXIS], current_position[Z_AXIS]); // this also updates current_position
|
|
||||||
digitalWrite(SERVO0_PIN, LOW); // turn off magnet
|
|
||||||
} else {
|
|
||||||
float z_loc = current_position[Z_AXIS];
|
|
||||||
if (z_loc < Z_RAISE_BEFORE_PROBING + 5) z_loc = Z_RAISE_BEFORE_PROBING;
|
|
||||||
do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset, Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc); // this also updates current_position
|
|
||||||
digitalWrite(SERVO0_PIN, HIGH); // turn on magnet
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // Z_PROBE_SLED
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* G-Code Handler functions
|
* G-Code Handler functions
|
||||||
|
@ -2584,7 +2606,7 @@ inline void gcode_G28() {
|
||||||
#endif // !DELTA
|
#endif // !DELTA
|
||||||
|
|
||||||
#ifdef Z_PROBE_SLED
|
#ifdef Z_PROBE_SLED
|
||||||
dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
|
dock_sled(true); // dock the probe
|
||||||
#elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
|
#elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
|
||||||
stow_z_probe();
|
stow_z_probe();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
#define LARGE_FLASH true
|
#define LARGE_FLASH true
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
#define SLED_PIN -1
|
||||||
|
#endif
|
||||||
|
|
||||||
// Servo support
|
// Servo support
|
||||||
#ifdef NUM_SERVOS
|
#ifdef NUM_SERVOS
|
||||||
#define SERVO0_PIN 46 //AUX3-6
|
#define SERVO0_PIN 46 //AUX3-6
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
#define SLED_PIN -1
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef X_MS1_PIN
|
#undef X_MS1_PIN
|
||||||
#undef X_MS2_PIN
|
#undef X_MS2_PIN
|
||||||
#undef Y_MS1_PIN
|
#undef Y_MS1_PIN
|
||||||
|
|
|
@ -134,6 +134,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
#define SLED_PIN -1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ULTRA_LCD
|
#ifdef ULTRA_LCD
|
||||||
|
|
||||||
#ifdef NEWPANEL
|
#ifdef NEWPANEL
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
#define FAN_PIN 4
|
#define FAN_PIN 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Z_PROBE_SLED
|
||||||
|
#define SLED_PIN -1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NUM_SERVOS
|
#ifdef NUM_SERVOS
|
||||||
#define SERVO0_PIN -1
|
#define SERVO0_PIN -1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue