Fix usage, commentary of MANUAL_PROBE_START_Z, Z_AFTER_PROBING (#21692)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
pinchies 2021-04-25 18:48:20 +10:00 committed by Scott Lahteine
parent 84e8d4c603
commit 7e3cf82a40
6 changed files with 52 additions and 38 deletions

View File

@ -934,7 +934,6 @@
* or (with LCD_BED_LEVELING) the LCD controller. * or (with LCD_BED_LEVELING) the LCD controller.
*/ */
//#define PROBE_MANUALLY //#define PROBE_MANUALLY
//#define MANUAL_PROBE_START_Z 0.2
/** /**
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment. * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
@ -1409,6 +1408,11 @@
*/ */
//#define DEBUG_LEVELING_FEATURE //#define DEBUG_LEVELING_FEATURE
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL, PROBE_MANUALLY)
// Set a height for the start of manual adjustment
#define MANUAL_PROBE_START_Z 0.2 // (mm) Comment out to use the last-measured height
#endif
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL) #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
// Gradually reduce leveling correction until a set height is reached, // Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.

View File

@ -213,27 +213,27 @@ void reset_bed_level() {
void _manual_goto_xy(const xy_pos_t &pos) { void _manual_goto_xy(const xy_pos_t &pos) {
// Get the resting Z position for after the XY move
#ifdef MANUAL_PROBE_START_Z #ifdef MANUAL_PROBE_START_Z
constexpr float startz = _MAX(0, MANUAL_PROBE_START_Z); constexpr float finalz = _MAX(0, MANUAL_PROBE_START_Z); // If a MANUAL_PROBE_START_Z value is set, always respect it
#if MANUAL_PROBE_HEIGHT > 0
do_blocking_move_to_xy_z(pos, MANUAL_PROBE_HEIGHT);
do_blocking_move_to_z(startz);
#else #else
do_blocking_move_to_xy_z(pos, startz); #warning "It's recommended to set some MANUAL_PROBE_START_Z value for manual leveling."
#endif #endif
#elif MANUAL_PROBE_HEIGHT > 0 #if Z_CLEARANCE_BETWEEN_MANUAL_PROBES > 0 // A probe/obstacle clearance exists so there is a raise:
const float prev_z = current_position.z; #ifndef MANUAL_PROBE_START_Z
do_blocking_move_to_xy_z(pos, MANUAL_PROBE_HEIGHT); const float finalz = current_position.z; // - Use the current Z for starting-Z if no MANUAL_PROBE_START_Z was provided
do_blocking_move_to_z(prev_z); #endif
#else do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_MANUAL_PROBES); // - Raise Z, then move to the new XY
do_blocking_move_to_xy(pos); do_blocking_move_to_z(finalz); // - Lower down to the starting Z height, ready for adjustment!
#elif defined(MANUAL_PROBE_START_Z) // A starting-Z was provided, but there's no raise:
do_blocking_move_to_xy_z(pos, finalz); // - Move in XY then down to the starting Z height, ready for adjustment!
#else // Zero raise and no starting Z height either:
do_blocking_move_to_xy(pos); // - Move over with no raise, ready for adjustment!
#endif #endif
current_position = pos;
TERN_(LCD_BED_LEVELING, ui.wait_for_move = false); TERN_(LCD_BED_LEVELING, ui.wait_for_move = false);
} }
#endif #endif // MESH_BED_LEVELING || PROBE_MANUALLY
#endif // HAS_LEVELING #endif // HAS_LEVELING

View File

@ -100,7 +100,11 @@ void GcodeSuite::G29() {
// For each G29 S2... // For each G29 S2...
if (mbl_probe_index == 0) { if (mbl_probe_index == 0) {
// Move close to the bed before the first point // Move close to the bed before the first point
do_blocking_move_to_z(MANUAL_PROBE_START_Z); do_blocking_move_to_z(0.4f
#ifdef MANUAL_PROBE_START_Z
+ (MANUAL_PROBE_START_Z) - 0.4f
#endif
);
} }
else { else {
// Save Z for the previous mesh position // Save Z for the previous mesh position
@ -116,8 +120,14 @@ void GcodeSuite::G29() {
_manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] }); _manual_goto_xy({ mbl.index_to_xpos[ix], mbl.index_to_ypos[iy] });
} }
else { else {
// One last "return to the bed" (as originally coded) at completion // Move to the after probing position
current_position.z = MANUAL_PROBE_HEIGHT; current_position.z = (
#ifdef Z_AFTER_PROBING
Z_AFTER_PROBING
#else
Z_CLEARANCE_BETWEEN_MANUAL_PROBES
#endif
);
line_to_current_position(); line_to_current_position();
planner.synchronize(); planner.synchronize();

View File

@ -788,14 +788,6 @@
#endif #endif
#endif // FILAMENT_RUNOUT_SENSOR #endif // FILAMENT_RUNOUT_SENSOR
#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
#undef PROBE_MANUALLY
#endif
#if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
#define PROBE_SELECTED 1
#endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
#if DISABLED(NOZZLE_AS_PROBE) #if DISABLED(NOZZLE_AS_PROBE)
#define HAS_PROBE_XY_OFFSET 1 #define HAS_PROBE_XY_OFFSET 1
@ -865,14 +857,16 @@
#define PLANNER_LEVELING 1 #define PLANNER_LEVELING 1
#endif #endif
#endif #endif
#if EITHER(HAS_ABL_OR_UBL, Z_MIN_PROBE_REPEATABILITY_TEST)
#define HAS_PROBING_PROCEDURE 1
#endif
#if !HAS_LEVELING #if !HAS_LEVELING
#undef PROBE_MANUALLY
#undef RESTORE_LEVELING_AFTER_G28 #undef RESTORE_LEVELING_AFTER_G28
#undef ENABLE_LEVELING_AFTER_G28 #undef ENABLE_LEVELING_AFTER_G28
#endif #endif
#if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
#undef PROBE_MANUALLY
#endif
#if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
#define PROBE_SELECTED 1
#endif
#ifdef GRID_MAX_POINTS_X #ifdef GRID_MAX_POINTS_X
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))

