Create DEBUG_LEVELING_FEATURE
This commit is contained in:
parent
194f98ff95
commit
20b4772155
@ -510,8 +510,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
|
|||||||
//#define Z_PROBE_SLED // Turn on if you have a Z probe mounted on a sled like those designed by Charles Bell.
|
//#define Z_PROBE_SLED // Turn on if you have a Z probe mounted on a sled like those designed by Charles Bell.
|
||||||
//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
|
//#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
|
||||||
|
|
||||||
// If you have enabled the bed auto leveling and are using the same Z probe for Z homing,
|
|
||||||
// it is highly recommended you let this Z_SAFE_HOMING enabled!!!
|
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
|
||||||
|
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
|
||||||
|
|
||||||
#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with Z probe outside the bed area.
|
#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with Z probe outside the bed area.
|
||||||
// When defined, it will:
|
// When defined, it will:
|
||||||
|
@ -221,7 +221,8 @@ enum DebugFlags {
|
|||||||
DEBUG_INFO = BIT(1),
|
DEBUG_INFO = BIT(1),
|
||||||
DEBUG_ERRORS = BIT(2),
|
DEBUG_ERRORS = BIT(2),
|
||||||
DEBUG_DRYRUN = BIT(3),
|
DEBUG_DRYRUN = BIT(3),
|
||||||
DEBUG_COMMUNICATION = BIT(4)
|
DEBUG_COMMUNICATION = BIT(4),
|
||||||
|
DEBUG_LEVELING = BIT(5)
|
||||||
};
|
};
|
||||||
extern uint8_t marlin_debug_flags;
|
extern uint8_t marlin_debug_flags;
|
||||||
|
|
||||||
|
@ -1033,7 +1033,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
|
|||||||
|
|
||||||
#endif //DUAL_X_CARRIAGE
|
#endif //DUAL_X_CARRIAGE
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
void print_xyz(const char *prefix, const float x, const float y, const float z) {
|
void print_xyz(const char *prefix, const float x, const float y, const float z) {
|
||||||
SERIAL_ECHO(prefix);
|
SERIAL_ECHO(prefix);
|
||||||
SERIAL_ECHOPAIR(": (", x);
|
SERIAL_ECHOPAIR(": (", x);
|
||||||
@ -1112,10 +1112,12 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
|||||||
if (axis == Z_AXIS) current_position[Z_AXIS] -= zprobe_zoffset;
|
if (axis == Z_AXIS) current_position[Z_AXIS] -= zprobe_zoffset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("set_axis_is_at_home ", (unsigned long)axis);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_ECHOPAIR(" > (home_offset[axis]==", home_offset[axis]);
|
SERIAL_ECHOPAIR("set_axis_is_at_home ", (unsigned long)axis);
|
||||||
print_xyz(") > current_position", current_position);
|
SERIAL_ECHOPAIR(" > (home_offset[axis]==", home_offset[axis]);
|
||||||
|
print_xyz(") > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1162,8 +1164,10 @@ static void setup_for_endstop_move() {
|
|||||||
saved_feedrate_multiplier = feedrate_multiplier;
|
saved_feedrate_multiplier = feedrate_multiplier;
|
||||||
feedrate_multiplier = 100;
|
feedrate_multiplier = 100;
|
||||||
refresh_cmd_timeout();
|
refresh_cmd_timeout();
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("setup_for_endstop_move > enable_endstops(true)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("setup_for_endstop_move > enable_endstops(true)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(true);
|
enable_endstops(true);
|
||||||
}
|
}
|
||||||
@ -1175,8 +1179,10 @@ static void setup_for_endstop_move() {
|
|||||||
* Calculate delta, start a line, and set current_position to destination
|
* Calculate delta, start a line, and set current_position to destination
|
||||||
*/
|
*/
|
||||||
void prepare_move_raw() {
|
void prepare_move_raw() {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("prepare_move_raw > destination", destination);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("prepare_move_raw > destination", destination);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
refresh_cmd_timeout();
|
refresh_cmd_timeout();
|
||||||
calculate_delta(destination);
|
calculate_delta(destination);
|
||||||
@ -1205,8 +1211,10 @@ static void setup_for_endstop_move() {
|
|||||||
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;
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("set_bed_level_equation_lsq > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("set_bed_level_equation_lsq > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
@ -1238,8 +1246,10 @@ static void setup_for_endstop_move() {
|
|||||||
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;
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("set_bed_level_equation_3pts > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("set_bed_level_equation_3pts > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
@ -1254,8 +1264,10 @@ static void setup_for_endstop_move() {
|
|||||||
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 = st_get_position(Z_AXIS);
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_ECHOLNPGM("run_z_probe (DELTA) 1");
|
SERIAL_ECHOLNPGM("run_z_probe (DELTA) 1");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// move down slowly until you find the bed
|
// move down slowly until you find the bed
|
||||||
@ -1270,8 +1282,10 @@ static void setup_for_endstop_move() {
|
|||||||
float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS];
|
float mm = start_z - float(start_steps - stop_steps) / axis_steps_per_unit[Z_AXIS];
|
||||||
current_position[Z_AXIS] = mm;
|
current_position[Z_AXIS] = mm;
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("run_z_probe (DELTA) 2 > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("run_z_probe (DELTA) 2 > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sync_plan_position_delta();
|
sync_plan_position_delta();
|
||||||
@ -1308,8 +1322,10 @@ static void setup_for_endstop_move() {
|
|||||||
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
|
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("run_z_probe > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("run_z_probe > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // !DELTA
|
#endif // !DELTA
|
||||||
@ -1322,8 +1338,10 @@ static void setup_for_endstop_move() {
|
|||||||
static void do_blocking_move_to(float x, float y, float z) {
|
static void do_blocking_move_to(float x, float y, float z) {
|
||||||
float oldFeedRate = feedrate;
|
float oldFeedRate = feedrate;
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("do_blocking_move_to", x, y, z);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("do_blocking_move_to", x, y, z);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
@ -1362,8 +1380,10 @@ static void setup_for_endstop_move() {
|
|||||||
|
|
||||||
static void clean_up_after_endstop_move() {
|
static void clean_up_after_endstop_move() {
|
||||||
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
|
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
|
||||||
#if ENABLED(DEBUG_LEVELING)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > enable_endstops(false)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("clean_up_after_endstop_move > ENDSTOPS_ONLY_FOR_HOMING > enable_endstops(false)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(false);
|
enable_endstops(false);
|
||||||
#endif
|
#endif
|
||||||
@ -1374,8 +1394,10 @@ static void setup_for_endstop_move() {
|
|||||||
|
|
||||||
static void deploy_z_probe() {
|
static void deploy_z_probe() {
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("deploy_z_probe > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("deploy_z_probe > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_SERVO_ENDSTOPS
|
#if HAS_SERVO_ENDSTOPS
|
||||||
@ -1468,8 +1490,10 @@ static void setup_for_endstop_move() {
|
|||||||
|
|
||||||
static void stow_z_probe(bool doRaise=true) {
|
static void stow_z_probe(bool doRaise=true) {
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("stow_z_probe > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("stow_z_probe > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_SERVO_ENDSTOPS
|
#if HAS_SERVO_ENDSTOPS
|
||||||
@ -1479,11 +1503,13 @@ static void setup_for_endstop_move() {
|
|||||||
|
|
||||||
#if Z_RAISE_AFTER_PROBING > 0
|
#if Z_RAISE_AFTER_PROBING > 0
|
||||||
if (doRaise) {
|
if (doRaise) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBING);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBING);
|
||||||
SERIAL_ECHOPAIR("> SERVO_ENDSTOPS > do_blocking_move_to_z ", current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING);
|
SERIAL_EOL;
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> SERVO_ENDSTOPS > do_blocking_move_to_z ", current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); // this also updates current_position
|
do_blocking_move_to_z(current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING); // this also updates current_position
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
@ -1574,35 +1600,43 @@ static void setup_for_endstop_move() {
|
|||||||
// Probe bed height at position (x,y), returns the measured z value
|
// Probe bed height at position (x,y), returns the measured z value
|
||||||
static float probe_pt(float x, float y, float z_before, ProbeAction probe_action=ProbeDeployAndStow, int verbose_level=1) {
|
static float probe_pt(float x, float y, float z_before, ProbeAction probe_action=ProbeDeployAndStow, int verbose_level=1) {
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("probe_pt >>>");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_ECHOPAIR("> ProbeAction:", (unsigned long)probe_action);
|
SERIAL_ECHOLNPGM("probe_pt >>>");
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> ProbeAction:", (unsigned long)probe_action);
|
||||||
print_xyz("> current_position", current_position);
|
SERIAL_EOL;
|
||||||
|
print_xyz("> current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("Z Raise to z_before ", z_before);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("Z Raise to z_before ", z_before);
|
||||||
SERIAL_ECHOPAIR("> do_blocking_move_to_z ", z_before);
|
SERIAL_EOL;
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> do_blocking_move_to_z ", z_before);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Move Z up to the z_before height, then move the Z probe to the given XY
|
// Move Z up to the z_before height, then move the Z probe to the given XY
|
||||||
do_blocking_move_to_z(z_before); // this also updates current_position
|
do_blocking_move_to_z(z_before); // this also updates current_position
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - X_PROBE_OFFSET_FROM_EXTRUDER);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_ECHOPAIR(", ", y - Y_PROBE_OFFSET_FROM_EXTRUDER);
|
SERIAL_ECHOPAIR("> do_blocking_move_to_xy ", x - X_PROBE_OFFSET_FROM_EXTRUDER);
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR(", ", y - Y_PROBE_OFFSET_FROM_EXTRUDER);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_blocking_move_to_xy(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER); // this also updates current_position
|
do_blocking_move_to_xy(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER); // this also updates current_position
|
||||||
|
|
||||||
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
|
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
|
||||||
if (probe_action & ProbeDeploy) {
|
if (probe_action & ProbeDeploy) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> ProbeDeploy");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> ProbeDeploy");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
deploy_z_probe();
|
deploy_z_probe();
|
||||||
}
|
}
|
||||||
@ -1613,8 +1647,10 @@ static void setup_for_endstop_move() {
|
|||||||
|
|
||||||
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
|
#if DISABLED(Z_PROBE_SLED) && DISABLED(Z_PROBE_ALLEN_KEY)
|
||||||
if (probe_action & ProbeStow) {
|
if (probe_action & ProbeStow) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> ProbeStow (stow_z_probe will do Z Raise)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> ProbeStow (stow_z_probe will do Z Raise)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
stow_z_probe();
|
stow_z_probe();
|
||||||
}
|
}
|
||||||
@ -1630,8 +1666,10 @@ static void setup_for_endstop_move() {
|
|||||||
SERIAL_EOL;
|
SERIAL_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("<<< probe_pt");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("<<< probe_pt");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return measured_z;
|
return measured_z;
|
||||||
@ -1689,8 +1727,10 @@ static void setup_for_endstop_move() {
|
|||||||
|
|
||||||
// Reset calibration results to zero.
|
// Reset calibration results to zero.
|
||||||
void reset_bed_level() {
|
void reset_bed_level() {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("reset_bed_level");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("reset_bed_level");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
||||||
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
||||||
@ -1727,9 +1767,11 @@ static void setup_for_endstop_move() {
|
|||||||
* offset[in] The additional distance to move to adjust docking location
|
* offset[in] The additional distance to move to adjust docking location
|
||||||
*/
|
*/
|
||||||
static void dock_sled(bool dock, int offset=0) {
|
static void dock_sled(bool dock, int offset=0) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("dock_sled", dock);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("dock_sled", dock);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) {
|
||||||
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
||||||
@ -1765,10 +1807,12 @@ static void setup_for_endstop_move() {
|
|||||||
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
||||||
|
|
||||||
static void homeaxis(AxisEnum axis) {
|
static void homeaxis(AxisEnum axis) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR(">>> homeaxis(", (unsigned long)axis);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_CHAR(')');
|
SERIAL_ECHOPAIR(">>> homeaxis(", (unsigned long)axis);
|
||||||
SERIAL_EOL;
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#define HOMEAXIS_DO(LETTER) \
|
#define HOMEAXIS_DO(LETTER) \
|
||||||
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
||||||
@ -1822,8 +1866,10 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
current_position[axis] = 0;
|
current_position[axis] = 0;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> enable_endstops(false)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> enable_endstops(false)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(false); // Disable endstops while moving away
|
enable_endstops(false); // Disable endstops while moving away
|
||||||
|
|
||||||
@ -1832,8 +1878,10 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
line_to_destination();
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> enable_endstops(true)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> enable_endstops(true)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(true); // Enable endstops for next homing move
|
enable_endstops(true); // Enable endstops for next homing move
|
||||||
|
|
||||||
@ -1845,8 +1893,10 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
line_to_destination();
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> TRIGGER ENDSTOP > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> TRIGGER ENDSTOP > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(Z_DUAL_ENDSTOPS)
|
#if ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
@ -1877,27 +1927,35 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
// 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) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> enable_endstops(false)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> enable_endstops(false)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(false); // Disable endstops while moving away
|
enable_endstops(false); // Disable endstops while moving away
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
destination[axis] = endstop_adj[axis];
|
destination[axis] = endstop_adj[axis];
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
print_xyz(" > destination", destination);
|
SERIAL_ECHOPAIR("> endstop_adj = ", endstop_adj[axis]);
|
||||||
|
print_xyz(" > destination", destination);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
line_to_destination();
|
line_to_destination();
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> enable_endstops(true)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> enable_endstops(true)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(true); // Enable endstops for next homing move
|
enable_endstops(true); // Enable endstops for next homing move
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
else {
|
else {
|
||||||
SERIAL_ECHOPAIR("> endstop_adj * axis_home_dir = ", endstop_adj[axis] * axis_home_dir);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> endstop_adj * axis_home_dir = ", endstop_adj[axis] * axis_home_dir);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -1906,8 +1964,10 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
set_axis_is_at_home(axis);
|
set_axis_is_at_home(axis);
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> AFTER set_axis_is_at_home > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> AFTER set_axis_is_at_home > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
destination[axis] = current_position[axis];
|
destination[axis] = current_position[axis];
|
||||||
@ -1927,8 +1987,10 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
// Deploy a Z probe if there is one, and homing towards the bed
|
// Deploy a Z probe if there is one, and homing towards the bed
|
||||||
if (axis == Z_AXIS) {
|
if (axis == Z_AXIS) {
|
||||||
if (axis_home_dir < 0) {
|
if (axis_home_dir < 0) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> SERVO_LEVELING > stow_z_probe");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> SERVO_LEVELING > stow_z_probe");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
stow_z_probe();
|
stow_z_probe();
|
||||||
}
|
}
|
||||||
@ -1941,8 +2003,10 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
#if HAS_SERVO_ENDSTOPS
|
#if HAS_SERVO_ENDSTOPS
|
||||||
// Retract Servo endstop if enabled
|
// Retract Servo endstop if enabled
|
||||||
if (servo_endstop_id[axis] >= 0) {
|
if (servo_endstop_id[axis] >= 0) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> SERVO_ENDSTOPS > Stow with servo.move()");
|
if (marlin_debug_flags & DEBUG_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]);
|
||||||
}
|
}
|
||||||
@ -1951,10 +2015,12 @@ static void homeaxis(AxisEnum axis) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("<<< homeaxis(", (unsigned long)axis);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_CHAR(')');
|
SERIAL_ECHOPAIR("<<< homeaxis(", (unsigned long)axis);
|
||||||
SERIAL_EOL;
|
SERIAL_CHAR(')');
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2157,8 +2223,10 @@ inline void gcode_G4() {
|
|||||||
*/
|
*/
|
||||||
inline void gcode_G28() {
|
inline void gcode_G28() {
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("gcode_G28 >>>");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("gcode_G28 >>>");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Wait for planner moves to finish!
|
// Wait for planner moves to finish!
|
||||||
@ -2209,8 +2277,10 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
sync_plan_position_delta();
|
sync_plan_position_delta();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("(DELTA) > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("(DELTA) > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // NOT DELTA
|
#else // NOT DELTA
|
||||||
@ -2226,8 +2296,10 @@ inline void gcode_G28() {
|
|||||||
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
|
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
|
||||||
|
|
||||||
HOMEAXIS(Z);
|
HOMEAXIS(Z);
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> HOMEAXIS(Z) > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> HOMEAXIS(Z) > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif DISABLED(Z_SAFE_HOMING) && defined(Z_RAISE_BEFORE_HOMING) && Z_RAISE_BEFORE_HOMING > 0
|
#elif DISABLED(Z_SAFE_HOMING) && defined(Z_RAISE_BEFORE_HOMING) && Z_RAISE_BEFORE_HOMING > 0
|
||||||
@ -2235,10 +2307,12 @@ inline void gcode_G28() {
|
|||||||
// Raise Z before homing any other axes
|
// Raise Z before homing any other axes
|
||||||
// (Does this need to be "negative home direction?" Why not just use Z_RAISE_BEFORE_HOMING?)
|
// (Does this need to be "negative home direction?" Why not just use Z_RAISE_BEFORE_HOMING?)
|
||||||
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS);
|
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS);
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
|
||||||
print_xyz("> (home_all_axis || homeZ) > destination", destination);
|
SERIAL_EOL;
|
||||||
|
print_xyz("> (home_all_axis || homeZ) > destination", destination);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
feedrate = max_feedrate[Z_AXIS] * 60;
|
feedrate = max_feedrate[Z_AXIS] * 60;
|
||||||
line_to_destination();
|
line_to_destination();
|
||||||
@ -2276,8 +2350,10 @@ inline void gcode_G28() {
|
|||||||
set_axis_is_at_home(Y_AXIS);
|
set_axis_is_at_home(Y_AXIS);
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> QUICK_HOME > current_position 1", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> QUICK_HOME > current_position 1", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
destination[X_AXIS] = current_position[X_AXIS];
|
destination[X_AXIS] = current_position[X_AXIS];
|
||||||
@ -2293,8 +2369,10 @@ inline void gcode_G28() {
|
|||||||
current_position[Z_AXIS] = destination[Z_AXIS];
|
current_position[Z_AXIS] = destination[Z_AXIS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> QUICK_HOME > current_position 2", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> QUICK_HOME > current_position 2", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2322,8 +2400,10 @@ inline void gcode_G28() {
|
|||||||
#else
|
#else
|
||||||
HOMEAXIS(X);
|
HOMEAXIS(X);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> homeX", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> homeX", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2331,8 +2411,10 @@ inline void gcode_G28() {
|
|||||||
// Home Y
|
// Home Y
|
||||||
if (home_all_axis || homeY) {
|
if (home_all_axis || homeY) {
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> homeY", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> homeY", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2344,8 +2426,10 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
#if ENABLED(Z_SAFE_HOMING)
|
#if ENABLED(Z_SAFE_HOMING)
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (home_all_axis) {
|
if (home_all_axis) {
|
||||||
@ -2363,11 +2447,13 @@ inline void gcode_G28() {
|
|||||||
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS); // Set destination away from bed
|
||||||
feedrate = XY_TRAVEL_SPEED;
|
feedrate = XY_TRAVEL_SPEED;
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
|
||||||
print_xyz("> home_all_axis > current_position", current_position);
|
SERIAL_EOL;
|
||||||
print_xyz("> home_all_axis > destination", destination);
|
print_xyz("> home_all_axis > current_position", current_position);
|
||||||
|
print_xyz("> home_all_axis > destination", destination);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This could potentially move X, Y, Z all together
|
// This could potentially move X, Y, Z all together
|
||||||
@ -2403,11 +2489,13 @@ inline void gcode_G28() {
|
|||||||
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS);
|
destination[Z_AXIS] = -Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS);
|
||||||
feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
feedrate = max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
|
||||||
print_xyz("> homeZ > current_position", current_position);
|
SERIAL_EOL;
|
||||||
print_xyz("> homeZ > destination", destination);
|
print_xyz("> homeZ > current_position", current_position);
|
||||||
|
print_xyz("> homeZ > destination", destination);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
line_to_destination();
|
line_to_destination();
|
||||||
@ -2430,8 +2518,10 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
} // !home_all_axes && homeZ
|
} // !home_all_axes && homeZ
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("<<< Z_SAFE_HOMING");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("<<< Z_SAFE_HOMING");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // !Z_SAFE_HOMING
|
#else // !Z_SAFE_HOMING
|
||||||
@ -2440,8 +2530,10 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
#endif // !Z_SAFE_HOMING
|
#endif // !Z_SAFE_HOMING
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> (home_all_axis || homeZ) > final", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> (home_all_axis || homeZ) > final", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // home_all_axis || homeZ
|
} // home_all_axis || homeZ
|
||||||
@ -2457,8 +2549,10 @@ inline void gcode_G28() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
|
#if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enable_endstops(false);
|
enable_endstops(false);
|
||||||
#endif
|
#endif
|
||||||
@ -2475,8 +2569,10 @@ inline void gcode_G28() {
|
|||||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
mbl.active = 1;
|
mbl.active = 1;
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("mbl_was_active > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("mbl_was_active > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2486,8 +2582,10 @@ inline void gcode_G28() {
|
|||||||
refresh_cmd_timeout();
|
refresh_cmd_timeout();
|
||||||
endstops_hit_on_purpose(); // clear endstop hit flags
|
endstops_hit_on_purpose(); // clear endstop hit flags
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("<<< gcode_G28");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("<<< gcode_G28");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2675,8 +2773,10 @@ inline void gcode_G28() {
|
|||||||
*/
|
*/
|
||||||
inline void gcode_G29() {
|
inline void gcode_G29() {
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("gcode_G29 >>>");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("gcode_G29 >>>");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Don't allow auto-leveling without homing first
|
// Don't allow auto-leveling without homing first
|
||||||
@ -2838,15 +2938,19 @@ inline void gcode_G28() {
|
|||||||
z_before = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS] : Z_RAISE_BEFORE_PROBING;
|
z_before = probePointCounter ? Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS] : Z_RAISE_BEFORE_PROBING;
|
||||||
|
|
||||||
if (probePointCounter) {
|
if (probePointCounter) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("z_before = (between) ", (float)(Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS]));
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("z_before = (between) ", (float)(Z_RAISE_BETWEEN_PROBINGS + current_position[Z_AXIS]));
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("z_before = (before) ", (float)Z_RAISE_BEFORE_PROBING);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("z_before = (before) ", (float)Z_RAISE_BEFORE_PROBING);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2887,8 +2991,10 @@ inline void gcode_G28() {
|
|||||||
} //xProbe
|
} //xProbe
|
||||||
} //yProbe
|
} //yProbe
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> probing complete > current_position", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> probing complete > current_position", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clean_up_after_endstop_move();
|
clean_up_after_endstop_move();
|
||||||
@ -2987,8 +3093,10 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
#else // !AUTO_BED_LEVELING_GRID
|
#else // !AUTO_BED_LEVELING_GRID
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("> 3-point Leveling");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("> 3-point Leveling");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Actions for each probe
|
// Actions for each probe
|
||||||
@ -3020,11 +3128,13 @@ inline void gcode_G28() {
|
|||||||
z_tmp = current_position[Z_AXIS],
|
z_tmp = current_position[Z_AXIS],
|
||||||
real_z = st_get_position_mm(Z_AXIS); //get the real Z (since plan_get_position is now correcting the plane)
|
real_z = st_get_position_mm(Z_AXIS); //get the real Z (since plan_get_position is now correcting the plane)
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > z_tmp = ", z_tmp);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > z_tmp = ", z_tmp);
|
||||||
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > real_z = ", real_z);
|
SERIAL_EOL;
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > real_z = ", real_z);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); // Apply the correction sending the Z probe offset
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); // Apply the correction sending the Z probe offset
|
||||||
@ -3045,9 +3155,11 @@ inline void gcode_G28() {
|
|||||||
// adjust for inaccurate endstops, not for reasonably accurate probes. If it were
|
// adjust for inaccurate endstops, not for reasonably accurate probes. If it were
|
||||||
// added here, it could be seen as a compensating factor for the Z probe.
|
// added here, it could be seen as a compensating factor for the Z probe.
|
||||||
//
|
//
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
|
current_position[Z_AXIS] = -zprobe_zoffset + (z_tmp - real_z)
|
||||||
@ -3058,8 +3170,10 @@ inline void gcode_G28() {
|
|||||||
// current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
|
// current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
|
||||||
sync_plan_position();
|
sync_plan_position();
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
print_xyz("> corrected Z in G29", current_position);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
print_xyz("> corrected Z in G29", current_position);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif // !DELTA
|
#endif // !DELTA
|
||||||
@ -3071,16 +3185,20 @@ inline void gcode_G28() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_PROBE_END_SCRIPT
|
#ifdef Z_PROBE_END_SCRIPT
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHO("Z Probe End Script: ");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_ECHOLNPGM(Z_PROBE_END_SCRIPT);
|
SERIAL_ECHO("Z Probe End Script: ");
|
||||||
|
SERIAL_ECHOLNPGM(Z_PROBE_END_SCRIPT);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
enqueuecommands_P(PSTR(Z_PROBE_END_SCRIPT));
|
enqueuecommands_P(PSTR(Z_PROBE_END_SCRIPT));
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("<<< gcode_G29");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("<<< gcode_G29");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3891,6 +4009,12 @@ inline void gcode_M111() {
|
|||||||
SERIAL_ECHOLNPGM(MSG_DEBUG_DRYRUN);
|
SERIAL_ECHOLNPGM(MSG_DEBUG_DRYRUN);
|
||||||
disable_all_heaters();
|
disable_all_heaters();
|
||||||
}
|
}
|
||||||
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHO_START;
|
||||||
|
SERIAL_ECHOLNPGM(MSG_DEBUG_LEVELING);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4377,22 +4501,28 @@ inline void gcode_M206() {
|
|||||||
* M666: Set delta endstop adjustment
|
* M666: Set delta endstop adjustment
|
||||||
*/
|
*/
|
||||||
inline void gcode_M666() {
|
inline void gcode_M666() {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM(">>> gcode_M666");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM(">>> gcode_M666");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
|
for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
|
||||||
if (code_seen(axis_codes[i])) {
|
if (code_seen(axis_codes[i])) {
|
||||||
endstop_adj[i] = code_value();
|
endstop_adj[i] = code_value();
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPGM("endstop_adj[");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_ECHO(axis_codes[i]);
|
SERIAL_ECHOPGM("endstop_adj[");
|
||||||
SERIAL_ECHOPAIR("] = ", endstop_adj[i]);
|
SERIAL_ECHO(axis_codes[i]);
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("] = ", endstop_adj[i]);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOLNPGM("<<< gcode_M666");
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
|
SERIAL_ECHOLNPGM("<<< gcode_M666");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
|
#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
@ -6096,9 +6226,11 @@ void clamp_to_software_endstops(float target[3]) {
|
|||||||
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
||||||
if (zprobe_zoffset < 0) negative_z_offset += zprobe_zoffset;
|
if (zprobe_zoffset < 0) negative_z_offset += zprobe_zoffset;
|
||||||
if (home_offset[Z_AXIS] < 0) {
|
if (home_offset[Z_AXIS] < 0) {
|
||||||
#ifdef DEBUG_LEVELING
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
SERIAL_ECHOPAIR("> clamp_to_software_endstops > Add home_offset[Z_AXIS]:", home_offset[Z_AXIS]);
|
if (marlin_debug_flags & DEBUG_LEVELING) {
|
||||||
SERIAL_EOL;
|
SERIAL_ECHOPAIR("> clamp_to_software_endstops > Add home_offset[Z_AXIS]:", home_offset[Z_AXIS]);
|
||||||
|
SERIAL_EOL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
negative_z_offset += home_offset[Z_AXIS];
|
negative_z_offset += home_offset[Z_AXIS];
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@
|
|||||||
#define MSG_DEBUG_INFO "DEBUG INFO ENABLED"
|
#define MSG_DEBUG_INFO "DEBUG INFO ENABLED"
|
||||||
#define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED"
|
#define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED"
|
||||||
#define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED"
|
#define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED"
|
||||||
|
#define MSG_DEBUG_LEVELING "DEBUG LEVELING ENABLED"
|
||||||
|
|
||||||
// LCD Menu Messages
|
// LCD Menu Messages
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user