diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index a17adda10..56f2059bb 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -131,7 +131,7 @@ void set_destination_to_current(); void set_current_to_destination(); void prepare_move_to_destination(); - void lcd_setstatuspgm(const char* const message, const uint8_t level); + void lcd_setstatusPGM(const char* const message, const int8_t level); void sync_plan_position_e(); void chirp_at_user(); @@ -181,18 +181,17 @@ safe_delay(10); // Wait for click to settle #if ENABLED(ULTRA_LCD) - lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99); + lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99); lcd_quick_feedback(); #endif - lcd_reset_alert_level(); while (!ubl_lcd_clicked()) idle(); // Wait for button release // If the button is suddenly pressed again, // ask the user to resolve the issue - lcd_setstatuspgm(PSTR("Release button"), 99); // will never appear... + lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear... while (ubl_lcd_clicked()) idle(); // unless this loop happens - lcd_setstatuspgm(PSTR("")); + lcd_setstatusPGM(PSTR(""), -1); return true; } @@ -351,8 +350,7 @@ } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0); LEAVE: - lcd_reset_alert_level(); - lcd_setstatuspgm(PSTR("Leaving G26")); + lcd_setstatusPGM(PSTR("Leaving G26"), -1); retract_filament(destination); destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; @@ -726,8 +724,7 @@ } bool unified_bed_leveling::exit_from_g26() { - lcd_reset_alert_level(); - lcd_setstatuspgm(PSTR("Leaving G26")); + lcd_setstatusPGM(PSTR("Leaving G26"), -1); while (ubl_lcd_clicked()) idle(); return UBL_ERR; } @@ -741,7 +738,7 @@ #if HAS_TEMP_BED #if ENABLED(ULTRA_LCD) if (g26_bed_temp > 25) { - lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99); + lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); lcd_quick_feedback(); #endif has_control_of_lcd_panel = true; @@ -757,7 +754,7 @@ } #if ENABLED(ULTRA_LCD) } - lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), 99); + lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99); lcd_quick_feedback(); #endif #endif @@ -774,8 +771,7 @@ } #if ENABLED(ULTRA_LCD) - lcd_reset_alert_level(); - lcd_setstatuspgm(PSTR("")); + lcd_setstatusPGM(PSTR(""), -1); lcd_quick_feedback(); #endif @@ -792,7 +788,7 @@ has_control_of_lcd_panel = true; - lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99); + lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99); chirp_at_user(); set_destination_to_current(); @@ -819,9 +815,9 @@ while (ubl_lcd_clicked()) idle(); // Debounce Encoder Wheel #if ENABLED(ULTRA_LCD) - strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatuspgm() without having it continue; + strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue; // So... We cheat to get a message up. - lcd_setstatuspgm(PSTR("Done Priming"), 99); + lcd_setstatusPGM(PSTR("Done Priming"), 99); lcd_quick_feedback(); #endif @@ -830,7 +826,7 @@ } else { #if ENABLED(ULTRA_LCD) - lcd_setstatuspgm(PSTR("Fixed Length Prime."), 99); + lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99); lcd_quick_feedback(); #endif set_destination_to_current(); diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index c18f5db53..c2e84e628 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -217,8 +217,8 @@ extern bool volumetric_enabled; extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner -extern bool axis_known_position[XYZ]; // axis[n].is_known -extern bool axis_homed[XYZ]; // axis[n].is_homed +extern bool axis_known_position[XYZ]; +extern bool axis_homed[XYZ]; extern volatile bool wait_for_heatup; #if HAS_RESUME_CONTINUE diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1d3c282ff..c62fd7db7 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1743,15 +1743,15 @@ static void clean_up_after_endstop_or_probe_move() { #if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION) bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) { -#if ENABLED(HOME_AFTER_DEACTIVATE) - const bool xx = x && !axis_known_position[X_AXIS], - yy = y && !axis_known_position[Y_AXIS], - zz = z && !axis_known_position[Z_AXIS]; -#else - const bool xx = x && !axis_homed[X_AXIS], - yy = y && !axis_homed[Y_AXIS], - zz = z && !axis_homed[Z_AXIS]; -#endif + #if ENABLED(HOME_AFTER_DEACTIVATE) + const bool xx = x && !axis_known_position[X_AXIS], + yy = y && !axis_known_position[Y_AXIS], + zz = z && !axis_known_position[Z_AXIS]; + #else + const bool xx = x && !axis_homed[X_AXIS], + yy = y && !axis_homed[Y_AXIS], + zz = z && !axis_homed[Z_AXIS]; + #endif if (xx || yy || zz) { SERIAL_ECHO_START; SERIAL_ECHOPGM(MSG_HOME " "); @@ -2467,7 +2467,7 @@ static void clean_up_after_endstop_or_probe_move() { #endif for (uint8_t y = 0; y < sy; y++) { #ifdef SCAD_MESH_OUTPUT - SERIAL_PROTOCOLLNPGM(" ["); // open sub-array + SERIAL_PROTOCOLPGM(" ["); // open sub-array #else if (y < 10) SERIAL_PROTOCOLCHAR(' '); SERIAL_PROTOCOL((int)y); @@ -2501,7 +2501,7 @@ static void clean_up_after_endstop_or_probe_move() { SERIAL_EOL; } #ifdef SCAD_MESH_OUTPUT - SERIAL_PROTOCOLPGM("\n];"); // close 2D array + SERIAL_PROTOCOLPGM("];"); // close 2D array #endif SERIAL_EOL; } @@ -3798,6 +3798,8 @@ inline void gcode_G28(const bool always_home_all) { tool_change(old_tool_index, 0, true); #endif + lcd_refresh(); + report_current_position(); #if ENABLED(DEBUG_LEVELING_FEATURE) @@ -3839,7 +3841,7 @@ void home_all_axes() { gcode_G28(true); } #if MANUAL_PROBE_HEIGHT > 0 feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS]; - current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; // just slightly over the bed + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); // just slightly over the bed line_to_current_position(); #endif @@ -4132,8 +4134,14 @@ void home_all_axes() { gcode_G28(true); } #endif #endif + #if ENABLED(PROBE_MANUALLY) + const bool seenA = parser.seen('A'), seenQ = parser.seen('Q'), no_action = seenA || seenQ; + #endif + #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) const bool faux = parser.seen('C') && parser.value_bool(); + #elif ENABLED(PROBE_MANUALLY) + const bool faux = no_action; #else bool constexpr faux = false; #endif @@ -4231,19 +4239,19 @@ void home_all_axes() { gcode_G28(true); } return; } - const float z = parser.seen('Z') && parser.has_value() ? parser.value_float() : 99999; - if (!WITHIN(z, -10, 10)) { + const float z = parser.seen('Z') && parser.has_value() ? parser.value_float() : NAN; + if (!isnan(z) || !WITHIN(z, -10, 10)) { SERIAL_ERROR_START; SERIAL_ERRORLNPGM("Bad Z value"); return; } - const float x = parser.seen('X') && parser.has_value() ? parser.value_float() : 99999, - y = parser.seen('Y') && parser.has_value() ? parser.value_float() : 99999; + const float x = parser.seen('X') && parser.has_value() ? parser.value_float() : NAN, + y = parser.seen('Y') && parser.has_value() ? parser.value_float() : NAN; int8_t i = parser.seen('I') && parser.has_value() ? parser.value_byte() : -1, j = parser.seen('J') && parser.has_value() ? parser.value_byte() : -1; - if (x < 99998 && y < 99998) { + if (!isnan(x) && !isnan(y)) { // Get nearest i / j from x / y i = (x - LOGICAL_X_POSITION(bilinear_start[X_AXIS]) + 0.5 * xGridSpacing) / xGridSpacing; j = (y - LOGICAL_Y_POSITION(bilinear_start[Y_AXIS]) + 0.5 * yGridSpacing) / yGridSpacing; @@ -4279,7 +4287,11 @@ void home_all_axes() { gcode_G28(true); } return; } - dryrun = parser.seen('D') && parser.value_bool(); + dryrun = (parser.seen('D') && parser.value_bool()) + #if ENABLED(PROBE_MANUALLY) + || no_action + #endif + ; #if ENABLED(AUTO_BED_LEVELING_LINEAR) @@ -4424,16 +4436,14 @@ void home_all_axes() { gcode_G28(true); } #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) { + if (!no_action) { ++abl_probe_index; g29_in_progress = true; } - // Abort current G29 procedure, go back to ABLStart + // Abort current G29 procedure, go back to idle state if (seenA && g29_in_progress) { SERIAL_PROTOCOLLNPGM("Manual G29 aborted"); #if HAS_SOFTWARE_ENDSTOPS @@ -4450,14 +4460,14 @@ void home_all_axes() { gcode_G28(true); } if (verbose_level || seenQ) { SERIAL_PROTOCOLPGM("Manual G29 "); if (g29_in_progress) { - SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1); + SERIAL_PROTOCOLPAIR("point ", min(abl_probe_index + 1, abl2)); SERIAL_PROTOCOLLNPAIR(" of ", abl2); } else SERIAL_PROTOCOLLNPGM("idle"); } - if (seenA || seenQ) return; + if (no_action) return; if (abl_probe_index == 0) { // For the initial G29 save software endstop state @@ -4482,6 +4492,14 @@ void home_all_axes() { gcode_G28(true); } z_values[xCount][yCount] = measured_z + zoffset; + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) { + SERIAL_PROTOCOLPAIR("Save X", xCount); + SERIAL_PROTOCOLPAIR(" Y", yCount); + SERIAL_PROTOCOLLNPAIR(" Z", measured_z + zoffset); + } + #endif + #elif ENABLED(AUTO_BED_LEVELING_3POINT) points[i].z = measured_z; diff --git a/Marlin/language_en.h b/Marlin/language_en.h index 32690ebde..8de63f436 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -394,8 +394,8 @@ #ifndef MSG_VE_JERK #define MSG_VE_JERK _UxGT("Ve-jerk") #endif -#ifndef MSG_FEEDRATE - #define MSG_FEEDRATE _UxGT("Feedrate") +#ifndef MSG_VELOCITY + #define MSG_VELOCITY _UxGT("Velocity") #endif #ifndef MSG_VMAX #define MSG_VMAX _UxGT("Vmax ") diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index c9abfbd5c..c4f77dceb 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -58,7 +58,7 @@ typedef void (*screenFunc_t)(); extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0); extern void lcd_setstatus(const char* message, const bool persist); - extern void lcd_setstatuspgm(const char* message, const uint8_t level); + extern void lcd_setstatusPGM(const char* message, const int8_t level); int unified_bed_leveling::g29_verbose_level, unified_bed_leveling::g29_phase_value, diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 4e21ba079..67dc2c6af 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -481,21 +481,35 @@ uint16_t max_display_update_time = 0; /** * Show "Moving..." till moves are done, then revert to previous display. */ - inline void lcd_synchronize(const char * const msg=NULL) { + static const char moving[] PROGMEM = MSG_MOVING; + static const char *sync_message = moving; + + // + // Display the synchronize screen until moves are + // finished, and don't return to the caller until + // done. ** This blocks the command queue! ** + // + void _lcd_synchronize() { static bool no_reentry = false; - const static char moving[] PROGMEM = MSG_MOVING; - lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, msg ? msg : moving); + 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; - lcd_goto_screen(lcd_synchronize); + lcd_goto_screen(_lcd_synchronize); stepper.synchronize(); no_reentry = false; lcd_goto_screen(old_screen); } + // Display the synchronize screen with a custom message + // ** This blocks the command queue! ** + void lcd_synchronize(const char * const msg=NULL) { + sync_message = msg ? msg : moving; + _lcd_synchronize(); + } + void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); } void lcd_save_previous_screen() { @@ -680,7 +694,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(PARK_HEAD_ON_PAUSE) enqueue_and_echo_commands_P(PSTR("M125")); #endif - lcd_setstatuspgm(PSTR(MSG_PRINT_PAUSED), true); + lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1); } void lcd_sdcard_resume() { @@ -690,7 +704,7 @@ void kill_screen(const char* lcd_msg) { card.startFileprint(); print_job_timer.start(); #endif - lcd_setstatuspgm(PSTR(""), true); + lcd_setstatusPGM(PSTR(""), -1); } void lcd_sdcard_stop() { @@ -703,7 +717,7 @@ void kill_screen(const char* lcd_msg) { for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; #endif wait_for_heatup = false; - LCD_MESSAGEPGM(MSG_PRINT_ABORTED); + lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1); } #endif // SDSUPPORT @@ -1420,6 +1434,26 @@ void kill_screen(const char* lcd_msg) { #endif ); + // + // 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 + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; + line_to_current(Z_AXIS); + #endif + // Display "Done" screen and wait for moves to complete + #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING) + 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 @@ -1432,18 +1466,28 @@ void kill_screen(const char* lcd_msg) { current_position[Y_AXIS] = LOGICAL_Y_POSITION(y); planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder); #if MANUAL_PROBE_HEIGHT > 0 - current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; + current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); line_to_current(Z_AXIS); #endif lcd_synchronize(); } - #endif // MESH_BED_LEVELING + #elif ENABLED(PROBE_MANUALLY) - void _lcd_level_bed_done() { - if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE)); - lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; - } + 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)); + lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; + } + + #endif void _lcd_level_goto_next_point(); @@ -1455,59 +1499,55 @@ void kill_screen(const char* lcd_msg) { if (lcd_clicked) { - // Use a hook to set the probe point z + // + // Save the current Z position + // + #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]); + // - #elif ENABLED(PROBE_MANUALLY) - - // The last G29 will record but not move - if (manual_probe_index == total_probe_points - 1) - enqueue_and_echo_commands_P(PSTR("G29 V1")); + mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]); #endif // If done... if (++manual_probe_index >= total_probe_points) { - // Say "Done!" - lcd_goto_screen(_lcd_level_bed_done); + #if ENABLED(PROBE_MANUALLY) - // Raise Z to the "manual probe height" - #if MANUAL_PROBE_HEIGHT > 0 - current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; - line_to_current(Z_AXIS); - #endif + // + // The last G29 will record and enable but not move. + // Since G29 is deferred, + // + lcd_wait_for_move = true; + enqueue_and_echo_commands_P(PSTR("G29 V1")); + lcd_goto_screen(_lcd_level_bed_done); - #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING) - lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE)); - #endif + #elif ENABLED(MESH_BED_LEVELING) - // Enable leveling, if needed - #if ENABLED(MESH_BED_LEVELING) + _lcd_after_probing(); mbl.set_has_mesh(true); mesh_probing_done(); - #elif ENABLED(PROBE_MANUALLY) - - // ABL will be enabled due to "G29". - #endif - lcd_return_to_status(); - //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE); - lcd_completion_feedback(); } - else + else { + // MESH_BED_LEVELING: Z already stored, just move + // PROBE_MANUALLY: Send G29 to record Z, then move _lcd_level_goto_next_point(); + } return; } + // // 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); @@ -1518,8 +1558,9 @@ void kill_screen(const char* lcd_msg) { encoderPosition = 0; } - // Update on first display, then only on updates to Z position - // Show message above on clicks instead + // + // Draw on first display, then only on Z change + // if (lcdDrawUpdate) { const float v = current_position[Z_AXIS]; lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001 : 0.0001), '+')); @@ -1530,10 +1571,6 @@ void kill_screen(const char* lcd_msg) { * Step 6: Display "Next point: 1 / 9" while waiting for move to finish */ - #if ENABLED(PROBE_MANUALLY) - bool lcd_wait_for_move; - #endif - void _lcd_level_bed_moving() { if (lcdDrawUpdate) { char msg[10]; @@ -1570,7 +1607,7 @@ void kill_screen(const char* lcd_msg) { #elif ENABLED(PROBE_MANUALLY) - // G29 will signal when it's done + // G29 Records Z, moves, and signals when it pauses lcd_wait_for_move = true; enqueue_and_echo_commands_P(PSTR("G29 V1")); @@ -1620,19 +1657,22 @@ void kill_screen(const char* lcd_msg) { /** * Step 1: Bed Level entry-point * - Cancel + * - Auto Home (if homing needed) + * - Leveling On/Off (if data exists, and homed) * - Level Bed > - * - Leveling On/Off (if there is leveling data) - * - Fade Height (Req: ENABLE_LEVELING_FADE_HEIGHT) - * - Mesh Z Offset (Req: MESH_BED_LEVELING) - * - Z Probe Offset (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) - * - Load Settings (Req: EEPROM_SETTINGS) - * - Save Settings (Req: EEPROM_SETTINGS) + * - Fade Height (Req: ENABLE_LEVELING_FADE_HEIGHT) + * - Mesh Z Offset (Req: MESH_BED_LEVELING) + * - Z Probe Offset (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET) + * - Load Settings (Req: EEPROM_SETTINGS) + * - Save Settings (Req: EEPROM_SETTINGS) */ - void lcd_level_bed() { + void lcd_bed_leveling() { START_MENU(); MENU_BACK(MSG_PREPARE); - MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue); - if (leveling_is_valid()) { // Leveling data exists? Show more options. + + 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()) { _level_state = leveling_is_active(); MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &_level_state, _lcd_toggle_bed_leveling); } @@ -1642,7 +1682,9 @@ void kill_screen(const char* lcd_msg) { MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &planner.z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height); #endif - // Manual bed leveling, Bed Z: + // + // MBL Z Offset + // #if ENABLED(MESH_BED_LEVELING) MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); #endif @@ -1653,6 +1695,8 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset); #endif + MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue); + #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); @@ -2063,7 +2107,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(PROBE_MANUALLY) if (!g29_in_progress) #endif - MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_level_bed); + MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling); #endif #if HAS_M206_COMMAND @@ -2826,8 +2870,8 @@ void kill_screen(const char* lcd_msg) { static void lcd_refresh_zprobe_zoffset() { refresh_zprobe_zoffset(); } #endif - // M203 / M205 Feedrates - void lcd_control_motion_feedrate_menu() { + // M203 / M205 Velocity options + void lcd_control_motion_velocity_menu() { START_MENU(); MENU_BACK(MSG_MOTION); @@ -2957,18 +3001,19 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset); #endif - // M203 / M205 Feedrate items - MENU_ITEM(submenu, MSG_FEEDRATE, lcd_control_motion_feedrate_menu); + // M203 / M205 - Feedrate items + MENU_ITEM(submenu, MSG_VELOCITY, lcd_control_motion_velocity_menu); - // M201 Acceleration items + // M201 - Acceleration items MENU_ITEM(submenu, MSG_ACCELERATION, lcd_control_motion_acceleration_menu); - // M205 Max Jerk + // M205 - Max Jerk MENU_ITEM(submenu, MSG_JERK, lcd_control_motion_jerk_menu); - // M92 Steps Per mm + // M92 - Steps Per mm MENU_ITEM(submenu, MSG_STEPS_PER_MM, lcd_control_motion_steps_per_mm_menu); + // M540 S - Abort on endstop hit when SD printing #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit); #endif @@ -4095,7 +4140,8 @@ void lcd_setstatus(const char * const message, const bool persist) { lcd_finishstatus(persist); } -void lcd_setstatuspgm(const char * const message, const uint8_t level) { +void lcd_setstatusPGM(const char * const message, int8_t level) { + if (level < 0) level = lcd_status_message_level = 0; if (level < lcd_status_message_level) return; lcd_status_message_level = level; strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); @@ -4113,7 +4159,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { } void lcd_setalertstatuspgm(const char * const message) { - lcd_setstatuspgm(message, 1); + lcd_setstatusPGM(message, 1); #if ENABLED(ULTIPANEL) lcd_return_to_status(); #endif diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index c6a11ee0b..13da79e8a 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -38,7 +38,7 @@ void lcd_init(); bool lcd_hasstatus(); void lcd_setstatus(const char* message, const bool persist=false); - void lcd_setstatuspgm(const char* message, const uint8_t level=0); + void lcd_setstatusPGM(const char* message, const int8_t level=0); void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...); void lcd_setalertstatuspgm(const char* message); void lcd_reset_alert_level(); @@ -46,6 +46,9 @@ void kill_screen(const char* lcd_msg); bool lcd_detected(void); + extern uint8_t lcdDrawUpdate; + inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; } + #if HAS_BUZZER void lcd_buzz(long duration, uint16_t freq); #endif @@ -61,7 +64,7 @@ void bootscreen(); #endif - #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) + #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_UPDATE_INTERVAL 100 @@ -153,11 +156,12 @@ inline void lcd_init() {} inline bool lcd_hasstatus() { return false; } inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } - inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); } + inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); } inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); } inline void lcd_buttons_update() {} inline void lcd_reset_alert_level() {} inline bool lcd_detected() { return true; } + inline void lcd_refresh() {} #define LCD_MESSAGEPGM(x) NOOP #define LCD_ALERTMESSAGEPGM(x) NOOP diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index b735baa8f..d650890d5 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -806,8 +806,10 @@ static void lcd_implementation_status_screen() { // Draw the progress bar if the message has shown long enough // or if there is no message set. - if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) - return lcd_draw_progress_bar(card.percentDone()); + if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) { + const uint8_t percent = card.percentDone(); + if (percent) return lcd_draw_progress_bar(percent); + } #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)