|
|
@ -48,6 +48,7 @@
|
|
|
|
#include "ultralcd.h"
|
|
|
|
#include "ultralcd.h"
|
|
|
|
#include "planner.h"
|
|
|
|
#include "planner.h"
|
|
|
|
#include "stepper.h"
|
|
|
|
#include "stepper.h"
|
|
|
|
|
|
|
|
#include "endstops.h"
|
|
|
|
#include "temperature.h"
|
|
|
|
#include "temperature.h"
|
|
|
|
#include "cardreader.h"
|
|
|
|
#include "cardreader.h"
|
|
|
|
#include "configuration_store.h"
|
|
|
|
#include "configuration_store.h"
|
|
|
@ -148,7 +149,7 @@
|
|
|
|
* M84 - Disable steppers until next move,
|
|
|
|
* M84 - Disable steppers until next move,
|
|
|
|
* or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
|
|
|
* or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
|
|
|
* M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
|
|
|
* M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
|
|
|
* M92 - Set axis_steps_per_unit - same syntax as G92
|
|
|
|
* M92 - Set planner.axis_steps_per_unit - same syntax as G92
|
|
|
|
* M104 - Set extruder target temp
|
|
|
|
* M104 - Set extruder target temp
|
|
|
|
* M105 - Read current temp
|
|
|
|
* M105 - Read current temp
|
|
|
|
* M106 - Fan on
|
|
|
|
* M106 - Fan on
|
|
|
@ -539,7 +540,7 @@ static void report_current_position();
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
calculate_delta(current_position);
|
|
|
|
calculate_delta(current_position);
|
|
|
|
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
planner.set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -547,10 +548,6 @@ static void report_current_position();
|
|
|
|
float extrude_min_temp = EXTRUDE_MINTEMP;
|
|
|
|
float extrude_min_temp = EXTRUDE_MINTEMP;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HAS_Z_MIN_PROBE)
|
|
|
|
|
|
|
|
extern volatile bool z_probe_is_active;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
#include "SdFatUtil.h"
|
|
|
|
#include "SdFatUtil.h"
|
|
|
|
int freeMemory() { return SdFatUtil::FreeRam(); }
|
|
|
|
int freeMemory() { return SdFatUtil::FreeRam(); }
|
|
|
@ -711,7 +708,7 @@ void servo_init() {
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_SERVO_ENDSTOPS
|
|
|
|
#if HAS_SERVO_ENDSTOPS
|
|
|
|
|
|
|
|
|
|
|
|
z_probe_is_active = false;
|
|
|
|
endstops.enable_z_probe(false);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Set position of all defined Servo Endstops
|
|
|
|
* Set position of all defined Servo Endstops
|
|
|
@ -820,7 +817,6 @@ void setup() {
|
|
|
|
lcd_init();
|
|
|
|
lcd_init();
|
|
|
|
|
|
|
|
|
|
|
|
tp_init(); // Initialize temperature loop
|
|
|
|
tp_init(); // Initialize temperature loop
|
|
|
|
plan_init(); // Initialize planner;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) || ENABLED(SCARA)
|
|
|
|
#if ENABLED(DELTA) || ENABLED(SCARA)
|
|
|
|
// Vital to init kinematic equivalent for X0 Y0 Z0
|
|
|
|
// Vital to init kinematic equivalent for X0 Y0 Z0
|
|
|
@ -831,7 +827,7 @@ void setup() {
|
|
|
|
watchdog_init();
|
|
|
|
watchdog_init();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
st_init(); // Initialize stepper, this enables interrupts!
|
|
|
|
stepper.init(); // Initialize stepper, this enables interrupts!
|
|
|
|
setup_photpin();
|
|
|
|
setup_photpin();
|
|
|
|
servo_init();
|
|
|
|
servo_init();
|
|
|
|
|
|
|
|
|
|
|
@ -915,7 +911,7 @@ void loop() {
|
|
|
|
commands_in_queue--;
|
|
|
|
commands_in_queue--;
|
|
|
|
cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
|
|
|
|
cmd_queue_index_r = (cmd_queue_index_r + 1) % BUFSIZE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkHitEndstops();
|
|
|
|
endstops.report_state();
|
|
|
|
idle();
|
|
|
|
idle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1408,17 +1404,17 @@ inline void set_homing_bump_feedrate(AxisEnum axis) {
|
|
|
|
// (or from wherever it has been told it is located).
|
|
|
|
// (or from wherever it has been told it is located).
|
|
|
|
//
|
|
|
|
//
|
|
|
|
inline void line_to_current_position() {
|
|
|
|
inline void line_to_current_position() {
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inline void line_to_z(float zPosition) {
|
|
|
|
inline void line_to_z(float zPosition) {
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate / 60, active_extruder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// line_to_destination
|
|
|
|
// line_to_destination
|
|
|
|
// Move the planner, not necessarily synced with current_position
|
|
|
|
// Move the planner, not necessarily synced with current_position
|
|
|
|
//
|
|
|
|
//
|
|
|
|
inline void line_to_destination(float mm_m) {
|
|
|
|
inline void line_to_destination(float mm_m) {
|
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m / 60, active_extruder);
|
|
|
|
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], mm_m / 60, active_extruder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inline void line_to_destination() {
|
|
|
|
inline void line_to_destination() {
|
|
|
|
line_to_destination(feedrate);
|
|
|
|
line_to_destination(feedrate);
|
|
|
@ -1433,9 +1429,9 @@ inline void sync_plan_position() {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
planner.set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inline void sync_plan_position_e() { plan_set_e_position(current_position[E_AXIS]); }
|
|
|
|
inline void sync_plan_position_e() { planner.set_e_position(current_position[E_AXIS]); }
|
|
|
|
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
|
|
|
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
|
|
|
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
|
|
|
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
|
|
|
|
|
|
|
|
|
|
@ -1445,9 +1441,9 @@ static void setup_for_endstop_move() {
|
|
|
|
feedrate_multiplier = 100;
|
|
|
|
feedrate_multiplier = 100;
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("setup_for_endstop_move > enable_endstops(true)");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("setup_for_endstop_move > endstops.enable()");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
enable_endstops(true);
|
|
|
|
endstops.enable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
@ -1462,7 +1458,7 @@ static void setup_for_endstop_move() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
calculate_delta(destination);
|
|
|
|
calculate_delta(destination);
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
|
|
set_current_to_destination();
|
|
|
|
set_current_to_destination();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -1473,21 +1469,21 @@ static void setup_for_endstop_move() {
|
|
|
|
|
|
|
|
|
|
|
|
static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
|
|
|
static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
|
|
|
|
|
|
|
|
|
|
|
//plan_bed_level_matrix.debug("bed level before");
|
|
|
|
//planner.bed_level_matrix.debug("bed level before");
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
plan_bed_level_matrix.set_to_identity();
|
|
|
|
planner.bed_level_matrix.set_to_identity();
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
vector_3 uncorrected_position = plan_get_position();
|
|
|
|
vector_3 uncorrected_position = planner.adjusted_position();
|
|
|
|
DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
|
|
|
DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
|
|
|
DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
|
|
|
DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
|
|
|
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
|
|
|
plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
|
|
planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
|
|
|
|
|
|
|
|
|
|
vector_3 corrected_position = plan_get_position();
|
|
|
|
vector_3 corrected_position = planner.adjusted_position();
|
|
|
|
current_position[X_AXIS] = corrected_position.x;
|
|
|
|
current_position[X_AXIS] = corrected_position.x;
|
|
|
|
current_position[Y_AXIS] = corrected_position.y;
|
|
|
|
current_position[Y_AXIS] = corrected_position.y;
|
|
|
|
current_position[Z_AXIS] = corrected_position.z;
|
|
|
|
current_position[Z_AXIS] = corrected_position.z;
|
|
|
@ -1505,7 +1501,7 @@ static void setup_for_endstop_move() {
|
|
|
|
|
|
|
|
|
|
|
|
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
|
|
|
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
|
|
|
|
|
|
|
|
|
|
|
plan_bed_level_matrix.set_to_identity();
|
|
|
|
planner.bed_level_matrix.set_to_identity();
|
|
|
|
|
|
|
|
|
|
|
|
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
|
|
|
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
|
|
|
vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
|
|
|
vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
|
|
@ -1518,9 +1514,9 @@ static void setup_for_endstop_move() {
|
|
|
|
planeNormal.z = -planeNormal.z;
|
|
|
|
planeNormal.z = -planeNormal.z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
|
|
planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
|
|
|
|
|
|
|
|
|
|
vector_3 corrected_position = plan_get_position();
|
|
|
|
vector_3 corrected_position = planner.adjusted_position();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
@ -1553,7 +1549,7 @@ static void setup_for_endstop_move() {
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
|
|
|
|
|
|
|
|
float start_z = current_position[Z_AXIS];
|
|
|
|
float start_z = current_position[Z_AXIS];
|
|
|
|
long start_steps = st_get_position(Z_AXIS);
|
|
|
|
long start_steps = stepper.position(Z_AXIS);
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("run_z_probe (DELTA) 1");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("run_z_probe (DELTA) 1");
|
|
|
@ -1563,15 +1559,15 @@ static void setup_for_endstop_move() {
|
|
|
|
feedrate = homing_feedrate[Z_AXIS] / 4;
|
|
|
|
feedrate = homing_feedrate[Z_AXIS] / 4;
|
|
|
|
destination[Z_AXIS] = -10;
|
|
|
|
destination[Z_AXIS] = -10;
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* We have to let the planner know where we are right now as it
|
|
|
|
* We have to let the planner know where we are right now as it
|
|
|
|
* is not where we said to go.
|
|
|
|
* is not where we said to go.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
long stop_steps = st_get_position(Z_AXIS);
|
|
|
|
long stop_steps = stepper.position(Z_AXIS);
|
|
|
|
float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS];
|
|
|
|
float mm = start_z - float(start_steps - stop_steps) / planner.axis_steps_per_unit[Z_AXIS];
|
|
|
|
current_position[Z_AXIS] = mm;
|
|
|
|
current_position[Z_AXIS] = mm;
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
@ -1582,17 +1578,17 @@ static void setup_for_endstop_move() {
|
|
|
|
|
|
|
|
|
|
|
|
#else // !DELTA
|
|
|
|
#else // !DELTA
|
|
|
|
|
|
|
|
|
|
|
|
plan_bed_level_matrix.set_to_identity();
|
|
|
|
planner.bed_level_matrix.set_to_identity();
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
// Move down until the Z probe (or endstop?) is triggered
|
|
|
|
// Move down until the Z probe (or endstop?) is triggered
|
|
|
|
float zPosition = -(Z_MAX_LENGTH + 10);
|
|
|
|
float zPosition = -(Z_MAX_LENGTH + 10);
|
|
|
|
line_to_z(zPosition);
|
|
|
|
line_to_z(zPosition);
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
// Tell the planner where we ended up - Get this from the stepper handler
|
|
|
|
// Tell the planner where we ended up - Get this from the stepper handler
|
|
|
|
zPosition = st_get_axis_position_mm(Z_AXIS);
|
|
|
|
zPosition = stepper.get_axis_position_mm(Z_AXIS);
|
|
|
|
plan_set_position(
|
|
|
|
planner.set_position(
|
|
|
|
current_position[X_AXIS], current_position[Y_AXIS], zPosition,
|
|
|
|
current_position[X_AXIS], current_position[Y_AXIS], zPosition,
|
|
|
|
current_position[E_AXIS]
|
|
|
|
current_position[E_AXIS]
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -1600,19 +1596,19 @@ static void setup_for_endstop_move() {
|
|
|
|
// move up the retract distance
|
|
|
|
// move up the retract distance
|
|
|
|
zPosition += home_bump_mm(Z_AXIS);
|
|
|
|
zPosition += home_bump_mm(Z_AXIS);
|
|
|
|
line_to_z(zPosition);
|
|
|
|
line_to_z(zPosition);
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
|
|
|
|
|
|
|
|
// move back down slowly to find bed
|
|
|
|
// move back down slowly to find bed
|
|
|
|
set_homing_bump_feedrate(Z_AXIS);
|
|
|
|
set_homing_bump_feedrate(Z_AXIS);
|
|
|
|
|
|
|
|
|
|
|
|
zPosition -= home_bump_mm(Z_AXIS) * 2;
|
|
|
|
zPosition -= home_bump_mm(Z_AXIS) * 2;
|
|
|
|
line_to_z(zPosition);
|
|
|
|
line_to_z(zPosition);
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
|
|
|
|
|
|
|
|
// Get the current stepper position after bumping an endstop
|
|
|
|
// Get the current stepper position after bumping an endstop
|
|
|
|
current_position[Z_AXIS] = st_get_axis_position_mm(Z_AXIS);
|
|
|
|
current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
@ -1641,7 +1637,7 @@ static void setup_for_endstop_move() {
|
|
|
|
destination[Y_AXIS] = y;
|
|
|
|
destination[Y_AXIS] = y;
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
@ -1649,14 +1645,14 @@ static void setup_for_endstop_move() {
|
|
|
|
|
|
|
|
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
feedrate = xy_travel_speed;
|
|
|
|
feedrate = xy_travel_speed;
|
|
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = x;
|
|
|
|
current_position[X_AXIS] = x;
|
|
|
|
current_position[Y_AXIS] = y;
|
|
|
|
current_position[Y_AXIS] = y;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -1681,9 +1677,9 @@ static void setup_for_endstop_move() {
|
|
|
|
|
|
|
|
|
|
|
|
static void clean_up_after_endstop_move() {
|
|
|
|
static void clean_up_after_endstop_move() {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > endstops_not_homing()");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > endstops.not_homing()");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
endstops_not_homing();
|
|
|
|
endstops.not_homing();
|
|
|
|
feedrate = saved_feedrate;
|
|
|
|
feedrate = saved_feedrate;
|
|
|
|
feedrate_multiplier = saved_feedrate_multiplier;
|
|
|
|
feedrate_multiplier = saved_feedrate_multiplier;
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
@ -1697,7 +1693,7 @@ static void setup_for_endstop_move() {
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("deploy_z_probe", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("deploy_z_probe", current_position);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (z_probe_is_active) return;
|
|
|
|
if (endstops.z_probe_enabled) return;
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_SERVO_ENDSTOPS
|
|
|
|
#if HAS_SERVO_ENDSTOPS
|
|
|
|
|
|
|
|
|
|
|
@ -1757,7 +1753,7 @@ static void setup_for_endstop_move() {
|
|
|
|
destination[Y_AXIS] = destination[Y_AXIS] * 0.75;
|
|
|
|
destination[Y_AXIS] = destination[Y_AXIS] * 0.75;
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
z_probe_endstop = (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING);
|
|
|
|
z_probe_endstop = (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING);
|
|
|
@ -1778,10 +1774,10 @@ static void setup_for_endstop_move() {
|
|
|
|
#endif // Z_PROBE_ALLEN_KEY
|
|
|
|
#endif // Z_PROBE_ALLEN_KEY
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FIX_MOUNTED_PROBE)
|
|
|
|
#if ENABLED(FIX_MOUNTED_PROBE)
|
|
|
|
// Noting to be done. Just set z_probe_is_active
|
|
|
|
// Noting to be done. Just set endstops.z_probe_enabled
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
z_probe_is_active = true;
|
|
|
|
endstops.enable_z_probe();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1793,7 +1789,7 @@ static void setup_for_endstop_move() {
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("stow_z_probe", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("stow_z_probe", current_position);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!z_probe_is_active) return;
|
|
|
|
if (!endstops.z_probe_enabled) return;
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_SERVO_ENDSTOPS
|
|
|
|
#if HAS_SERVO_ENDSTOPS
|
|
|
|
|
|
|
|
|
|
|
@ -1811,7 +1807,7 @@ static void setup_for_endstop_move() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
raise_z_after_probing(); // this also updates current_position
|
|
|
|
raise_z_after_probing(); // this also updates current_position
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -1861,7 +1857,7 @@ static void setup_for_endstop_move() {
|
|
|
|
destination[Y_AXIS] = 0;
|
|
|
|
destination[Y_AXIS] = 0;
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
prepare_move_raw(); // this will also set_current_to_destination
|
|
|
|
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
|
|
|
bool z_probe_endstop = (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING);
|
|
|
|
bool z_probe_endstop = (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING);
|
|
|
@ -1881,10 +1877,10 @@ static void setup_for_endstop_move() {
|
|
|
|
#endif // Z_PROBE_ALLEN_KEY
|
|
|
|
#endif // Z_PROBE_ALLEN_KEY
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(FIX_MOUNTED_PROBE)
|
|
|
|
#if ENABLED(FIX_MOUNTED_PROBE)
|
|
|
|
// Nothing to do here. Just clear z_probe_is_active
|
|
|
|
// Nothing to do here. Just clear endstops.z_probe_enabled
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
z_probe_is_active = false;
|
|
|
|
endstops.enable_z_probe(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // HAS_Z_MIN_PROBE
|
|
|
|
#endif // HAS_Z_MIN_PROBE
|
|
|
|
|
|
|
|
|
|
|
@ -2081,13 +2077,13 @@ static void setup_for_endstop_move() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (z_probe_is_active == dock) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS]) {
|
|
|
|
if (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS]) {
|
|
|
|
axis_unhomed_error();
|
|
|
|
axis_unhomed_error();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (endstops.z_probe_enabled == !dock) return; // already docked/undocked?
|
|
|
|
|
|
|
|
|
|
|
|
float oldXpos = current_position[X_AXIS]; // save x position
|
|
|
|
float oldXpos = current_position[X_AXIS]; // save x position
|
|
|
|
if (dock) {
|
|
|
|
if (dock) {
|
|
|
|
#if Z_RAISE_AFTER_PROBING > 0
|
|
|
|
#if Z_RAISE_AFTER_PROBING > 0
|
|
|
@ -2105,7 +2101,7 @@ static void setup_for_endstop_move() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
do_blocking_move_to_x(oldXpos); // return to position before docking
|
|
|
|
do_blocking_move_to_x(oldXpos); // return to position before docking
|
|
|
|
|
|
|
|
|
|
|
|
z_probe_is_active = dock;
|
|
|
|
endstops.enable_z_probe(!dock); // logically disable docked probe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
|
#endif // Z_PROBE_SLED
|
|
|
@ -2167,39 +2163,39 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
// Engage an X or Y Servo endstop if enabled
|
|
|
|
// Engage an X or Y Servo endstop if enabled
|
|
|
|
if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {
|
|
|
|
if (_Z_SERVO_TEST && servo_endstop_id[axis] >= 0) {
|
|
|
|
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]);
|
|
|
|
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][0]);
|
|
|
|
if (_Z_PROBE_SUBTEST) z_probe_is_active = true;
|
|
|
|
if (_Z_PROBE_SUBTEST) endstops.z_probe_enabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Set a flag for Z motor locking
|
|
|
|
// Set a flag for Z motor locking
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
|
|
|
if (axis == Z_AXIS) In_Homing_Process(true);
|
|
|
|
if (axis == Z_AXIS) stepper.set_homing_flag(true);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Move towards the endstop until an endstop is triggered
|
|
|
|
// Move towards the endstop until an endstop is triggered
|
|
|
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
|
|
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
|
|
|
feedrate = homing_feedrate[axis];
|
|
|
|
feedrate = homing_feedrate[axis];
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
// Set the axis position as setup for the move
|
|
|
|
// Set the axis position as setup for the move
|
|
|
|
current_position[axis] = 0;
|
|
|
|
current_position[axis] = 0;
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> enable_endstops(false)");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
enable_endstops(false); // Disable endstops while moving away
|
|
|
|
endstops.enable(false); // Disable endstops while moving away
|
|
|
|
|
|
|
|
|
|
|
|
// Move away from the endstop by the axis HOME_BUMP_MM
|
|
|
|
// Move away from the endstop by the axis HOME_BUMP_MM
|
|
|
|
destination[axis] = -home_bump_mm(axis) * axis_home_dir;
|
|
|
|
destination[axis] = -home_bump_mm(axis) * axis_home_dir;
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> enable_endstops(true)");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
enable_endstops(true); // Enable endstops for next homing move
|
|
|
|
endstops.enable(true); // Enable endstops for next homing move
|
|
|
|
|
|
|
|
|
|
|
|
// Slow down the feedrate for the next move
|
|
|
|
// Slow down the feedrate for the next move
|
|
|
|
set_homing_bump_feedrate(axis);
|
|
|
|
set_homing_bump_feedrate(axis);
|
|
|
@ -2207,7 +2203,7 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
// Move slowly towards the endstop until triggered
|
|
|
|
// Move slowly towards the endstop until triggered
|
|
|
|
destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;
|
|
|
|
destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> TRIGGER ENDSTOP", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> TRIGGER ENDSTOP", current_position);
|
|
|
@ -2224,17 +2220,17 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
lockZ1 = (z_endstop_adj < 0);
|
|
|
|
lockZ1 = (z_endstop_adj < 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (lockZ1) Lock_z_motor(true); else Lock_z2_motor(true);
|
|
|
|
if (lockZ1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
|
|
|
|
|
|
|
|
// Move to the adjusted endstop height
|
|
|
|
// Move to the adjusted endstop height
|
|
|
|
feedrate = homing_feedrate[axis];
|
|
|
|
feedrate = homing_feedrate[axis];
|
|
|
|
destination[Z_AXIS] = adj;
|
|
|
|
destination[Z_AXIS] = adj;
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
if (lockZ1) Lock_z_motor(false); else Lock_z2_motor(false);
|
|
|
|
if (lockZ1) stepper.set_z_lock(false); else stepper.set_z2_lock(false);
|
|
|
|
In_Homing_Process(false);
|
|
|
|
stepper.set_homing_flag(false);
|
|
|
|
} // Z_AXIS
|
|
|
|
} // Z_AXIS
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -2242,9 +2238,9 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
// retrace by the amount specified in endstop_adj
|
|
|
|
// retrace by the amount specified in endstop_adj
|
|
|
|
if (endstop_adj[axis] * axis_home_dir < 0) {
|
|
|
|
if (endstop_adj[axis] * axis_home_dir < 0) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> enable_endstops(false)");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
enable_endstops(false); // Disable endstops while moving away
|
|
|
|
endstops.enable(false); // Disable endstops while moving away
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
destination[axis] = endstop_adj[axis];
|
|
|
|
destination[axis] = endstop_adj[axis];
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
@ -2254,11 +2250,11 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> enable_endstops(true)");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
enable_endstops(true); // Enable endstops for next homing move
|
|
|
|
endstops.enable(true); // Enable endstops for next homing move
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@ -2280,7 +2276,7 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
|
|
|
|
|
|
|
|
destination[axis] = current_position[axis];
|
|
|
|
destination[axis] = current_position[axis];
|
|
|
|
feedrate = 0.0;
|
|
|
|
feedrate = 0.0;
|
|
|
|
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;
|
|
|
|
axis_homed[axis] = true;
|
|
|
|
axis_homed[axis] = true;
|
|
|
|
|
|
|
|
|
|
|
@ -2301,7 +2297,7 @@ static void homeaxis(AxisEnum axis) {
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]);
|
|
|
|
servo[servo_endstop_id[axis]].move(servo_endstop_angle[axis][1]);
|
|
|
|
if (_Z_PROBE_SUBTEST) z_probe_is_active = false;
|
|
|
|
if (_Z_PROBE_SUBTEST) endstops.enable_z_probe(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -2499,7 +2495,7 @@ inline void gcode_G4() {
|
|
|
|
if (code_seen('P')) codenum = code_value_long(); // milliseconds to wait
|
|
|
|
if (code_seen('P')) codenum = code_value_long(); // milliseconds to wait
|
|
|
|
if (code_seen('S')) codenum = code_value() * 1000UL; // seconds to wait
|
|
|
|
if (code_seen('S')) codenum = code_value() * 1000UL; // seconds to wait
|
|
|
|
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
codenum += previous_cmd_ms; // keep track of when we started waiting
|
|
|
|
codenum += previous_cmd_ms; // keep track of when we started waiting
|
|
|
|
|
|
|
|
|
|
|
@ -2551,11 +2547,11 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Wait for planner moves to finish!
|
|
|
|
// Wait for planner moves to finish!
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
// For auto bed leveling, clear the level matrix
|
|
|
|
// For auto bed leveling, clear the level matrix
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
plan_bed_level_matrix.set_to_identity();
|
|
|
|
planner.bed_level_matrix.set_to_identity();
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
reset_bed_level();
|
|
|
|
reset_bed_level();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -2594,8 +2590,8 @@ inline void gcode_G28() {
|
|
|
|
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * (Z_MAX_LENGTH);
|
|
|
|
for (int i = X_AXIS; i <= Z_AXIS; i++) destination[i] = 3 * (Z_MAX_LENGTH);
|
|
|
|
feedrate = 1.732 * homing_feedrate[X_AXIS];
|
|
|
|
feedrate = 1.732 * homing_feedrate[X_AXIS];
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
|
|
|
|
|
|
|
|
// Destination reached
|
|
|
|
// Destination reached
|
|
|
|
for (int i = X_AXIS; i <= Z_AXIS; i++) current_position[i] = destination[i];
|
|
|
|
for (int i = X_AXIS; i <= Z_AXIS; i++) current_position[i] = destination[i];
|
|
|
@ -2633,7 +2629,7 @@ inline void gcode_G28() {
|
|
|
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
|
|
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
|
|
|
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
|
|
|
|
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
|
|
|
|
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
|
|
|
|
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
|
|
|
|
feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
|
|
|
feedrate = planner.max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
|
|
|
|
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
|
|
|
@ -2643,7 +2639,7 @@ inline void gcode_G28() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Update the current Z position even if it currently not real from
|
|
|
|
* Update the current Z position even if it currently not real from
|
|
|
@ -2676,7 +2672,7 @@ inline void gcode_G28() {
|
|
|
|
destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
|
|
|
|
destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
|
|
|
|
feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
|
|
|
|
feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
set_axis_is_at_home(X_AXIS);
|
|
|
|
set_axis_is_at_home(X_AXIS);
|
|
|
|
set_axis_is_at_home(Y_AXIS);
|
|
|
|
set_axis_is_at_home(Y_AXIS);
|
|
|
@ -2690,8 +2686,8 @@ inline void gcode_G28() {
|
|
|
|
destination[Y_AXIS] = current_position[Y_AXIS];
|
|
|
|
destination[Y_AXIS] = current_position[Y_AXIS];
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
feedrate = 0.0;
|
|
|
|
feedrate = 0.0;
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = destination[X_AXIS];
|
|
|
|
current_position[X_AXIS] = destination[X_AXIS];
|
|
|
|
current_position[Y_AXIS] = destination[Y_AXIS];
|
|
|
|
current_position[Y_AXIS] = destination[Y_AXIS];
|
|
|
@ -2784,7 +2780,7 @@ inline void gcode_G28() {
|
|
|
|
|
|
|
|
|
|
|
|
// Move in the XY plane
|
|
|
|
// Move in the XY plane
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Update the current positions for XY, Z is still at least at
|
|
|
|
* Update the current positions for XY, Z is still at least at
|
|
|
@ -2857,10 +2853,10 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
|
|
|
|
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
|
|
|
|
enable_endstops(false);
|
|
|
|
endstops.enable(false);
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOLNPGM("ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)");
|
|
|
|
SERIAL_ECHOLNPGM("ENDSTOPS_ONLY_FOR_HOMING endstops.enable(false)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -2875,7 +2871,7 @@ inline void gcode_G28() {
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
line_to_destination();
|
|
|
|
line_to_destination();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("mbl_was_active", current_position);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("mbl_was_active", current_position);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -2885,7 +2881,7 @@ inline void gcode_G28() {
|
|
|
|
feedrate = saved_feedrate;
|
|
|
|
feedrate = saved_feedrate;
|
|
|
|
feedrate_multiplier = saved_feedrate_multiplier;
|
|
|
|
feedrate_multiplier = saved_feedrate_multiplier;
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
@ -2921,7 +2917,7 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
feedrate = saved_feedrate;
|
|
|
|
feedrate = saved_feedrate;
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -3015,7 +3011,7 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
// After recording the last point, activate the mbl and home
|
|
|
|
// After recording the last point, activate the mbl and home
|
|
|
|
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("Mesh probing done.");
|
|
|
@ -3204,22 +3200,22 @@ inline void gcode_G28() {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(DELTA)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(DELTA)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
vector_3 corrected_position = plan_get_position();
|
|
|
|
vector_3 corrected_position = planner.adjusted_position();
|
|
|
|
DEBUG_POS("BEFORE matrix.set_to_identity", corrected_position);
|
|
|
|
DEBUG_POS("BEFORE matrix.set_to_identity", corrected_position);
|
|
|
|
DEBUG_POS("BEFORE matrix.set_to_identity", current_position);
|
|
|
|
DEBUG_POS("BEFORE matrix.set_to_identity", current_position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
|
|
|
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it wrong
|
|
|
|
plan_bed_level_matrix.set_to_identity();
|
|
|
|
planner.bed_level_matrix.set_to_identity();
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
reset_bed_level();
|
|
|
|
reset_bed_level();
|
|
|
|
#else //!DELTA
|
|
|
|
#else //!DELTA
|
|
|
|
|
|
|
|
|
|
|
|
//vector_3 corrected_position = plan_get_position();
|
|
|
|
//vector_3 corrected_position = planner.adjusted_position();
|
|
|
|
//corrected_position.debug("position before G29");
|
|
|
|
//corrected_position.debug("position before G29");
|
|
|
|
vector_3 uncorrected_position = plan_get_position();
|
|
|
|
vector_3 uncorrected_position = planner.adjusted_position();
|
|
|
|
//uncorrected_position.debug("position during G29");
|
|
|
|
//uncorrected_position.debug("position during G29");
|
|
|
|
current_position[X_AXIS] = uncorrected_position.x;
|
|
|
|
current_position[X_AXIS] = uncorrected_position.x;
|
|
|
|
current_position[Y_AXIS] = uncorrected_position.y;
|
|
|
|
current_position[Y_AXIS] = uncorrected_position.y;
|
|
|
@ -3240,7 +3236,7 @@ inline void gcode_G28() {
|
|
|
|
deploy_z_probe();
|
|
|
|
deploy_z_probe();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
setup_for_endstop_move();
|
|
|
|
setup_for_endstop_move();
|
|
|
|
|
|
|
|
|
|
|
@ -3418,7 +3414,7 @@ inline void gcode_G28() {
|
|
|
|
y_tmp = eqnAMatrix[ind + 1 * abl2],
|
|
|
|
y_tmp = eqnAMatrix[ind + 1 * abl2],
|
|
|
|
z_tmp = 0;
|
|
|
|
z_tmp = 0;
|
|
|
|
|
|
|
|
|
|
|
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
|
|
|
|
|
|
|
|
NOMORE(min_diff, eqnBVector[ind] - z_tmp);
|
|
|
|
NOMORE(min_diff, eqnBVector[ind] - z_tmp);
|
|
|
|
|
|
|
|
|
|
|
@ -3441,7 +3437,7 @@ inline void gcode_G28() {
|
|
|
|
y_tmp = eqnAMatrix[ind + 1 * abl2],
|
|
|
|
y_tmp = eqnAMatrix[ind + 1 * abl2],
|
|
|
|
z_tmp = 0;
|
|
|
|
z_tmp = 0;
|
|
|
|
|
|
|
|
|
|
|
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
|
|
|
|
|
|
|
|
float diff = eqnBVector[ind] - z_tmp - min_diff;
|
|
|
|
float diff = eqnBVector[ind] - z_tmp - min_diff;
|
|
|
|
if (diff >= 0.0)
|
|
|
|
if (diff >= 0.0)
|
|
|
@ -3500,7 +3496,7 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#else // !DELTA
|
|
|
|
#else // !DELTA
|
|
|
|
if (verbose_level > 0)
|
|
|
|
if (verbose_level > 0)
|
|
|
|
plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
|
|
|
planner.bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
|
|
|
|
|
|
|
|
|
|
|
if (!dryrun) {
|
|
|
|
if (!dryrun) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -3511,7 +3507,7 @@ inline void gcode_G28() {
|
|
|
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
|
|
|
|
z_tmp = current_position[Z_AXIS],
|
|
|
|
z_tmp = current_position[Z_AXIS],
|
|
|
|
real_z = st_get_axis_position_mm(Z_AXIS); //get the real Z (since plan_get_position is now correcting the plane)
|
|
|
|
real_z = stepper.get_axis_position_mm(Z_AXIS); //get the real Z (since planner.adjusted_position is now correcting the plane)
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
@ -3523,13 +3519,13 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the correction sending the Z probe offset
|
|
|
|
// Apply the correction sending the Z probe offset
|
|
|
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Get the current Z position and send it to the planner.
|
|
|
|
* Get the current Z position and send it to the planner.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
|
|
|
|
* >> (z_tmp - real_z) : The rotated current Z minus the uncorrected Z
|
|
|
|
* (most recent plan_set_position/sync_plan_position)
|
|
|
|
* (most recent planner.set_position/sync_plan_position)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* >> zprobe_zoffset : Z distance from nozzle to Z probe
|
|
|
|
* >> zprobe_zoffset : Z distance from nozzle to Z probe
|
|
|
|
* (set by default, M851, EEPROM, or Menu)
|
|
|
|
* (set by default, M851, EEPROM, or Menu)
|
|
|
@ -3588,9 +3584,9 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
enqueue_and_echo_commands_P(PSTR(Z_PROBE_END_SCRIPT));
|
|
|
|
enqueue_and_echo_commands_P(PSTR(Z_PROBE_END_SCRIPT));
|
|
|
|
#if ENABLED(HAS_Z_MIN_PROBE)
|
|
|
|
#if ENABLED(HAS_Z_MIN_PROBE)
|
|
|
|
z_probe_is_active = false;
|
|
|
|
endstops.enable_z_probe(false);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
@ -3615,7 +3611,7 @@ inline void gcode_G28() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
deploy_z_probe(); // Engage Z Servo endstop if available. Z_PROBE_SLED is missed here.
|
|
|
|
deploy_z_probe(); // Engage Z Servo endstop if available. Z_PROBE_SLED is missed here.
|
|
|
|
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
// TODO: clear the leveling matrix or the planner will be set incorrectly
|
|
|
|
// TODO: clear the leveling matrix or the planner will be set incorrectly
|
|
|
|
setup_for_endstop_move(); // Too late. Must be done before deploying.
|
|
|
|
setup_for_endstop_move(); // Too late. Must be done before deploying.
|
|
|
|
|
|
|
|
|
|
|
@ -3650,7 +3646,7 @@ inline void gcode_G28() {
|
|
|
|
inline void gcode_G92() {
|
|
|
|
inline void gcode_G92() {
|
|
|
|
bool didE = code_seen(axis_codes[E_AXIS]);
|
|
|
|
bool didE = code_seen(axis_codes[E_AXIS]);
|
|
|
|
|
|
|
|
|
|
|
|
if (!didE) st_synchronize();
|
|
|
|
if (!didE) stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
bool didXYZ = false;
|
|
|
|
bool didXYZ = false;
|
|
|
|
for (int i = 0; i < NUM_AXIS; i++) {
|
|
|
|
for (int i = 0; i < NUM_AXIS; i++) {
|
|
|
@ -3712,7 +3708,7 @@ inline void gcode_G92() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lcd_ignore_click();
|
|
|
|
lcd_ignore_click();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
refresh_cmd_timeout();
|
|
|
|
if (codenum > 0) {
|
|
|
|
if (codenum > 0) {
|
|
|
|
codenum += previous_cmd_ms; // wait until this time for a click
|
|
|
|
codenum += previous_cmd_ms; // wait until this time for a click
|
|
|
@ -3853,7 +3849,7 @@ inline void gcode_M31() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M32() {
|
|
|
|
inline void gcode_M32() {
|
|
|
|
if (card.sdprinting)
|
|
|
|
if (card.sdprinting)
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
char* namestartpos = strchr(current_command_args, '!'); // Find ! to indicate filename string start.
|
|
|
|
char* namestartpos = strchr(current_command_args, '!'); // Find ! to indicate filename string start.
|
|
|
|
if (!namestartpos)
|
|
|
|
if (!namestartpos)
|
|
|
@ -4068,7 +4064,7 @@ inline void gcode_M42() {
|
|
|
|
reset_bed_level();
|
|
|
|
reset_bed_level();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
// we don't do bed level correction in M48 because we want the raw data when we probe
|
|
|
|
// we don't do bed level correction in M48 because we want the raw data when we probe
|
|
|
|
plan_bed_level_matrix.set_to_identity();
|
|
|
|
planner.bed_level_matrix.set_to_identity();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (Z_start_location < Z_RAISE_BEFORE_PROBING * 2.0)
|
|
|
|
if (Z_start_location < Z_RAISE_BEFORE_PROBING * 2.0)
|
|
|
@ -4457,10 +4453,7 @@ inline void gcode_M109() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTOTEMP)
|
|
|
|
#if ENABLED(AUTOTEMP)
|
|
|
|
autotemp_enabled = code_seen('F');
|
|
|
|
planner.autotemp_M109();
|
|
|
|
if (autotemp_enabled) autotemp_factor = code_value();
|
|
|
|
|
|
|
|
if (code_seen('S')) autotemp_min = code_value();
|
|
|
|
|
|
|
|
if (code_seen('B')) autotemp_max = code_value();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if TEMP_RESIDENCY_TIME > 0
|
|
|
|
#if TEMP_RESIDENCY_TIME > 0
|
|
|
@ -4819,7 +4812,7 @@ inline void gcode_M140() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M81() {
|
|
|
|
inline void gcode_M81() {
|
|
|
|
disable_all_heaters();
|
|
|
|
disable_all_heaters();
|
|
|
|
finishAndDisableSteppers();
|
|
|
|
stepper.finish_and_disable();
|
|
|
|
#if FAN_COUNT > 0
|
|
|
|
#if FAN_COUNT > 0
|
|
|
|
#if FAN_COUNT > 1
|
|
|
|
#if FAN_COUNT > 1
|
|
|
|
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
|
|
|
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
|
|
@ -4829,7 +4822,7 @@ inline void gcode_M81() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
delay(1000); // Wait 1 second before switching off
|
|
|
|
delay(1000); // Wait 1 second before switching off
|
|
|
|
#if HAS_SUICIDE
|
|
|
|
#if HAS_SUICIDE
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
suicide();
|
|
|
|
suicide();
|
|
|
|
#elif HAS_POWER_SWITCH
|
|
|
|
#elif HAS_POWER_SWITCH
|
|
|
|
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
|
|
|
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
|
|
|
@ -4864,10 +4857,10 @@ inline void gcode_M18_M84() {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
bool all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])) || (code_seen(axis_codes[E_AXIS])));
|
|
|
|
bool all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])) || (code_seen(axis_codes[E_AXIS])));
|
|
|
|
if (all_axis) {
|
|
|
|
if (all_axis) {
|
|
|
|
finishAndDisableSteppers();
|
|
|
|
stepper.finish_and_disable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
if (code_seen('X')) disable_x();
|
|
|
|
if (code_seen('X')) disable_x();
|
|
|
|
if (code_seen('Y')) disable_y();
|
|
|
|
if (code_seen('Y')) disable_y();
|
|
|
|
if (code_seen('Z')) disable_z();
|
|
|
|
if (code_seen('Z')) disable_z();
|
|
|
@ -4900,15 +4893,15 @@ inline void gcode_M92() {
|
|
|
|
if (i == E_AXIS) {
|
|
|
|
if (i == E_AXIS) {
|
|
|
|
float value = code_value();
|
|
|
|
float value = code_value();
|
|
|
|
if (value < 20.0) {
|
|
|
|
if (value < 20.0) {
|
|
|
|
float factor = axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab.
|
|
|
|
float factor = planner.axis_steps_per_unit[i] / value; // increase e constants if M92 E14 is given for netfab.
|
|
|
|
max_e_jerk *= factor;
|
|
|
|
planner.max_e_jerk *= factor;
|
|
|
|
max_feedrate[i] *= factor;
|
|
|
|
planner.max_feedrate[i] *= factor;
|
|
|
|
axis_steps_per_sqr_second[i] *= factor;
|
|
|
|
planner.axis_steps_per_sqr_second[i] *= factor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
axis_steps_per_unit[i] = value;
|
|
|
|
planner.axis_steps_per_unit[i] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
axis_steps_per_unit[i] = code_value();
|
|
|
|
planner.axis_steps_per_unit[i] = code_value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4927,35 +4920,7 @@ static void report_current_position() {
|
|
|
|
SERIAL_PROTOCOLPGM(" E:");
|
|
|
|
SERIAL_PROTOCOLPGM(" E:");
|
|
|
|
SERIAL_PROTOCOL(current_position[E_AXIS]);
|
|
|
|
SERIAL_PROTOCOL(current_position[E_AXIS]);
|
|
|
|
|
|
|
|
|
|
|
|
CRITICAL_SECTION_START;
|
|
|
|
stepper.report_positions();
|
|
|
|
extern volatile long count_position[NUM_AXIS];
|
|
|
|
|
|
|
|
long xpos = count_position[X_AXIS],
|
|
|
|
|
|
|
|
ypos = count_position[Y_AXIS],
|
|
|
|
|
|
|
|
zpos = count_position[Z_AXIS];
|
|
|
|
|
|
|
|
CRITICAL_SECTION_END;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_COUNT_A);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_COUNT_X);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SERIAL_PROTOCOL(xpos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(COREXY)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(" B:");
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(" Y:");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SERIAL_PROTOCOL(ypos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(COREXZ)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(" C:");
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(" Z:");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SERIAL_PROTOCOL(zpos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(SCARA)
|
|
|
|
#if ENABLED(SCARA)
|
|
|
|
SERIAL_PROTOCOLPGM("SCARA Theta:");
|
|
|
|
SERIAL_PROTOCOLPGM("SCARA Theta:");
|
|
|
@ -4971,9 +4936,9 @@ static void report_current_position() {
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
|
|
|
|
SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
|
|
|
|
SERIAL_PROTOCOL(delta[X_AXIS] / 90 * axis_steps_per_unit[X_AXIS]);
|
|
|
|
SERIAL_PROTOCOL(delta[X_AXIS] / 90 * planner.axis_steps_per_unit[X_AXIS]);
|
|
|
|
SERIAL_PROTOCOLPGM(" Psi+Theta:");
|
|
|
|
SERIAL_PROTOCOLPGM(" Psi+Theta:");
|
|
|
|
SERIAL_PROTOCOL((delta[Y_AXIS] - delta[X_AXIS]) / 90 * axis_steps_per_unit[Y_AXIS]);
|
|
|
|
SERIAL_PROTOCOL((delta[Y_AXIS] - delta[X_AXIS]) / 90 * planner.axis_steps_per_unit[Y_AXIS]);
|
|
|
|
SERIAL_EOL; SERIAL_EOL;
|
|
|
|
SERIAL_EOL; SERIAL_EOL;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5000,51 +4965,17 @@ inline void gcode_M117() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M119: Output endstop states to serial output
|
|
|
|
* M119: Output endstop states to serial output
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M119() {
|
|
|
|
inline void gcode_M119() { endstops.M119(); }
|
|
|
|
SERIAL_PROTOCOLLN(MSG_M119_REPORT);
|
|
|
|
|
|
|
|
#if HAS_X_MIN
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_X_MIN);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_X_MAX
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_X_MAX);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y_MIN
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MIN);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Y_MAX
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MAX);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Z_MIN
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MIN);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Z_MAX
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MAX);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Z2_MAX
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_Z_PROBE
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLN(((READ(Z_MIN_PROBE_PIN)^Z_MIN_PROBE_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M120: Enable endstops and set non-homing endstop state to "enabled"
|
|
|
|
* M120: Enable endstops and set non-homing endstop state to "enabled"
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M120() { enable_endstops_globally(true); }
|
|
|
|
inline void gcode_M120() { endstops.enable_globally(true); }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M121: Disable endstops and set non-homing endstop state to "disabled"
|
|
|
|
* M121: Disable endstops and set non-homing endstop state to "disabled"
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M121() { enable_endstops_globally(false); }
|
|
|
|
inline void gcode_M121() { endstops.enable_globally(false); }
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(BLINKM)
|
|
|
|
#if ENABLED(BLINKM)
|
|
|
|
|
|
|
|
|
|
|
@ -5148,17 +5079,17 @@ inline void gcode_M200() {
|
|
|
|
inline void gcode_M201() {
|
|
|
|
inline void gcode_M201() {
|
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
|
|
|
if (code_seen(axis_codes[i])) {
|
|
|
|
if (code_seen(axis_codes[i])) {
|
|
|
|
max_acceleration_units_per_sq_second[i] = code_value();
|
|
|
|
planner.max_acceleration_units_per_sq_second[i] = code_value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
|
|
|
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
|
|
|
reset_acceleration_rates();
|
|
|
|
planner.reset_acceleration_rates();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 // Not used for Sprinter/grbl gen6
|
|
|
|
#if 0 // Not used for Sprinter/grbl gen6
|
|
|
|
inline void gcode_M202() {
|
|
|
|
inline void gcode_M202() {
|
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
|
|
|
if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * axis_steps_per_unit[i];
|
|
|
|
if (code_seen(axis_codes[i])) axis_travel_steps_per_sqr_second[i] = code_value() * planner.axis_steps_per_unit[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -5170,7 +5101,7 @@ inline void gcode_M201() {
|
|
|
|
inline void gcode_M203() {
|
|
|
|
inline void gcode_M203() {
|
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++) {
|
|
|
|
if (code_seen(axis_codes[i])) {
|
|
|
|
if (code_seen(axis_codes[i])) {
|
|
|
|
max_feedrate[i] = code_value();
|
|
|
|
planner.max_feedrate[i] = code_value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5186,23 +5117,23 @@ inline void gcode_M203() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M204() {
|
|
|
|
inline void gcode_M204() {
|
|
|
|
if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
|
|
|
|
if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
|
|
|
|
travel_acceleration = acceleration = code_value();
|
|
|
|
planner.travel_acceleration = planner.acceleration = code_value();
|
|
|
|
SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", acceleration);
|
|
|
|
SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", planner.acceleration);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (code_seen('P')) {
|
|
|
|
if (code_seen('P')) {
|
|
|
|
acceleration = code_value();
|
|
|
|
planner.acceleration = code_value();
|
|
|
|
SERIAL_ECHOPAIR("Setting Print Acceleration: ", acceleration);
|
|
|
|
SERIAL_ECHOPAIR("Setting Print Acceleration: ", planner.acceleration);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (code_seen('R')) {
|
|
|
|
if (code_seen('R')) {
|
|
|
|
retract_acceleration = code_value();
|
|
|
|
planner.retract_acceleration = code_value();
|
|
|
|
SERIAL_ECHOPAIR("Setting Retract Acceleration: ", retract_acceleration);
|
|
|
|
SERIAL_ECHOPAIR("Setting Retract Acceleration: ", planner.retract_acceleration);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (code_seen('T')) {
|
|
|
|
if (code_seen('T')) {
|
|
|
|
travel_acceleration = code_value();
|
|
|
|
planner.travel_acceleration = code_value();
|
|
|
|
SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration);
|
|
|
|
SERIAL_ECHOPAIR("Setting Travel Acceleration: ", planner.travel_acceleration);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5218,12 +5149,12 @@ inline void gcode_M204() {
|
|
|
|
* E = Max E Jerk (mm/s/s)
|
|
|
|
* E = Max E Jerk (mm/s/s)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M205() {
|
|
|
|
inline void gcode_M205() {
|
|
|
|
if (code_seen('S')) minimumfeedrate = code_value();
|
|
|
|
if (code_seen('S')) planner.min_feedrate = code_value();
|
|
|
|
if (code_seen('T')) mintravelfeedrate = code_value();
|
|
|
|
if (code_seen('T')) planner.min_travel_feedrate = code_value();
|
|
|
|
if (code_seen('B')) minsegmenttime = code_value();
|
|
|
|
if (code_seen('B')) planner.min_segment_time = code_value();
|
|
|
|
if (code_seen('X')) max_xy_jerk = code_value();
|
|
|
|
if (code_seen('X')) planner.max_xy_jerk = code_value();
|
|
|
|
if (code_seen('Z')) max_z_jerk = code_value();
|
|
|
|
if (code_seen('Z')) planner.max_z_jerk = code_value();
|
|
|
|
if (code_seen('E')) max_e_jerk = code_value();
|
|
|
|
if (code_seen('E')) planner.max_e_jerk = code_value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -5439,7 +5370,7 @@ inline void gcode_M226() {
|
|
|
|
if (pin_number > -1) {
|
|
|
|
if (pin_number > -1) {
|
|
|
|
int target = LOW;
|
|
|
|
int target = LOW;
|
|
|
|
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
pinMode(pin_number, INPUT);
|
|
|
|
pinMode(pin_number, INPUT);
|
|
|
|
|
|
|
|
|
|
|
@ -5801,7 +5732,7 @@ inline void gcode_M303() {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* M400: Finish all moves
|
|
|
|
* M400: Finish all moves
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M400() { st_synchronize(); }
|
|
|
|
inline void gcode_M400() { stepper.synchronize(); }
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY))
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(Z_PROBE_SLED) && (HAS_SERVO_ENDSTOPS || ENABLED(Z_PROBE_ALLEN_KEY))
|
|
|
|
|
|
|
|
|
|
|
@ -5887,7 +5818,7 @@ inline void gcode_M400() { st_synchronize(); }
|
|
|
|
* This will stop the carriages mid-move, so most likely they
|
|
|
|
* This will stop the carriages mid-move, so most likely they
|
|
|
|
* will be out of sync with the stepper position after this.
|
|
|
|
* will be out of sync with the stepper position after this.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M410() { quickStop(); }
|
|
|
|
inline void gcode_M410() { stepper.quick_stop(); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
@ -6069,7 +6000,7 @@ inline void gcode_M503() {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#define RUNPLAN calculate_delta(destination); \
|
|
|
|
#define RUNPLAN calculate_delta(destination); \
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define RUNPLAN line_to_destination();
|
|
|
|
#define RUNPLAN line_to_destination();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -6111,7 +6042,7 @@ inline void gcode_M503() {
|
|
|
|
RUNPLAN;
|
|
|
|
RUNPLAN;
|
|
|
|
|
|
|
|
|
|
|
|
//finish moves
|
|
|
|
//finish moves
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
//disable extruder steppers so filament can be removed
|
|
|
|
//disable extruder steppers so filament can be removed
|
|
|
|
disable_e0();
|
|
|
|
disable_e0();
|
|
|
|
disable_e1();
|
|
|
|
disable_e1();
|
|
|
@ -6135,7 +6066,7 @@ inline void gcode_M503() {
|
|
|
|
current_position[E_AXIS] += AUTO_FILAMENT_CHANGE_LENGTH;
|
|
|
|
current_position[E_AXIS] += AUTO_FILAMENT_CHANGE_LENGTH;
|
|
|
|
destination[E_AXIS] = current_position[E_AXIS];
|
|
|
|
destination[E_AXIS] = current_position[E_AXIS];
|
|
|
|
line_to_destination(AUTO_FILAMENT_CHANGE_FEEDRATE);
|
|
|
|
line_to_destination(AUTO_FILAMENT_CHANGE_FEEDRATE);
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
} // while(!lcd_clicked)
|
|
|
|
} // while(!lcd_clicked)
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
@ -6143,7 +6074,7 @@ inline void gcode_M503() {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_FILAMENT_CHANGE)
|
|
|
|
#if ENABLED(AUTO_FILAMENT_CHANGE)
|
|
|
|
current_position[E_AXIS] = 0;
|
|
|
|
current_position[E_AXIS] = 0;
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//return to normal
|
|
|
|
//return to normal
|
|
|
@ -6162,8 +6093,8 @@ inline void gcode_M503() {
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
// Move XYZ to starting position, then E
|
|
|
|
// Move XYZ to starting position, then E
|
|
|
|
calculate_delta(lastpos);
|
|
|
|
calculate_delta(lastpos);
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder);
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
// Move XY to starting position, then Z, then E
|
|
|
|
// Move XY to starting position, then Z, then E
|
|
|
|
destination[X_AXIS] = lastpos[X_AXIS];
|
|
|
|
destination[X_AXIS] = lastpos[X_AXIS];
|
|
|
@ -6198,7 +6129,7 @@ inline void gcode_M503() {
|
|
|
|
* Note: the X axis should be homed after changing dual x-carriage mode.
|
|
|
|
* Note: the X axis should be homed after changing dual x-carriage mode.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
inline void gcode_M605() {
|
|
|
|
inline void gcode_M605() {
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
if (code_seen('S')) dual_x_carriage_mode = code_value();
|
|
|
|
if (code_seen('S')) dual_x_carriage_mode = code_value();
|
|
|
|
switch (dual_x_carriage_mode) {
|
|
|
|
switch (dual_x_carriage_mode) {
|
|
|
|
case DXC_DUPLICATION_MODE:
|
|
|
|
case DXC_DUPLICATION_MODE:
|
|
|
@ -6357,7 +6288,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|
|
|
#ifdef XY_TRAVEL_SPEED
|
|
|
|
#ifdef XY_TRAVEL_SPEED
|
|
|
|
feedrate = XY_TRAVEL_SPEED;
|
|
|
|
feedrate = XY_TRAVEL_SPEED;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
feedrate = min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]);
|
|
|
|
feedrate = min(planner.max_feedrate[X_AXIS], planner.max_feedrate[Y_AXIS]);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -6369,13 +6300,13 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|
|
|
if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && IsRunning() &&
|
|
|
|
if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && IsRunning() &&
|
|
|
|
(delayed_move_time || current_position[X_AXIS] != x_home_pos(active_extruder))) {
|
|
|
|
(delayed_move_time || current_position[X_AXIS] != x_home_pos(active_extruder))) {
|
|
|
|
// Park old head: 1) raise 2) move to park position 3) lower
|
|
|
|
// Park old head: 1) raise 2) move to park position 3) lower
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
|
|
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
|
|
planner.buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
|
|
current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
|
|
|
|
current_position[E_AXIS], planner.max_feedrate[X_AXIS], active_extruder);
|
|
|
|
plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
|
|
|
planner.buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
|
|
|
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// apply Y & Z extruder offset (x offset is already used in determining home pos)
|
|
|
|
// apply Y & Z extruder offset (x offset is already used in determining home pos)
|
|
|
@ -6443,24 +6374,31 @@ inline void gcode_T(uint8_t tmp_extruder) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#else // !AUTO_BED_LEVELING_FEATURE
|
|
|
|
#else // !AUTO_BED_LEVELING_FEATURE
|
|
|
|
|
|
|
|
|
|
|
|
// Offset extruder (only by XY)
|
|
|
|
// Offset extruder (only by XY)
|
|
|
|
for (int i=X_AXIS; i<=Y_AXIS; i++)
|
|
|
|
for (int i=X_AXIS; i<=Y_AXIS; i++)
|
|
|
|
current_position[i] += extruder_offset[i][tmp_extruder] - extruder_offset[i][active_extruder];
|
|
|
|
current_position[i] += extruder_offset[i][tmp_extruder] - extruder_offset[i][active_extruder];
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !AUTO_BED_LEVELING_FEATURE
|
|
|
|
#endif // !AUTO_BED_LEVELING_FEATURE
|
|
|
|
|
|
|
|
|
|
|
|
// Set the new active extruder and position
|
|
|
|
// Set the new active extruder and position
|
|
|
|
active_extruder = tmp_extruder;
|
|
|
|
active_extruder = tmp_extruder;
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !DUAL_X_CARRIAGE
|
|
|
|
#endif // !DUAL_X_CARRIAGE
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
sync_plan_position_delta();
|
|
|
|
sync_plan_position_delta();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Move to the old position
|
|
|
|
// Move to the old position
|
|
|
|
if (IsRunning()) prepare_move();
|
|
|
|
if (IsRunning()) prepare_move();
|
|
|
|
|
|
|
|
|
|
|
|
} // (tmp_extruder != active_extruder)
|
|
|
|
} // (tmp_extruder != active_extruder)
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(EXT_SOLENOID)
|
|
|
|
#if ENABLED(EXT_SOLENOID)
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
disable_all_solenoids();
|
|
|
|
disable_all_solenoids();
|
|
|
|
enable_solenoid_on_active_extruder();
|
|
|
|
enable_solenoid_on_active_extruder();
|
|
|
|
#endif // EXT_SOLENOID
|
|
|
|
#endif // EXT_SOLENOID
|
|
|
@ -7251,9 +7189,9 @@ void clamp_to_software_endstops(float target[3]) {
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
|
|
|
|
// This function is used to split lines on mesh borders so each segment is only part of one mesh area
|
|
|
|
// This function is used to split lines on mesh borders so each segment is only part of one mesh area
|
|
|
|
void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t& extruder, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
|
|
|
|
void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t& extruder, uint8_t x_splits = 0xff, uint8_t y_splits = 0xff) {
|
|
|
|
if (!mbl.active) {
|
|
|
|
if (!mbl.active) {
|
|
|
|
plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
|
|
planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
|
|
|
set_current_to_destination();
|
|
|
|
set_current_to_destination();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -7267,7 +7205,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
iy = min(iy, MESH_NUM_Y_POINTS - 2);
|
|
|
|
iy = min(iy, MESH_NUM_Y_POINTS - 2);
|
|
|
|
if (pix == ix && piy == iy) {
|
|
|
|
if (pix == ix && piy == iy) {
|
|
|
|
// Start and end on same mesh square
|
|
|
|
// Start and end on same mesh square
|
|
|
|
plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
|
|
planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
|
|
|
set_current_to_destination();
|
|
|
|
set_current_to_destination();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -7306,7 +7244,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// Already split on a border
|
|
|
|
// Already split on a border
|
|
|
|
plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
|
|
planner.buffer_line(x, y, z, e, feed_rate, extruder);
|
|
|
|
set_current_to_destination();
|
|
|
|
set_current_to_destination();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -7315,12 +7253,12 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
destination[Y_AXIS] = ny;
|
|
|
|
destination[Y_AXIS] = ny;
|
|
|
|
destination[Z_AXIS] = nz;
|
|
|
|
destination[Z_AXIS] = nz;
|
|
|
|
destination[E_AXIS] = ne;
|
|
|
|
destination[E_AXIS] = ne;
|
|
|
|
mesh_plan_buffer_line(nx, ny, nz, ne, feed_rate, extruder, x_splits, y_splits);
|
|
|
|
mesh_buffer_line(nx, ny, nz, ne, feed_rate, extruder, x_splits, y_splits);
|
|
|
|
destination[X_AXIS] = x;
|
|
|
|
destination[X_AXIS] = x;
|
|
|
|
destination[Y_AXIS] = y;
|
|
|
|
destination[Y_AXIS] = y;
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
destination[E_AXIS] = e;
|
|
|
|
destination[E_AXIS] = e;
|
|
|
|
mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
|
|
|
mesh_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
|
#endif // MESH_BED_LEVELING
|
|
|
|
|
|
|
|
|
|
|
@ -7379,7 +7317,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
//DEBUG_POS("prepare_move_delta", target);
|
|
|
|
//DEBUG_POS("prepare_move_delta", target);
|
|
|
|
//DEBUG_POS("prepare_move_delta", delta);
|
|
|
|
//DEBUG_POS("prepare_move_delta", delta);
|
|
|
|
|
|
|
|
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate / 60 * feedrate_multiplier / 100.0, active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate / 60 * feedrate_multiplier / 100.0, active_extruder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -7396,11 +7334,11 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
if (active_extruder_parked) {
|
|
|
|
if (active_extruder_parked) {
|
|
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
|
|
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
|
|
|
// move duplicate extruder into correct duplication position.
|
|
|
|
// move duplicate extruder into correct duplication position.
|
|
|
|
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
planner.set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
|
|
|
planner.buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset,
|
|
|
|
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
|
|
|
current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[X_AXIS], 1);
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
extruder_duplication_enabled = true;
|
|
|
|
extruder_duplication_enabled = true;
|
|
|
|
active_extruder_parked = false;
|
|
|
|
active_extruder_parked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -7418,9 +7356,9 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delayed_move_time = 0;
|
|
|
|
delayed_move_time = 0;
|
|
|
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
|
|
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
|
|
|
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
planner.buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(max_feedrate[X_AXIS], max_feedrate[Y_AXIS]), active_extruder);
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], min(planner.max_feedrate[X_AXIS], planner.max_feedrate[Y_AXIS]), active_extruder);
|
|
|
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], planner.max_feedrate[Z_AXIS], active_extruder);
|
|
|
|
active_extruder_parked = false;
|
|
|
|
active_extruder_parked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -7438,7 +7376,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
|
|
mesh_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
line_to_destination(feedrate * feedrate_multiplier / 100.0);
|
|
|
|
line_to_destination(feedrate * feedrate_multiplier / 100.0);
|
|
|
@ -7452,7 +7390,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Prepare a single move and get ready for the next one
|
|
|
|
* Prepare a single move and get ready for the next one
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* (This may call plan_buffer_line several times to put
|
|
|
|
* (This may call planner.buffer_line several times to put
|
|
|
|
* smaller moves into the planner for DELTA or SCARA.)
|
|
|
|
* smaller moves into the planner for DELTA or SCARA.)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void prepare_move() {
|
|
|
|
void prepare_move() {
|
|
|
@ -7596,9 +7534,9 @@ void plan_arc(
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
adjust_delta(arc_target);
|
|
|
|
adjust_delta(arc_target);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
planner.buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -7608,9 +7546,9 @@ void plan_arc(
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
|
|
adjust_delta(target);
|
|
|
|
adjust_delta(target);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
planner.buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// As far as the parser is concerned, the position is now == target. In reality the
|
|
|
|
// As far as the parser is concerned, the position is now == target. In reality the
|
|
|
@ -7827,7 +7765,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|
|
|
if (max_inactive_time && ELAPSED(ms, previous_cmd_ms + max_inactive_time)) kill(PSTR(MSG_KILLED));
|
|
|
|
if (max_inactive_time && ELAPSED(ms, previous_cmd_ms + max_inactive_time)) kill(PSTR(MSG_KILLED));
|
|
|
|
|
|
|
|
|
|
|
|
if (stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
|
|
|
|
if (stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
|
|
|
|
&& !ignore_stepper_queue && !blocks_queued()) {
|
|
|
|
&& !ignore_stepper_queue && !planner.blocks_queued()) {
|
|
|
|
#if ENABLED(DISABLE_INACTIVE_X)
|
|
|
|
#if ENABLED(DISABLE_INACTIVE_X)
|
|
|
|
disable_x();
|
|
|
|
disable_x();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -7920,14 +7858,14 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS];
|
|
|
|
float oldepos = current_position[E_AXIS], oldedes = destination[E_AXIS];
|
|
|
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
|
|
|
|
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS],
|
|
|
|
destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS],
|
|
|
|
destination[E_AXIS] + (EXTRUDER_RUNOUT_EXTRUDE) * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_unit[E_AXIS],
|
|
|
|
(EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / axis_steps_per_unit[E_AXIS], active_extruder);
|
|
|
|
(EXTRUDER_RUNOUT_SPEED) / 60. * (EXTRUDER_RUNOUT_ESTEPS) / planner.axis_steps_per_unit[E_AXIS], active_extruder);
|
|
|
|
current_position[E_AXIS] = oldepos;
|
|
|
|
current_position[E_AXIS] = oldepos;
|
|
|
|
destination[E_AXIS] = oldedes;
|
|
|
|
destination[E_AXIS] = oldedes;
|
|
|
|
plan_set_e_position(oldepos);
|
|
|
|
planner.set_e_position(oldepos);
|
|
|
|
previous_cmd_ms = ms; // refresh_cmd_timeout()
|
|
|
|
previous_cmd_ms = ms; // refresh_cmd_timeout()
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
switch (active_extruder) {
|
|
|
|
switch (active_extruder) {
|
|
|
|
case 0:
|
|
|
|
case 0:
|
|
|
|
E0_ENABLE_WRITE(oldstatus);
|
|
|
|
E0_ENABLE_WRITE(oldstatus);
|
|
|
@ -7965,7 +7903,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
|
|
|
|
handle_status_leds();
|
|
|
|
handle_status_leds();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
check_axes_activity();
|
|
|
|
planner.check_axes_activity();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void kill(const char* lcd_msg) {
|
|
|
|
void kill(const char* lcd_msg) {
|
|
|
@ -8004,7 +7942,7 @@ void kill(const char* lcd_msg) {
|
|
|
|
if (!filament_ran_out) {
|
|
|
|
if (!filament_ran_out) {
|
|
|
|
filament_ran_out = true;
|
|
|
|
filament_ran_out = true;
|
|
|
|
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
|
|
|
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
|
|
|
st_synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|