|
|
@ -887,14 +887,35 @@ void lcd_cooldown() {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
static int _lcd_level_bed_position;
|
|
|
|
static int _lcd_level_bed_position;
|
|
|
|
|
|
|
|
static bool mbl_wait_for_move = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Utility to go to the next mesh point
|
|
|
|
|
|
|
|
// A raise is added between points if MIN_Z_HEIGHT_FOR_HOMING is in use
|
|
|
|
|
|
|
|
// Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
|
|
|
|
|
|
|
|
// Z position will be restored with the final action, a G28
|
|
|
|
|
|
|
|
inline void _mbl_goto_xy(float x, float y) {
|
|
|
|
|
|
|
|
mbl_wait_for_move = true;
|
|
|
|
|
|
|
|
#if MIN_Z_HEIGHT_FOR_HOMING > 0
|
|
|
|
|
|
|
|
current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING;
|
|
|
|
|
|
|
|
line_to_current(Z_AXIS);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
current_position[X_AXIS] = x + home_offset[X_AXIS];
|
|
|
|
|
|
|
|
current_position[Y_AXIS] = y + home_offset[Y_AXIS];
|
|
|
|
|
|
|
|
line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
|
|
|
|
|
|
|
#if MIN_Z_HEIGHT_FOR_HOMING > 0
|
|
|
|
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
|
|
|
|
|
|
line_to_current(Z_AXIS);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
|
|
|
|
mbl_wait_for_move = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* MBL Wait for controller movement and clicks:
|
|
|
|
* 5. MBL Wait for controller movement and clicks:
|
|
|
|
* - Movement adjusts the Z axis
|
|
|
|
* - Movement adjusts the Z axis
|
|
|
|
* - Click saves the Z and goes to the next mesh point
|
|
|
|
* - Click saves the Z, goes to the next mesh point
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void _lcd_level_bed_procedure() {
|
|
|
|
static void _lcd_level_bed_procedure() {
|
|
|
|
static bool mbl_wait_for_move = false;
|
|
|
|
|
|
|
|
// Menu handlers may be called in a re-entrant fashion
|
|
|
|
// Menu handlers may be called in a re-entrant fashion
|
|
|
|
// if they call st_synchronize or plan_buffer_line. So
|
|
|
|
// if they call st_synchronize or plan_buffer_line. So
|
|
|
|
// while waiting for a move we just ignore new input.
|
|
|
|
// while waiting for a move we just ignore new input.
|
|
|
@ -931,11 +952,7 @@ void lcd_cooldown() {
|
|
|
|
if (LCD_CLICKED) {
|
|
|
|
if (LCD_CLICKED) {
|
|
|
|
if (!debounce_click) {
|
|
|
|
if (!debounce_click) {
|
|
|
|
debounce_click = true; // ignore multiple "clicks" in a row
|
|
|
|
debounce_click = true; // ignore multiple "clicks" in a row
|
|
|
|
int ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS),
|
|
|
|
mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]);
|
|
|
|
iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
|
|
|
|
|
|
|
|
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
|
|
|
|
|
|
|
mbl.set_z(ix, iy, current_position[Z_AXIS]);
|
|
|
|
|
|
|
|
_lcd_level_bed_position++;
|
|
|
|
|
|
|
|
if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
|
|
|
|
if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
|
|
|
|
lcd_return_to_status();
|
|
|
|
lcd_return_to_status();
|
|
|
|
LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
|
|
|
|
LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
|
|
|
@ -946,24 +963,16 @@ void lcd_cooldown() {
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
|
|
line_to_current(Z_AXIS);
|
|
|
|
line_to_current(Z_AXIS);
|
|
|
|
st_synchronize();
|
|
|
|
st_synchronize();
|
|
|
|
mbl.active = 1;
|
|
|
|
mbl.active = true;
|
|
|
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
#if ENABLED(NEWPANEL)
|
|
|
|
#if ENABLED(NEWPANEL)
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
mbl_wait_for_move = true;
|
|
|
|
int ix, iy;
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
|
|
mbl.zigzag(_lcd_level_bed_position, ix, iy);
|
|
|
|
line_to_current(Z_AXIS);
|
|
|
|
_mbl_goto_xy(mbl.get_x(ix), mbl.get_y(iy));
|
|
|
|
ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
|
|
|
|
|
|
|
|
iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
|
|
|
|
|
|
|
|
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
|
|
|
|
|
|
|
current_position[X_AXIS] = mbl.get_x(ix);
|
|
|
|
|
|
|
|
current_position[Y_AXIS] = mbl.get_y(iy);
|
|
|
|
|
|
|
|
line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
|
|
|
|
|
|
|
st_synchronize();
|
|
|
|
|
|
|
|
mbl_wait_for_move = false;
|
|
|
|
|
|
|
|
encoderPosition = 0;
|
|
|
|
encoderPosition = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -973,22 +982,25 @@ void lcd_cooldown() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 4. MBL Display "Click to Begin", wait for click
|
|
|
|
|
|
|
|
* Move to the first probe position
|
|
|
|
|
|
|
|
*/
|
|
|
|
static void _lcd_level_bed_homing_done() {
|
|
|
|
static void _lcd_level_bed_homing_done() {
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING), NULL);
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING), NULL);
|
|
|
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
|
|
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
|
|
|
|
|
|
|
if (mbl_wait_for_move) return;
|
|
|
|
if (LCD_CLICKED) {
|
|
|
|
if (LCD_CLICKED) {
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
|
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
current_position[X_AXIS] = MESH_MIN_X;
|
|
|
|
_mbl_goto_xy(MESH_MIN_X, MESH_MIN_Y);
|
|
|
|
current_position[Y_AXIS] = MESH_MIN_Y;
|
|
|
|
|
|
|
|
line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
|
|
|
|
|
|
|
_lcd_level_bed_position = 0;
|
|
|
|
_lcd_level_bed_position = 0;
|
|
|
|
lcd_goto_menu(_lcd_level_bed_procedure, true);
|
|
|
|
lcd_goto_menu(_lcd_level_bed_procedure, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* MBL Move to mesh starting point
|
|
|
|
* 3. MBL Display "Hoing XYZ" - Wait for homing to finish
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void _lcd_level_bed_homing() {
|
|
|
|
static void _lcd_level_bed_homing() {
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
|
|
@ -998,7 +1010,7 @@ void lcd_cooldown() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* MBL Continue Bed Leveling...
|
|
|
|
* 2. MBL Continue Bed Leveling...
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void _lcd_level_bed_continue() {
|
|
|
|
static void _lcd_level_bed_continue() {
|
|
|
|
defer_return_to_status = true;
|
|
|
|
defer_return_to_status = true;
|
|
|
@ -1009,7 +1021,7 @@ void lcd_cooldown() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* MBL entry-point
|
|
|
|
* 1. MBL entry-point: "Cancel" or "Level Bed"
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void lcd_level_bed() {
|
|
|
|
static void lcd_level_bed() {
|
|
|
|
START_MENU();
|
|
|
|
START_MENU();
|
|
|
|