|
|
|
@ -54,7 +54,6 @@
|
|
|
|
|
#include "planner.h"
|
|
|
|
|
#elif ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
|
|
|
|
|
#include "mesh_bed_leveling.h"
|
|
|
|
|
extern void mesh_probing_done();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
|
|
|
|
@ -557,7 +556,6 @@ uint16_t max_display_update_time = 0;
|
|
|
|
|
static bool no_reentry = false;
|
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
|
|
|
|
|
if (no_reentry) return;
|
|
|
|
|
|
|
|
|
|
// Make this the current handler till all moves are done
|
|
|
|
|
no_reentry = true;
|
|
|
|
|
screenFunc_t old_screen = currentScreen;
|
|
|
|
@ -1745,59 +1743,34 @@ void kill_screen(const char* lcd_msg) {
|
|
|
|
|
#endif
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
bool lcd_wait_for_move;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Bed leveling is done. Wait for G29 to complete.
|
|
|
|
|
// A flag is used so that this can release control
|
|
|
|
|
// and allow the command queue to be processed.
|
|
|
|
|
//
|
|
|
|
|
// When G29 finishes the last move:
|
|
|
|
|
// - Raise Z to the "manual probe height"
|
|
|
|
|
// - Don't return until done.
|
|
|
|
|
//
|
|
|
|
|
// Raise Z to the "manual probe height"
|
|
|
|
|
// Don't return until done.
|
|
|
|
|
// ** This blocks the command queue! **
|
|
|
|
|
//
|
|
|
|
|
void _lcd_after_probing() {
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
|
line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
|
|
|
|
|
#endif
|
|
|
|
|
void _lcd_level_bed_done() {
|
|
|
|
|
if (!lcd_wait_for_move) {
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING)
|
|
|
|
|
// Display "Done" screen and wait for moves to complete
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
|
|
|
|
|
lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
|
|
|
|
|
#endif
|
|
|
|
|
lcd_goto_previous_menu();
|
|
|
|
|
lcd_completion_feedback();
|
|
|
|
|
defer_return_to_status = false;
|
|
|
|
|
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
|
|
// Utility to go to the next mesh point
|
|
|
|
|
inline void _manual_probe_goto_xy(const float rx, const float ry) {
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
|
const float prev_z = current_position[Z_AXIS];
|
|
|
|
|
line_to_z(Z_MIN_POS + MANUAL_PROBE_HEIGHT);
|
|
|
|
|
#endif
|
|
|
|
|
current_position[X_AXIS] = rx;
|
|
|
|
|
current_position[Y_AXIS] = ry;
|
|
|
|
|
planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
|
line_to_z(prev_z);
|
|
|
|
|
#endif
|
|
|
|
|
lcd_synchronize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(PROBE_MANUALLY)
|
|
|
|
|
|
|
|
|
|
bool lcd_wait_for_move;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Bed leveling is done. Wait for G29 to complete.
|
|
|
|
|
// A flag is used so that this can release control
|
|
|
|
|
// and allow the command queue to be processed.
|
|
|
|
|
//
|
|
|
|
|
void _lcd_level_bed_done() {
|
|
|
|
|
if (!lcd_wait_for_move) _lcd_after_probing();
|
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
|
|
|
|
|
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_DONE));
|
|
|
|
|
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void _lcd_level_goto_next_point();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1809,46 +1782,24 @@ void kill_screen(const char* lcd_msg) {
|
|
|
|
|
if (lcd_clicked) {
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Save the current Z position
|
|
|
|
|
// Save the current Z position and move
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// MBL records the position but doesn't move to the next one
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// If done...
|
|
|
|
|
if (++manual_probe_index >= total_probe_points) {
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// The last G29 will record and enable but not move.
|
|
|
|
|
// The last G29 records the point and enables bed leveling
|
|
|
|
|
//
|
|
|
|
|
lcd_wait_for_move = true;
|
|
|
|
|
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
|
|
|
|
lcd_goto_screen(_lcd_level_bed_done);
|
|
|
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
|
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
|
|
|
|
#elif ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
|
|
_lcd_after_probing();
|
|
|
|
|
|
|
|
|
|
mbl.has_mesh = true;
|
|
|
|
|
mesh_probing_done();
|
|
|
|
|
|
|
|
|
|
enqueue_and_echo_commands_P(PSTR("G29 S2"));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// MESH_BED_LEVELING: Z already stored, just move
|
|
|
|
|
// PROBE_MANUALLY: Send G29 to record Z, then move
|
|
|
|
|
else
|
|
|
|
|
_lcd_level_goto_next_point();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1884,39 +1835,22 @@ void kill_screen(const char* lcd_msg) {
|
|
|
|
|
lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
|
|
|
|
|
}
|
|
|
|
|
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
|
if (!lcd_wait_for_move) lcd_goto_screen(_lcd_level_bed_get_z);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Step 5: Initiate a move to the next point
|
|
|
|
|
*/
|
|
|
|
|
void _lcd_level_goto_next_point() {
|
|
|
|
|
|
|
|
|
|
// Set the menu to display ahead of blocking call
|
|
|
|
|
lcd_goto_screen(_lcd_level_bed_moving);
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
|
|
|
|
|
int8_t px, py;
|
|
|
|
|
mbl.zigzag(manual_probe_index, px, py);
|
|
|
|
|
|
|
|
|
|
// Controls the loop until the move is done
|
|
|
|
|
_manual_probe_goto_xy(
|
|
|
|
|
mbl.index_to_xpos[px],
|
|
|
|
|
mbl.index_to_ypos[py]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// After the blocking function returns, change menus
|
|
|
|
|
lcd_goto_screen(_lcd_level_bed_get_z);
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(PROBE_MANUALLY)
|
|
|
|
|
|
|
|
|
|
// G29 Records Z, moves, and signals when it pauses
|
|
|
|
|
lcd_wait_for_move = true;
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
|
enqueue_and_echo_commands_P(PSTR("G29 V1"));
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(MESH_BED_LEVELING)
|
|
|
|
|
enqueue_and_echo_commands_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1"));
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1982,10 +1916,15 @@ void kill_screen(const char* lcd_msg) {
|
|
|
|
|
START_MENU();
|
|
|
|
|
MENU_BACK(MSG_PREPARE);
|
|
|
|
|
|
|
|
|
|
#if DISABLED(MESH_BED_LEVELING)
|
|
|
|
|
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
|
|
|
|
|
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
|
|
|
else if (leveling_is_valid())
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
if (leveling_is_valid()) {
|
|
|
|
|
new_level_state = planner.leveling_active;
|
|
|
|
|
MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
|
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &new_z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
|
|
|
|
@ -2021,9 +1960,6 @@ void kill_screen(const char* lcd_msg) {
|
|
|
|
|
|
|
|
|
|
void _lcd_goto_bed_leveling() {
|
|
|
|
|
lcd_goto_screen(lcd_bed_leveling);
|
|
|
|
|
#if ENABLED(LCD_BED_LEVELING)
|
|
|
|
|
new_level_state = planner.leveling_active;
|
|
|
|
|
#endif
|
|
|
|
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
|
|
|
|
new_z_fade_height = planner.z_fade_height;
|
|
|
|
|
#endif
|
|
|
|
|