From 991a34aff271dae57b5cd789bd49447961e91508 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 26 Aug 2016 15:42:16 -0500 Subject: [PATCH] Log whether homing with probe or endstop --- Marlin/Marlin_main.cpp | 90 +++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 29f091fd0f..6c9ee10067 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1395,8 +1395,7 @@ bool get_target_extruder_from_command(int code) { SERIAL_ECHO_START; SERIAL_CHAR('M'); SERIAL_ECHO(code); - SERIAL_ECHOPAIR(" " MSG_INVALID_EXTRUDER " ", code_value_byte()); - SERIAL_EOL; + SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", code_value_byte()); return true; } target_extruder = code_value_byte(); @@ -1504,8 +1503,7 @@ void update_software_endstops(AxisEnum axis) { SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]); SERIAL_ECHOPAIR("\n position_shift = ", position_shift[axis]); SERIAL_ECHOPAIR("\n soft_endstop_min = ", soft_endstop_min[axis]); - SERIAL_ECHOPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("\n soft_endstop_max = ", soft_endstop_max[axis]); } #endif @@ -1586,23 +1584,42 @@ static void set_axis_is_at_home(AxisEnum axis) { current_position[axis] = LOGICAL_POSITION(base_home_pos(axis), axis); update_software_endstops(axis); + if (axis == Z_AXIS) { + #if HAS_BED_PROBE && Z_HOME_DIR < 0 + #if DISABLED(Z_MIN_PROBE_ENDSTOP) + current_position[Z_AXIS] -= zprobe_zoffset; + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOLNPGM("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***"); + SERIAL_ECHOLNPAIR("> zprobe_zoffset = ", zprobe_zoffset); + } + #endif + #elif ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) + SERIAL_ECHOLNPGM("*** Z HOMED TO ENDSTOP (Z_MIN_PROBE_ENDSTOP) ***"); + #endif + #endif + } + #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP) if (axis == Z_AXIS) { current_position[Z_AXIS] -= zprobe_zoffset; #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("> zprobe_zoffset = ", zprobe_zoffset); - SERIAL_EOL; + SERIAL_ECHOLNPGM("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***"); + SERIAL_ECHOLNPAIR("> zprobe_zoffset = ", zprobe_zoffset); } #endif } + #elif HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) + SERIAL_ECHOLNPGM("*** Z HOMED TO ENDSTOP (Z_MIN_PROBE_ENDSTOP) ***"); #endif #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]); - SERIAL_ECHOPAIR("] = ", home_offset[axis]); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("] = ", home_offset[axis]); DEBUG_POS("", current_position); } #endif @@ -2054,8 +2071,7 @@ static void clean_up_after_endstop_or_probe_move() { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { DEBUG_POS("set_probe_deployed", current_position); - SERIAL_ECHOPAIR("deploy: ", deploy); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("deploy: ", deploy); } #endif @@ -3029,10 +3045,8 @@ inline void gcode_G28() { if (destination[Z_AXIS] > current_position[Z_AXIS]) { #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("Raise Z (before homing) to ", destination[Z_AXIS]); - SERIAL_EOL; - } + if (DEBUGGING(LEVELING)) + SERIAL_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]); #endif do_blocking_move_to_z(destination[Z_AXIS]); @@ -3842,8 +3856,7 @@ inline void gcode_G28() { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { SERIAL_ECHOPAIR("> BEFORE apply_rotation_xyz > stepper_z = ", stepper_z); - SERIAL_ECHOPAIR(" ... z_tmp = ", z_tmp); - SERIAL_EOL; + SERIAL_ECHOLNPAIR(" ... z_tmp = ", z_tmp); } #endif @@ -3851,10 +3864,8 @@ inline void gcode_G28() { apply_rotation_xyz(planner.bed_level_matrix, x_tmp, y_tmp, z_tmp); #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp); - SERIAL_EOL; - } + if (DEBUGGING(LEVELING)) + SERIAL_ECHOLNPAIR("> AFTER apply_rotation_xyz > z_tmp = ", z_tmp); #endif // Adjust the current Z and send it to the planner. @@ -4380,8 +4391,7 @@ inline void gcode_M42() { Y_current /= 1.25; if (verbose_level > 3) { SERIAL_ECHOPAIR("Pulling point towards center:", X_current); - SERIAL_ECHOPAIR(", ", Y_current); - SERIAL_EOL; + SERIAL_ECHOLNPAIR(", ", Y_current); } } #endif @@ -4389,8 +4399,7 @@ inline void gcode_M42() { SERIAL_PROTOCOLPGM("Going to:"); SERIAL_ECHOPAIR(" X", X_current); SERIAL_ECHOPAIR(" Y", Y_current); - SERIAL_ECHOPAIR(" Z", current_position[Z_AXIS]); - SERIAL_EOL; + SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]); } do_blocking_move_to_xy(X_current, Y_current); } // n_legs loop @@ -4948,8 +4957,7 @@ inline void gcode_M111() { } else { SERIAL_ECHO_START; - SERIAL_ECHOPAIR("M113 S", (unsigned long)host_keepalive_interval); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("M113 S", (unsigned long)host_keepalive_interval); } } @@ -5399,23 +5407,19 @@ inline void gcode_M203() { inline void gcode_M204() { if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments. planner.travel_acceleration = planner.acceleration = code_value_linear_units(); - SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", planner.acceleration); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("Setting Print and Travel Acceleration: ", planner.acceleration); } if (code_seen('P')) { planner.acceleration = code_value_linear_units(); - SERIAL_ECHOPAIR("Setting Print Acceleration: ", planner.acceleration); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("Setting Print Acceleration: ", planner.acceleration); } if (code_seen('R')) { planner.retract_acceleration = code_value_linear_units(); - SERIAL_ECHOPAIR("Setting Retract Acceleration: ", planner.retract_acceleration); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("Setting Retract Acceleration: ", planner.retract_acceleration); } if (code_seen('T')) { planner.travel_acceleration = code_value_linear_units(); - SERIAL_ECHOPAIR("Setting Travel Acceleration: ", planner.travel_acceleration); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("Setting Travel Acceleration: ", planner.travel_acceleration); } } @@ -5491,8 +5495,7 @@ inline void gcode_M206() { if (DEBUGGING(LEVELING)) { SERIAL_ECHOPGM("endstop_adj["); SERIAL_ECHO(axis_codes[i]); - SERIAL_ECHOPAIR("] = ", endstop_adj[i]); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("] = ", endstop_adj[i]); } #endif } @@ -5511,8 +5514,7 @@ inline void gcode_M206() { */ inline void gcode_M666() { if (code_seen('Z')) z_endstop_adj = code_value_axis_units(Z_AXIS); - SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj); } #endif // !DELTA && Z_DUAL_ENDSTOPS @@ -5587,8 +5589,7 @@ inline void gcode_M211() { SERIAL_ECHOPGM(" " MSG_SOFT_MAX ": "); SERIAL_ECHOPAIR( MSG_X, soft_endstop_max[X_AXIS]); SERIAL_ECHOPAIR(" " MSG_Y, soft_endstop_max[Y_AXIS]); - SERIAL_ECHOPAIR(" " MSG_Z, soft_endstop_max[Z_AXIS]); - SERIAL_EOL; + SERIAL_ECHOLNPAIR(" " MSG_Z, soft_endstop_max[Z_AXIS]); } #if HOTENDS > 1 @@ -6822,8 +6823,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no"); - SERIAL_EOL; + SERIAL_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no"); DEBUG_POS("New extruder (parked)", current_position); } #endif @@ -6932,10 +6932,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n ypos = RAW_CURRENT_POSITION(Y_AXIS); current_position[Z_AXIS] += mbl.get_z(xpos + xydiff[X_AXIS], ypos + xydiff[Y_AXIS]) - mbl.get_z(xpos, ypos); #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(" after: ", current_position[Z_AXIS]); - SERIAL_EOL; - } + if (DEBUGGING(LEVELING)) + SERIAL_ECHOLNPAIR(" after: ", current_position[Z_AXIS]); #endif }