diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 8d1354e6ec..31ae41892c 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -56,9 +56,11 @@ void GcodeSuite::M0_M1() { hasS = ms > 0; } + const bool has_message = !hasP && !hasS && args && *args; + #if ENABLED(ULTIPANEL) - if (!hasP && !hasS && args && *args) + if (has_message) lcd_setstatus(args, true); else { LCD_MESSAGEPGM(MSG_USERWAIT); @@ -69,7 +71,7 @@ void GcodeSuite::M0_M1() { #else - if (!hasP && !hasS && args && *args) { + if (has_message) { SERIAL_ECHO_START(); SERIAL_ECHOLN(args); } @@ -82,18 +84,14 @@ void GcodeSuite::M0_M1() { stepper.synchronize(); if (ms > 0) { - ms += previous_move_ms; // wait until this time for a click + ms += millis(); // wait until this time for a click while (PENDING(millis(), ms) && wait_for_user) idle(); } else { #if ENABLED(ULTIPANEL) - if (lcd_detected()) { - while (wait_for_user) idle(); - IS_SD_PRINTING ? LCD_MESSAGEPGM(MSG_RESUMING) : LCD_MESSAGEPGM(WELCOME_MSG); - } - #else - while (wait_for_user) idle(); + if (lcd_detected()) #endif + while (wait_for_user) idle(); } #if ENABLED(PRINTER_EVENT_LEDS) && ENABLED(SDSUPPORT) @@ -103,6 +101,12 @@ void GcodeSuite::M0_M1() { } #endif + #if ENABLED(ULTIPANEL) + if (lcd_detected()) { + IS_SD_PRINTING ? LCD_MESSAGEPGM(MSG_RESUMING) : LCD_MESSAGEPGM(WELCOME_MSG); + } + #endif + wait_for_user = false; KEEPALIVE_STATE(IN_HANDLER); }