Merge pull request #6858 from thinkyhead/bf_leveling_patch

Fixes for PROBE_MANUALLY and LCD_BED_LEVELING
master
Scott Lahteine 8 years ago committed by GitHub
commit 73ed0c63b4

1
.gitignore vendored

@ -52,6 +52,7 @@ tags
*.lo *.lo
*.o *.o
*.obj *.obj
*.ino.cpp
# Precompiled Headers # Precompiled Headers
*.gch *.gch

@ -3800,6 +3800,10 @@ void home_all_axes() { gcode_G28(true); }
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) #if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
extern bool lcd_wait_for_move;
#endif
inline void _manual_goto_xy(const float &x, const float &y) { inline void _manual_goto_xy(const float &x, const float &y) {
const float old_feedrate_mm_s = feedrate_mm_s; const float old_feedrate_mm_s = feedrate_mm_s;
@ -3822,6 +3826,10 @@ void home_all_axes() { gcode_G28(true); }
feedrate_mm_s = old_feedrate_mm_s; feedrate_mm_s = old_feedrate_mm_s;
stepper.synchronize(); stepper.synchronize();
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
#endif
} }
#endif #endif
@ -4190,7 +4198,7 @@ void home_all_axes() { gcode_G28(true); }
if (!g29_in_progress) { if (!g29_in_progress) {
#if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
abl_probe_index = 0; abl_probe_index = -1;
#endif #endif
abl_should_enable = planner.abl_enabled; abl_should_enable = planner.abl_enabled;
@ -4397,30 +4405,40 @@ void home_all_axes() { gcode_G28(true); }
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
const bool seenA = parser.seen('A'), seenQ = parser.seen('Q');
// For manual probing, get the next index to probe now.
// On the first probe this will be incremented to 0.
if (!seenA && !seenQ) {
++abl_probe_index;
g29_in_progress = true;
}
// Abort current G29 procedure, go back to ABLStart // Abort current G29 procedure, go back to ABLStart
if (parser.seen('A') && g29_in_progress) { if (seenA && g29_in_progress) {
SERIAL_PROTOCOLLNPGM("Manual G29 aborted"); SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops; soft_endstops_enabled = enable_soft_endstops;
#endif #endif
planner.abl_enabled = abl_should_enable; planner.abl_enabled = abl_should_enable;
g29_in_progress = false; g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
#endif
} }
// Query G29 status // Query G29 status
if (parser.seen('Q')) { if (verbose_level || seenQ) {
if (!g29_in_progress) SERIAL_PROTOCOLPGM("Manual G29 ");
SERIAL_PROTOCOLLNPGM("Manual G29 idle"); if (g29_in_progress) {
else { SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1);
SERIAL_PROTOCOLPAIR("Manual G29 point ", abl_probe_index + 1);
SERIAL_PROTOCOLLNPAIR(" of ", abl2); SERIAL_PROTOCOLLNPAIR(" of ", abl2);
} }
else
SERIAL_PROTOCOLLNPGM("idle");
} }
if (parser.seen('A') || parser.seen('Q')) return; if (seenA || seenQ) return;
// Fall through to probe the first point
g29_in_progress = true;
if (abl_probe_index == 0) { if (abl_probe_index == 0) {
// For the initial G29 save software endstop state // For the initial G29 save software endstop state
@ -4458,20 +4476,20 @@ void home_all_axes() { gcode_G28(true); }
#if ABL_GRID #if ABL_GRID
// Find a next point to probe // Skip any unreachable points
// On the first G29 this will be the first probe point
while (abl_probe_index < abl2) { while (abl_probe_index < abl2) {
// Set xCount, yCount based on abl_probe_index, with zig-zag // Set xCount, yCount based on abl_probe_index, with zig-zag
PR_OUTER_VAR = abl_probe_index / PR_INNER_END; PR_OUTER_VAR = abl_probe_index / PR_INNER_END;
PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END); PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END);
bool zig = (PR_OUTER_VAR & 1) != ((PR_OUTER_END) & 1); // Probe in reverse order for every other row/column
bool zig = (PR_OUTER_VAR & 1); // != ((PR_OUTER_END) & 1);
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR; if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
const float xBase = left_probe_bed_position + xGridSpacing * xCount, const float xBase = xCount * xGridSpacing + left_probe_bed_position,
yBase = front_probe_bed_position + yGridSpacing * yCount; yBase = yCount * yGridSpacing + front_probe_bed_position;
xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5)); xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5));
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5)); yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
@ -4488,7 +4506,6 @@ void home_all_axes() { gcode_G28(true); }
// Is there a next point to move to? // Is there a next point to move to?
if (abl_probe_index < abl2) { if (abl_probe_index < abl2) {
_manual_goto_xy(xProbe, yProbe); // Can be used here too! _manual_goto_xy(xProbe, yProbe); // Can be used here too!
++abl_probe_index;
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
// Disable software endstops to allow manual adjustment // Disable software endstops to allow manual adjustment
// If G29 is not completed, they will not be re-enabled // If G29 is not completed, they will not be re-enabled
@ -4497,10 +4514,9 @@ void home_all_axes() { gcode_G28(true); }
return; return;
} }
else { else {
// Then leveling is done!
// G29 finishing code goes here
// After recording the last point, activate abl // Leveling done! Fall through to G29 finishing code below
SERIAL_PROTOCOLLNPGM("Grid probing done."); SERIAL_PROTOCOLLNPGM("Grid probing done.");
g29_in_progress = false; g29_in_progress = false;
@ -4514,9 +4530,8 @@ void home_all_axes() { gcode_G28(true); }
// Probe at 3 arbitrary points // Probe at 3 arbitrary points
if (abl_probe_index < 3) { if (abl_probe_index < 3) {
xProbe = LOGICAL_X_POSITION(points[i].x); xProbe = LOGICAL_X_POSITION(points[abl_probe_index].x);
yProbe = LOGICAL_Y_POSITION(points[i].y); yProbe = LOGICAL_Y_POSITION(points[abl_probe_index].y);
++abl_probe_index;
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
// Disable software endstops to allow manual adjustment // Disable software endstops to allow manual adjustment
// If G29 is not completed, they will not be re-enabled // If G29 is not completed, they will not be re-enabled
@ -4587,7 +4602,7 @@ void home_all_axes() { gcode_G28(true); }
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5)); yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
indexIntoAB[xCount][yCount] = ++abl_probe_index; indexIntoAB[xCount][yCount] = ++abl_probe_index; // 0...
#endif #endif
#if IS_KINEMATIC #if IS_KINEMATIC
@ -4665,7 +4680,10 @@ void home_all_axes() { gcode_G28(true); }
// G29 Finishing Code // G29 Finishing Code
// //
// Unless this is a dry run, auto bed leveling will // Unless this is a dry run, auto bed leveling will
// definitely be enabled after this point // definitely be enabled after this point.
//
// If code above wants to continue leveling, it should
// return or loop before this point.
// //
// Restore state after probing // Restore state after probing
@ -4675,6 +4693,10 @@ void home_all_axes() { gcode_G28(true); }
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
#endif #endif
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
#endif
// Calculate leveling, print reports, correct the position // Calculate leveling, print reports, correct the position
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)

@ -1344,9 +1344,8 @@ void MarlinSettings::reset() {
#else #else
#define LINEAR_UNIT(N) N #define LINEAR_UNIT(N) N
#define VOLUMETRIC_UNIT(N) N #define VOLUMETRIC_UNIT(N) N
SERIAL_ECHOLNPGM(" G21 ; Units in mm\n"); SERIAL_ECHOLNPGM(" G21 ; Units in mm");
#endif #endif
SERIAL_EOL;
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
@ -1361,12 +1360,13 @@ void MarlinSettings::reset() {
serialprintPGM(parser.temp_units_name()); serialprintPGM(parser.temp_units_name());
#else #else
#define TEMP_UNIT(N) N #define TEMP_UNIT(N) N
SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius\n"); SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius");
#endif #endif
SERIAL_EOL;
#endif #endif
SERIAL_EOL;
/** /**
* Volumetric extrusion M200 * Volumetric extrusion M200
*/ */

@ -78,9 +78,6 @@ uint16_t max_display_update_time = 0;
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
bool drawing_screen = false; bool drawing_screen = false;
#define LCDVIEW_KEEP_REDRAWING LCDVIEW_CALL_REDRAW_NEXT
#else
#define LCDVIEW_KEEP_REDRAWING LCDVIEW_REDRAW_NOW
#endif #endif
#if ENABLED(DAC_STEPPER_CURRENT) #if ENABLED(DAC_STEPPER_CURRENT)
@ -479,22 +476,18 @@ uint16_t max_display_update_time = 0;
} }
/** /**
* Synchronize safely while holding the current screen * Show "Moving..." till moves are done, then revert to previous display.
* This blocks all further screen or stripe updates once called
*/ */
extern uint8_t commands_in_queue;
inline void lcd_synchronize() { inline void lcd_synchronize() {
static bool no_reentry = false; static bool no_reentry = false;
lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING)); lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING));
if (no_reentry) return; if (no_reentry) return;
// Make this the current handler till all moves are done
no_reentry = true; no_reentry = true;
screenFunc_t old_screen = currentScreen; screenFunc_t old_screen = currentScreen;
lcd_goto_screen(lcd_synchronize); lcd_goto_screen(lcd_synchronize);
while (commands_in_queue) { stepper.synchronize();
idle();
stepper.synchronize();
}
no_reentry = false; no_reentry = false;
lcd_goto_screen(old_screen); lcd_goto_screen(old_screen);
} }
@ -879,7 +872,7 @@ void kill_screen(const char* lcd_msg) {
if (encoderPosition) { if (encoderPosition) {
const int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR); const int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
thermalManager.babystep_axis(axis, babystep_increment); thermalManager.babystep_axis(axis, babystep_increment);
babysteps_done += babystep_increment; babysteps_done += babystep_increment;
} }
@ -912,7 +905,7 @@ void kill_screen(const char* lcd_msg) {
zprobe_zoffset = new_zoffset; zprobe_zoffset = new_zoffset;
refresh_zprobe_zoffset(true); refresh_zprobe_zoffset(true);
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
} }
} }
if (lcdDrawUpdate) if (lcdDrawUpdate)
@ -943,7 +936,7 @@ void kill_screen(const char* lcd_msg) {
mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005 / 2.0; mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005 / 2.0;
mesh_edit_value = mesh_edit_accumulator; mesh_edit_value = mesh_edit_accumulator;
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
const int32_t rounded = (int32_t)(mesh_edit_value * 1000.0); const int32_t rounded = (int32_t)(mesh_edit_value * 1000.0);
mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0; mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
@ -1422,7 +1415,7 @@ void kill_screen(const char* lcd_msg) {
constexpr uint8_t total_probe_points = ( constexpr uint8_t total_probe_points = (
#if ENABLED(AUTO_BED_LEVELING_3POINT) #if ENABLED(AUTO_BED_LEVELING_3POINT)
3 3
#elif ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING) #elif ABL_GRID || ENABLED(MESH_BED_LEVELING)
GRID_MAX_POINTS GRID_MAX_POINTS
#endif #endif
); );
@ -1447,26 +1440,12 @@ void kill_screen(const char* lcd_msg) {
#endif // MESH_BED_LEVELING #endif // MESH_BED_LEVELING
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
void _lcd_level_goto_next_point();
#endif
void _lcd_level_bed_done() { void _lcd_level_bed_done() {
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE)); if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
} }
/** void _lcd_level_goto_next_point();
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
*/
void _lcd_level_bed_moving() {
if (lcdDrawUpdate) {
char msg[10];
sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points);
lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_NEXT_POINT), msg);
}
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
}
/** /**
* Step 7: Get the Z coordinate, click goes to the next point or exits * Step 7: Get the Z coordinate, click goes to the next point or exits
@ -1474,40 +1453,24 @@ void kill_screen(const char* lcd_msg) {
void _lcd_level_bed_get_z() { void _lcd_level_bed_get_z() {
ENCODER_DIRECTION_NORMAL(); ENCODER_DIRECTION_NORMAL();
// Encoder knob or keypad buttons adjust the Z position
if (encoderPosition) {
refresh_cmd_timeout();
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
NOLESS(current_position[Z_AXIS], -(LCD_PROBE_Z_RANGE) * 0.5);
NOMORE(current_position[Z_AXIS], (LCD_PROBE_Z_RANGE) * 0.5);
line_to_current(Z_AXIS);
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
encoderPosition = 0;
}
if (lcd_clicked) { if (lcd_clicked) {
// Use a hook to set the probe point z // Use a hook to set the probe point z
// (zigzag arranges in XY order) #if ENABLED(MESH_BED_LEVELING)
#if ENABLED(AUTO_BED_LEVELING_UBL)
// UBL set-z handling goes here // MBL records the position but doesn't move to the next one
mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
#elif ENABLED(PROBE_MANUALLY) #elif ENABLED(PROBE_MANUALLY)
// G29 helpfully records Z and goes to the next // The last G29 will record but not move
// point (or beeps if done) if (manual_probe_index == total_probe_points - 1)
enqueue_and_echo_commands_P(PSTR("G29")); enqueue_and_echo_commands_P("G29 V1");
manual_probe_index++;
#elif ENABLED(MESH_BED_LEVELING)
mbl.set_zigzag_z(manual_probe_index++, current_position[Z_AXIS]);
#endif #endif
// If done... // If done...
if (manual_probe_index == total_probe_points) { if (++manual_probe_index >= total_probe_points) {
// Say "Done!" // Say "Done!"
lcd_goto_screen(_lcd_level_bed_done); lcd_goto_screen(_lcd_level_bed_done);
@ -1526,10 +1489,6 @@ void kill_screen(const char* lcd_msg) {
mbl.set_has_mesh(true); mbl.set_has_mesh(true);
mesh_probing_done(); mesh_probing_done();
#elif ENABLED(AUTO_BED_LEVELING_UBL)
// UBL enable goes here
#elif ENABLED(PROBE_MANUALLY) #elif ENABLED(PROBE_MANUALLY)
// ABL will be enabled due to "G29". // ABL will be enabled due to "G29".
@ -1540,19 +1499,21 @@ void kill_screen(const char* lcd_msg) {
//LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE); //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
lcd_completion_feedback(); lcd_completion_feedback();
} }
else { else
_lcd_level_goto_next_point();
// Move to the next probe point, if needed
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
_lcd_level_goto_next_point();
#elif ENABLED(AUTO_BED_LEVELING_UBL)
// UBL goto-next-point goes here return;
}
#endif // Encoder knob or keypad buttons adjust the Z position
} if (encoderPosition) {
refresh_cmd_timeout();
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
NOLESS(current_position[Z_AXIS], -(LCD_PROBE_Z_RANGE) * 0.5);
NOMORE(current_position[Z_AXIS], (LCD_PROBE_Z_RANGE) * 0.5);
line_to_current(Z_AXIS);
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
encoderPosition = 0;
} }
// Update on first display, then only on updates to Z position // Update on first display, then only on updates to Z position
@ -1563,43 +1524,56 @@ void kill_screen(const char* lcd_msg) {
} }
} }
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) /**
* Step 6: Display "Next point: 1 / 9" while waiting for move to finish
/** */
* 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; #if ENABLED(PROBE_MANUALLY)
mbl.zigzag(manual_probe_index, px, py); bool lcd_wait_for_move;
#endif
// Controls the loop until the move is done void _lcd_level_bed_moving() {
_manual_probe_goto_xy( if (lcdDrawUpdate) {
LOGICAL_X_POSITION(mbl.index_to_xpos[px]), char msg[10];
LOGICAL_Y_POSITION(mbl.index_to_ypos[py]) sprintf_P(msg, PSTR("%i / %u"), (int)(manual_probe_index + 1), total_probe_points);
); 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
}
#elif ENABLED(AUTO_BED_LEVELING_UBL) /**
* Step 5: Initiate a move to the next point
*/
void _lcd_level_goto_next_point() {
// UBL may have its own methodology // Set the menu to display ahead of blocking call
lcd_goto_screen(_lcd_level_bed_moving);
#elif ENABLED(PROBE_MANUALLY) #if ENABLED(MESH_BED_LEVELING)
// Just wait for the G29 move to complete int8_t px, py;
lcd_synchronize(); mbl.zigzag(manual_probe_index, px, py);
#endif // Controls the loop until the move is done
_manual_probe_goto_xy(
LOGICAL_X_POSITION(mbl.index_to_xpos[px]),
LOGICAL_Y_POSITION(mbl.index_to_ypos[py])
);
// After the blocking function returns, change menus // After the blocking function returns, change menus
lcd_goto_screen(_lcd_level_bed_get_z); lcd_goto_screen(_lcd_level_bed_get_z);
}
#endif // MESH_BED_LEVELING #elif ENABLED(PROBE_MANUALLY)
// G29 will signal when it's done
lcd_wait_for_move = true;
enqueue_and_echo_commands_P(PSTR("G29 V1"));
#endif
}
/** /**
* Step 4: Display "Click to Begin", wait for click * Step 4: Display "Click to Begin", wait for click
@ -1609,14 +1583,7 @@ void kill_screen(const char* lcd_msg) {
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING)); if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
if (lcd_clicked) { if (lcd_clicked) {
manual_probe_index = 0; manual_probe_index = 0;
#if ENABLED(MESH_BED_LEVELING) _lcd_level_goto_next_point();
_lcd_level_goto_next_point();
#elif ENABLED(AUTO_BED_LEVELING_UBL)
// UBL click handling should go here
#elif ENABLED(PROBE_MANUALLY)
enqueue_and_echo_commands_P(PSTR("G29"));
_lcd_level_goto_next_point();
#endif
} }
} }
@ -1625,15 +1592,11 @@ void kill_screen(const char* lcd_msg) {
*/ */
void _lcd_level_bed_homing() { 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);
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
lcd_goto_screen(_lcd_level_bed_homing_done); lcd_goto_screen(_lcd_level_bed_homing_done);
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING;
} }
#endif // LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING) || HAS_ABL
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
extern bool g29_in_progress; extern bool g29_in_progress;
#endif #endif
@ -1642,15 +1605,10 @@ void kill_screen(const char* lcd_msg) {
* Step 2: Continue Bed Leveling... * Step 2: Continue Bed Leveling...
*/ */
void _lcd_level_bed_continue() { void _lcd_level_bed_continue() {
#if ENABLED(LCD_BED_LEVELING)
defer_return_to_status = true; defer_return_to_status = true;
axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false; axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
lcd_goto_screen(_lcd_level_bed_homing); lcd_goto_screen(_lcd_level_bed_homing);
enqueue_and_echo_commands_P(PSTR("G28")); enqueue_and_echo_commands_P(PSTR("G28"));
#else
lcd_return_to_status();
enqueue_and_echo_commands_P(axis_homed[X_AXIS] && axis_homed[Y_AXIS] ? PSTR("G29") : PSTR("G28\nG29"));
#endif
} }
/** /**
@ -1663,368 +1621,367 @@ void kill_screen(const char* lcd_msg) {
END_MENU(); END_MENU();
} }
#if ENABLED(AUTO_BED_LEVELING_UBL) #elif ENABLED(AUTO_BED_LEVELING_UBL)
void _lcd_ubl_level_bed(); void _lcd_ubl_level_bed();
static int ubl_storage_slot = 0, static int ubl_storage_slot = 0,
custom_bed_temp = 50, custom_bed_temp = 50,
custom_hotend_temp = 190, custom_hotend_temp = 190,
side_points = 3, side_points = 3,
ubl_fillin_amount = 5, ubl_fillin_amount = 5,
ubl_height_amount, ubl_height_amount,
map_type; map_type;
/** /**
* UBL Build Custom Mesh Command * UBL Build Custom Mesh Command
*/ */
void _lcd_ubl_build_custom_mesh() { void _lcd_ubl_build_custom_mesh() {
char UBL_LCD_GCODE[20]; char UBL_LCD_GCODE[20];
enqueue_and_echo_commands_P(PSTR("G28")); enqueue_and_echo_commands_P(PSTR("G28"));
#if WATCH_THE_BED #if WATCH_THE_BED
sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp); sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
enqueue_and_echo_command(UBL_LCD_GCODE);
#endif
sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
enqueue_and_echo_command(UBL_LCD_GCODE); enqueue_and_echo_command(UBL_LCD_GCODE);
enqueue_and_echo_commands_P(PSTR("G29 P1")); #endif
} sprintf_P(UBL_LCD_GCODE, PSTR("M109 S%i"), custom_hotend_temp);
enqueue_and_echo_command(UBL_LCD_GCODE);
/** enqueue_and_echo_commands_P(PSTR("G29 P1"));
* UBL Custom Mesh submenu }
*/
void _lcd_ubl_custom_mesh() {
START_MENU();
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
#if WATCH_THE_BED
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 5));
#endif
MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
END_MENU();
}
/** /**
* UBL Adjust Mesh Height Command * UBL Custom Mesh submenu
*/ */
void _lcd_ubl_adjust_height_cmd() { void _lcd_ubl_custom_mesh() {
char UBL_LCD_GCODE[16]; START_MENU();
const int ind = ubl_height_amount < 0 ? 6 : 7; MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6-")); MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount)); #if WATCH_THE_BED
enqueue_and_echo_command(UBL_LCD_GCODE); MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 5));
} #endif
MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
END_MENU();
}
/** /**
* UBL Adjust Mesh Height submenu * UBL Adjust Mesh Height Command
*/ */
void _lcd_ubl_height_adjust_menu() { void _lcd_ubl_adjust_height_cmd() {
START_MENU(); char UBL_LCD_GCODE[16];
MENU_BACK(MSG_UBL_EDIT_MESH_MENU); const int ind = ubl_height_amount < 0 ? 6 : 7;
MENU_ITEM_EDIT(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9); strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6-"));
MENU_ITEM(function, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_adjust_height_cmd); sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen); enqueue_and_echo_command(UBL_LCD_GCODE);
END_MENU(); }
}
/** /**
* UBL Edit Mesh submenu * UBL Adjust Mesh Height submenu
*/ */
void _lcd_ubl_edit_mesh() { void _lcd_ubl_height_adjust_menu() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_TOOLS); MENU_BACK(MSG_UBL_EDIT_MESH_MENU);
MENU_BACK(MSG_UBL_LEVEL_BED); MENU_ITEM_EDIT(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9);
MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R T")); MENU_ITEM(function, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_adjust_height_cmd);
MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29 P4 T")); MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
MENU_ITEM(submenu, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_height_adjust_menu); END_MENU();
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen); }
END_MENU();
}
/** /**
* UBL Validate Custom Mesh Command * UBL Edit Mesh submenu
*/ */
void _lcd_ubl_validate_custom_mesh() { void _lcd_ubl_edit_mesh() {
char UBL_LCD_GCODE[24]; START_MENU();
const int temp = MENU_BACK(MSG_UBL_TOOLS);
#if WATCH_THE_BED MENU_BACK(MSG_UBL_LEVEL_BED);
custom_bed_temp MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_ALL, PSTR("G29 P4 R T"));
#else MENU_ITEM(gcode, MSG_UBL_FINE_TUNE_CLOSEST, PSTR("G29 P4 T"));
0 MENU_ITEM(submenu, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_height_adjust_menu);
#endif MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
; END_MENU();
sprintf_P(UBL_LCD_GCODE, PSTR("G28\nG26 C B%i H%i P"), temp, custom_hotend_temp); }
enqueue_and_echo_command(UBL_LCD_GCODE);
}
/** /**
* UBL Validate Mesh submenu * UBL Validate Custom Mesh Command
*/ */
void _lcd_ubl_validate_mesh() { void _lcd_ubl_validate_custom_mesh() {
START_MENU(); char UBL_LCD_GCODE[24];
MENU_BACK(MSG_UBL_TOOLS); const int temp =
#if WATCH_THE_BED #if WATCH_THE_BED
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); custom_bed_temp
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#else #else
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); 0
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#endif #endif
MENU_ITEM(function, MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh); ;
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen); sprintf_P(UBL_LCD_GCODE, PSTR("G28\nG26 C B%i H%i P"), temp, custom_hotend_temp);
END_MENU(); enqueue_and_echo_command(UBL_LCD_GCODE);
} }
/** /**
* UBL Grid Leveling Command * UBL Validate Mesh submenu
*/ */
void _lcd_ubl_grid_level_cmd() { void _lcd_ubl_validate_mesh() {
char UBL_LCD_GCODE[10]; START_MENU();
sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points); MENU_BACK(MSG_UBL_TOOLS);
enqueue_and_echo_command(UBL_LCD_GCODE); #if WATCH_THE_BED
} MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#else
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B0 H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#endif
MENU_ITEM(function, MSG_UBL_VALIDATE_CUSTOM_MESH, _lcd_ubl_validate_custom_mesh);
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
END_MENU();
}
/** /**
* UBL Grid Leveling submenu * UBL Grid Leveling Command
*/ */
void _lcd_ubl_grid_level() { void _lcd_ubl_grid_level_cmd() {
START_MENU(); char UBL_LCD_GCODE[10];
MENU_BACK(MSG_UBL_TOOLS); sprintf_P(UBL_LCD_GCODE, PSTR("G29 J%i"), side_points);
MENU_ITEM_EDIT(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6); enqueue_and_echo_command(UBL_LCD_GCODE);
MENU_ITEM(function, MSG_UBL_MESH_LEVEL, _lcd_ubl_grid_level_cmd); }
END_MENU();
}
/** /**
* UBL Mesh Leveling submenu * UBL Grid Leveling submenu
*/ */
void _lcd_ubl_mesh_leveling() { void _lcd_ubl_grid_level() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_TOOLS); MENU_BACK(MSG_UBL_TOOLS);
MENU_ITEM(gcode, MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29 J0")); MENU_ITEM_EDIT(int3, MSG_UBL_SIDE_POINTS, &side_points, 2, 6);
MENU_ITEM(submenu, MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level); MENU_ITEM(function, MSG_UBL_MESH_LEVEL, _lcd_ubl_grid_level_cmd);
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen); END_MENU();
END_MENU(); }
}
/** /**
* UBL Fill-in Amount Mesh Command * UBL Mesh Leveling submenu
*/ */
void _lcd_ubl_fillin_amount_cmd() { void _lcd_ubl_mesh_leveling() {
char UBL_LCD_GCODE[16]; START_MENU();
sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount); MENU_BACK(MSG_UBL_TOOLS);
enqueue_and_echo_command(UBL_LCD_GCODE); MENU_ITEM(gcode, MSG_UBL_3POINT_MESH_LEVELING, PSTR("G29 J0"));
} MENU_ITEM(submenu, MSG_UBL_GRID_MESH_LEVELING, _lcd_ubl_grid_level);
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
END_MENU();
}
/** /**
* UBL Smart Fill-in Command * UBL Fill-in Amount Mesh Command
*/ */
void _lcd_ubl_smart_fillin_cmd() { void _lcd_ubl_fillin_amount_cmd() {
char UBL_LCD_GCODE[12]; char UBL_LCD_GCODE[16];
sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 T%i"), map_type); sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 R C.%i"), ubl_fillin_amount);
enqueue_and_echo_command(UBL_LCD_GCODE); enqueue_and_echo_command(UBL_LCD_GCODE);
} }
/** /**
* UBL Fill-in Mesh submenu * UBL Smart Fill-in Command
*/ */
void _lcd_ubl_fillin_menu() { void _lcd_ubl_smart_fillin_cmd() {
START_MENU(); char UBL_LCD_GCODE[12];
MENU_BACK(MSG_UBL_BUILD_MESH_MENU); sprintf_P(UBL_LCD_GCODE, PSTR("G29 P3 T%i"), map_type);
MENU_ITEM_EDIT(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9); enqueue_and_echo_command(UBL_LCD_GCODE);
MENU_ITEM(function, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_amount_cmd); }
MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
END_MENU();
}
void _lcd_ubl_invalidate() { /**
ubl.invalidate(); * UBL Fill-in Mesh submenu
SERIAL_PROTOCOLLNPGM("Mesh invalidated."); */
} void _lcd_ubl_fillin_menu() {
START_MENU();
MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
MENU_ITEM_EDIT(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9);
MENU_ITEM(function, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_amount_cmd);
MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
END_MENU();
}
/** void _lcd_ubl_invalidate() {
* UBL Build Mesh submenu ubl.invalidate();
*/ SERIAL_PROTOCOLLNPGM("Mesh invalidated.");
void _lcd_ubl_build_mesh() { }
START_MENU();
MENU_BACK(MSG_UBL_TOOLS);
#if WATCH_THE_BED
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n"
"M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
"M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0\n"
"M140 S0"
));
MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR(
"G28\n"
"M190 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\n"
"M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0\n"
"M140 S0"
));
#else
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n"
"M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0"
));
MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR(
"G28\n"
"M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0"
));
#endif
MENU_ITEM(submenu, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh);
MENU_ITEM(gcode, MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1"));
MENU_ITEM(submenu, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_menu);
MENU_ITEM(gcode, MSG_UBL_CONTINUE_MESH, PSTR("G29 P1 C"));
MENU_ITEM(function, MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate);
MENU_ITEM(gcode, MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29 I"));
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
END_MENU();
}
/** /**
* UBL Load Mesh Command * UBL Build Mesh submenu
*/ */
void _lcd_ubl_load_mesh_cmd() { void _lcd_ubl_build_mesh() {
char UBL_LCD_GCODE[8]; START_MENU();
sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot); MENU_BACK(MSG_UBL_TOOLS);
enqueue_and_echo_command(UBL_LCD_GCODE); #if WATCH_THE_BED
} MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n"
"M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
"M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0\n"
"M140 S0"
));
MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR(
"G28\n"
"M190 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\n"
"M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0\n"
"M140 S0"
));
#else
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n"
"M109 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0"
));
MENU_ITEM(gcode, MSG_UBL_BUILD_ABS_MESH, PSTR(
"G28\n"
"M109 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) "\n"
"G29 P1\n"
"M104 S0"
));
#endif
MENU_ITEM(submenu, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_custom_mesh);
MENU_ITEM(gcode, MSG_UBL_BUILD_COLD_MESH, PSTR("G28\nG29 P1"));
MENU_ITEM(submenu, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_menu);
MENU_ITEM(gcode, MSG_UBL_CONTINUE_MESH, PSTR("G29 P1 C"));
MENU_ITEM(function, MSG_UBL_INVALIDATE_ALL, _lcd_ubl_invalidate);
MENU_ITEM(gcode, MSG_UBL_INVALIDATE_CLOSEST, PSTR("G29 I"));
MENU_ITEM(submenu, MSG_WATCH, lcd_status_screen);
END_MENU();
}
/** /**
* UBL Save Mesh Command * UBL Load Mesh Command
*/ */
void _lcd_ubl_save_mesh_cmd() { void _lcd_ubl_load_mesh_cmd() {
char UBL_LCD_GCODE[8]; char UBL_LCD_GCODE[8];
sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot); sprintf_P(UBL_LCD_GCODE, PSTR("G29 L%i"), ubl_storage_slot);
enqueue_and_echo_command(UBL_LCD_GCODE); enqueue_and_echo_command(UBL_LCD_GCODE);
} }
/** /**
* UBL Mesh Storage submenu * UBL Save Mesh Command
*/ */
void _lcd_ubl_storage_mesh() { void _lcd_ubl_save_mesh_cmd() {
START_MENU(); char UBL_LCD_GCODE[8];
MENU_BACK(MSG_UBL_LEVEL_BED); sprintf_P(UBL_LCD_GCODE, PSTR("G29 S%i"), ubl_storage_slot);
MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, 9); enqueue_and_echo_command(UBL_LCD_GCODE);
MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd); }
MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
END_MENU();
}
/** /**
* UBL Output map Command * UBL Mesh Storage submenu
*/ */
void _lcd_ubl_output_map_cmd() { void _lcd_ubl_storage_mesh() {
char UBL_LCD_GCODE[10]; START_MENU();
sprintf_P(UBL_LCD_GCODE, PSTR("G29 T%i"), map_type); MENU_BACK(MSG_UBL_LEVEL_BED);
enqueue_and_echo_command(UBL_LCD_GCODE); MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, 9);
} MENU_ITEM(function, MSG_UBL_LOAD_MESH, _lcd_ubl_load_mesh_cmd);
MENU_ITEM(function, MSG_UBL_SAVE_MESH, _lcd_ubl_save_mesh_cmd);
END_MENU();
}
/** /**
* UBL Output map submenu * UBL Output map Command
*/ */
void _lcd_ubl_output_map() { void _lcd_ubl_output_map_cmd() {
START_MENU(); char UBL_LCD_GCODE[10];
MENU_BACK(MSG_UBL_LEVEL_BED); sprintf_P(UBL_LCD_GCODE, PSTR("G29 T%i"), map_type);
MENU_ITEM_EDIT(int3, MSG_UBL_MAP_TYPE, &map_type, 0, 1); enqueue_and_echo_command(UBL_LCD_GCODE);
if (map_type == 0) MENU_ITEM(function, MSG_UBL_OUTPUT_MAP_HOST, _lcd_ubl_output_map_cmd); }
if (map_type == 1) MENU_ITEM(function, MSG_UBL_OUTPUT_MAP_CSV, _lcd_ubl_output_map_cmd);
END_MENU();
}
/** /**
* UBL Tools submenu * UBL Output map submenu
*/ */
void _lcd_ubl_tools_menu() { void _lcd_ubl_output_map() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_LEVEL_BED); MENU_BACK(MSG_UBL_LEVEL_BED);
MENU_ITEM(submenu, MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh); MENU_ITEM_EDIT(int3, MSG_UBL_MAP_TYPE, &map_type, 0, 1);
MENU_ITEM(submenu, MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh); if (map_type == 0) MENU_ITEM(function, MSG_UBL_OUTPUT_MAP_HOST, _lcd_ubl_output_map_cmd);
MENU_ITEM(submenu, MSG_UBL_EDIT_MESH_MENU, _lcd_ubl_edit_mesh); if (map_type == 1) MENU_ITEM(function, MSG_UBL_OUTPUT_MAP_CSV, _lcd_ubl_output_map_cmd);
MENU_ITEM(submenu, MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling); END_MENU();
END_MENU(); }
}
/** /**
* UBL System submenu * UBL Tools submenu
* */
* Prepare void _lcd_ubl_tools_menu() {
* - Unified Bed Leveling START_MENU();
* - Activate UBL MENU_BACK(MSG_UBL_LEVEL_BED);
* - Deactivate UBL MENU_ITEM(submenu, MSG_UBL_BUILD_MESH_MENU, _lcd_ubl_build_mesh);
* - Mesh Storage MENU_ITEM(submenu, MSG_UBL_VALIDATE_MESH_MENU, _lcd_ubl_validate_mesh);
* Memory Slot: MENU_ITEM(submenu, MSG_UBL_EDIT_MESH_MENU, _lcd_ubl_edit_mesh);
* Load Bed Mesh MENU_ITEM(submenu, MSG_UBL_MESH_LEVELING, _lcd_ubl_mesh_leveling);
* Save Bed Mesh END_MENU();
* - Output Map }
* Map Type:
* Output Bed Mesh Host / Output Bed Mesh CSV
* - UBL Tools
* - Build Mesh
* Build PLA Mesh
* Build ABS Mesh
* - Build Custom Mesh
* Hotend Temp:
* Bed Temp:
* Build Custom Mesh
* Info Screen
* - Build Cold Mesh
* - Fill-in Mesh
* Fill-in Mesh
* Smart Fill-in
* Manual Fill-in
* Info Screen
* Continue Bed Mesh
* Invalidate All
* Invalidate Closest
* - Validate Mesh
* PLA Mesh Validation
* ABS Mesh Validation
* - Custom Mesh Validation
* Hotend Temp:
* Bed Temp:
* Validate Mesh
* Info Screen
* - Edit Mesh
* Fine Tune All
* Fine Tune Closest
* - Adjust Mesh Height
* Height Amount:
* Adjust Mesh Height
* Info Screen
* - Mesh Leveling
* 3-Point Mesh Leveling
* - Grid Mesh Leveling
* Side points:
* Level Mesh
* Info Screen
* - Output UBL Info
*/
void _lcd_ubl_level_bed() { /**
START_MENU(); * UBL System submenu
MENU_BACK(MSG_PREPARE); *
MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); * Prepare
MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); * - Unified Bed Leveling
MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); * - Activate UBL
MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map); * - Deactivate UBL
MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu); * - Mesh Storage
MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W")); * Memory Slot:
END_MENU(); * Load Bed Mesh
} * Save Bed Mesh
#endif * - Output Map
* Map Type:
* Output Bed Mesh Host / Output Bed Mesh CSV
* - UBL Tools
* - Build Mesh
* Build PLA Mesh
* Build ABS Mesh
* - Build Custom Mesh
* Hotend Temp:
* Bed Temp:
* Build Custom Mesh
* Info Screen
* - Build Cold Mesh
* - Fill-in Mesh
* Fill-in Mesh
* Smart Fill-in
* Manual Fill-in
* Info Screen
* Continue Bed Mesh
* Invalidate All
* Invalidate Closest
* - Validate Mesh
* PLA Mesh Validation
* ABS Mesh Validation
* - Custom Mesh Validation
* Hotend Temp:
* Bed Temp:
* Validate Mesh
* Info Screen
* - Edit Mesh
* Fine Tune All
* Fine Tune Closest
* - Adjust Mesh Height
* Height Amount:
* Adjust Mesh Height
* Info Screen
* - Mesh Leveling
* 3-Point Mesh Leveling
* - Grid Mesh Leveling
* Side points:
* Level Mesh
* Info Screen
* - Output UBL Info
*/
void _lcd_ubl_level_bed() {
START_MENU();
MENU_BACK(MSG_PREPARE);
MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A"));
MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D"));
MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh);
MENU_ITEM(submenu, MSG_UBL_OUTPUT_MAP, _lcd_ubl_output_map);
MENU_ITEM(submenu, MSG_UBL_TOOLS, _lcd_ubl_tools_menu);
MENU_ITEM(gcode, MSG_UBL_INFO_UBL, PSTR("G29 W"));
END_MENU();
}
#endif // LCD_BED_LEVELING || HAS_ABL #endif // AUTO_BED_LEVELING_UBL
/** /**
* *
@ -2061,18 +2018,14 @@ void kill_screen(const char* lcd_msg) {
// //
// Level Bed // Level Bed
// //
#if ENABLED(LCD_BED_LEVELING) || HAS_ABL #if ENABLED(AUTO_BED_LEVELING_UBL)
MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed);
#elif ENABLED(LCD_BED_LEVELING)
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
if (!g29_in_progress) if (!g29_in_progress)
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_UBL) MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
MENU_ITEM(submenu, MSG_UBL_LEVEL_BED, _lcd_ubl_level_bed); #endif
#else
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
#endif
#endif // LCD_BED_LEVELING || HAS_ABL
#if HAS_M206_COMMAND #if HAS_M206_COMMAND
// //
@ -2158,7 +2111,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_calibrate_homing() { void _lcd_calibrate_homing() {
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING)); if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING));
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
lcd_goto_previous_menu(); lcd_goto_previous_menu();
} }
@ -2292,7 +2245,7 @@ void kill_screen(const char* lcd_msg) {
manual_move_to_current(axis); manual_move_to_current(axis);
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis])); if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
} }
@ -2314,7 +2267,7 @@ void kill_screen(const char* lcd_msg) {
, eindex , eindex
#endif #endif
); );
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
PGM_P pos_label; PGM_P pos_label;
@ -3243,7 +3196,7 @@ void kill_screen(const char* lcd_msg) {
encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \ encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
++encoderLine; \ ++encoderLine; \
} \ } \
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; \ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
} \ } \
++_thisItemNr; \ ++_thisItemNr; \
} while(0) } while(0)
@ -3775,9 +3728,9 @@ bool lcd_blink() {
* - if (lcdDrawUpdate) { redraw } * - if (lcdDrawUpdate) { redraw }
* - Before exiting the handler set lcdDrawUpdate to: * - Before exiting the handler set lcdDrawUpdate to:
* - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT. * - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT.
* - LCDVIEW_REDRAW_NOW or LCDVIEW_NONE to keep drawing, but only in this loop. * - LCDVIEW_REDRAW_NOW to draw now (including remaining stripes).
* - LCDVIEW_CALL_REDRAW_NEXT to keep drawing and draw on the next loop also. * - LCDVIEW_CALL_REDRAW_NEXT to draw now and get LCDVIEW_REDRAW_NOW on the next loop.
* - LCDVIEW_CALL_NO_REDRAW to keep drawing (or start drawing) with no redraw on the next loop. * - LCDVIEW_CALL_NO_REDRAW to draw now and get LCDVIEW_NONE on the next loop.
* - NOTE: For graphical displays menu handlers may be called 2 or more times per loop, * - NOTE: For graphical displays menu handlers may be called 2 or more times per loop,
* so don't change lcdDrawUpdate without considering this. * so don't change lcdDrawUpdate without considering this.
* *
@ -3897,7 +3850,7 @@ void lcd_update() {
encoderDiff = 0; encoderDiff = 0;
} }
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
lcdDrawUpdate = LCDVIEW_KEEP_REDRAWING; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
#endif // ULTIPANEL #endif // ULTIPANEL

Loading…
Cancel
Save