View File

@ -2910,9 +2910,9 @@
#define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
#endif #endif
#if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT
#define MANUAL_PROBE_HEIGHT Z_CLEARANCE_BETWEEN_PROBES #define Z_CLEARANCE_BETWEEN_MANUAL_PROBES Z_CLEARANCE_BETWEEN_PROBES
#else #else
#define MANUAL_PROBE_HEIGHT Z_HOMING_HEIGHT #define Z_CLEARANCE_BETWEEN_MANUAL_PROBES Z_HOMING_HEIGHT
#endif #endif
#ifndef Z_CLEARANCE_MULTI_PROBE #ifndef Z_CLEARANCE_MULTI_PROBE
#define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES #define Z_CLEARANCE_MULTI_PROBE Z_CLEARANCE_BETWEEN_PROBES
@ -2922,8 +2922,14 @@
#endif #endif
#endif #endif
#if !defined(MANUAL_PROBE_START_Z) && defined(Z_CLEARANCE_BETWEEN_PROBES) // Define a starting height for measuring manual probe points
#ifndef MANUAL_PROBE_START_Z
#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY)
// Leave MANUAL_PROBE_START_Z undefined so the prior Z height will be used.
// Note: If Z_CLEARANCE_BETWEEN_MANUAL_PROBES is 0 there will be no raise between points
#elif ENABLED(AUTO_BED_LEVELING_UBL) && defined(Z_CLEARANCE_BETWEEN_PROBES)
#define MANUAL_PROBE_START_Z Z_CLEARANCE_BETWEEN_PROBES #define MANUAL_PROBE_START_Z Z_CLEARANCE_BETWEEN_PROBES
#endif
#endif #endif
#ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation #ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation

View File

@ -63,16 +63,16 @@
// and allow the command queue to be processed. // and allow the command queue to be processed.
// //
// When G29 finishes the last move: // When G29 finishes the last move:
// - Raise Z to the "manual probe height" // - Raise Z to the "Z after probing" height
// - Don't return until done. // - Don't return until done.
// //
// ** This blocks the command queue! ** // ** This blocks the command queue! **
// //
void _lcd_level_bed_done() { void _lcd_level_bed_done() {
if (!ui.wait_for_move) { if (!ui.wait_for_move) {
#if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING) #if Z_AFTER_PROBING > 0 && DISABLED(MESH_BED_LEVELING)
// Display "Done" screen and wait for moves to complete // Display "Done" screen and wait for moves to complete
line_to_z(MANUAL_PROBE_HEIGHT); line_to_z(Z_AFTER_PROBING);
ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE)); ui.synchronize(GET_TEXT(MSG_LEVEL_BED_DONE));
#endif #endif
ui.goto_previous_screen_no_defer(); ui.goto_previous_screen_no_defer();