Skip to content

Commit

Permalink
Probe Wizard XY position (MarlinFirmware#20167)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmariz authored and Kannix2005 committed Dec 7, 2020
1 parent 8c7fda7 commit f96b6e6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ class MarlinUI {
//
// 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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
33 changes: 22 additions & 11 deletions Marlin/src/lcd/menu/menu_probe_offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -120,22 +121,32 @@ void probe_offset_wizard_menu() {
END_MENU();
}

void goto_probe_offset_wizard() {
ui.defer_status_screen();

prepare_for_calibration();
#ifdef PROBE_OFFSET_WIZARD_XY_POS

#define HAS_PROBE_OFFSET_WIZARD_XY_POS 1

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();
}

probe.offset.z = PROBE_OFFSET_START;
#endif

set_all_unhomed();
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));
});
}

Expand Down

0 comments on commit f96b6e6

Please sign in to comment.