Skip to content

Commit

Permalink
Clear the "Wait for user" message set by M0/M1
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 29, 2018
1 parent b6a55f0 commit 55e9b85
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Marlin/src/gcode/lcd/M0_M1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -69,7 +71,7 @@ void GcodeSuite::M0_M1() {

#else

if (!hasP && !hasS && args && *args) {
if (has_message) {
SERIAL_ECHO_START();
SERIAL_ECHOLN(args);
}
Expand All @@ -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)
Expand All @@ -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);
}
Expand Down

0 comments on commit 55e9b85

Please sign in to comment.