Probe Wizard XY position (#20167)

This commit is contained in:
wmariz 2020-11-18 00:54:21 -03:00 committed by Scott Lahteine
parent 7848096acb
commit 26d3caf97c
6 changed files with 27 additions and 14 deletions

View file

@ -1085,6 +1085,7 @@
//#define PROBE_OFFSET_WIZARD
#if ENABLED(PROBE_OFFSET_WIZARD)
#define PROBE_OFFSET_START -4.0 // Estimated nozzle-to-probe Z offset, plus a little extra
//#define PROBE_OFFSET_WIZARD_XY_POS XY_CENTER // Set a convenient position to do the measurement
#endif
#endif
@ -3447,7 +3448,7 @@
#define GANTRY_CALIBRATION_FEEDRATE 500 // Feedrate for correction move
//#define GANTRY_CALIBRATION_TO_MIN // Enable to calibrate Z in the MIN direction
//#define GANTRY_CALIBRATION_SAFE_POSITION { X_CENTER, Y_CENTER } // Safe position for nozzle
//#define GANTRY_CALIBRATION_SAFE_POSITION XY_CENTER // Safe position for nozzle
//#define GANTRY_CALIBRATION_XY_PARK_FEEDRATE 3000 // XY Park Feedrate - MMM
//#define GANTRY_CALIBRATION_COMMANDS_PRE ""
#define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position

View file

@ -100,6 +100,7 @@
#define _Y_HALF_BED ((Y_BED_SIZE) / 2)
#define X_CENTER TERN(BED_CENTER_AT_0_0, 0, _X_HALF_BED)
#define Y_CENTER TERN(BED_CENTER_AT_0_0, 0, _Y_HALF_BED)
#define XY_CENTER { X_CENTER, Y_CENTER }
// Get the linear boundaries of the bed
#define X_MIN_BED (X_CENTER - _X_HALF_BED)

View file

@ -622,7 +622,7 @@ public:
//
// Special handling if a move is underway
//
#if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
#if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)) || (ENABLED(PROBE_OFFSET_WIZARD) && defined(PROBE_OFFSET_WIZARD_XY_POS))
#define LCD_HAS_WAIT_FOR_MOVE 1
static bool wait_for_move;
#else

View file

@ -220,7 +220,7 @@ void _lcd_draw_homing();
#endif
#if ENABLED(PROBE_OFFSET_WIZARD)
void goto_probe_offset_wizard();
void home_and_goto_probe_offset_wizard();
#endif
#if ENABLED(LCD_BED_LEVELING) || (HAS_LEVELING && DISABLED(SLIM_LCD_MENUS))

View file

@ -488,7 +488,7 @@ void menu_backlash();
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
#if ENABLED(PROBE_OFFSET_WIZARD)
SUBMENU(MSG_PROBE_WIZARD, goto_probe_offset_wizard);
SUBMENU(MSG_PROBE_WIZARD, home_and_goto_probe_offset_wizard);
#endif
END_MENU();

View file

@ -36,6 +36,7 @@
#include "menu_item.h"
#include "menu_addon.h"
#include "../../gcode/queue.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
@ -120,22 +121,32 @@ void probe_offset_wizard_menu() {
END_MENU();
}
void goto_probe_offset_wizard() {
ui.defer_status_screen();
#ifdef PROBE_OFFSET_WIZARD_XY_POS
prepare_for_calibration();
#define HAS_PROBE_OFFSET_WIZARD_XY_POS 1
probe.offset.z = PROBE_OFFSET_START;
inline void goto_probe_offset_wizard() {
if (ui.wait_for_move) return;
constexpr xy_pos_t wizard_pos = PROBE_OFFSET_WIZARD_XY_POS;
current_position = wizard_pos;
ui.wait_for_move = true;
line_to_current_position(MMM_TO_MMS(HOMING_FEEDRATE_XY)); // Could invoke idle()
ui.wait_for_move = false;
ui.synchronize();
prepare_for_calibration();
probe.offset.z = PROBE_OFFSET_START;
ui.goto_screen(probe_offset_wizard_menu);
ui.defer_status_screen();
}
set_all_unhomed();
#endif
void home_and_goto_probe_offset_wizard() {
queue.inject_P(G28_STR);
ui.goto_screen([]{
_lcd_draw_homing();
if (all_axes_homed()) {
ui.goto_screen(probe_offset_wizard_menu);
ui.defer_status_screen();
}
if (all_axes_homed())
ui.goto_screen(TERN(HAS_PROBE_OFFSET_WIZARD_XY_POS, goto_probe_offset_wizard, probe_offset_wizard_menu));
});
}