24
24
25
25
#if HAS_RESUME_CONTINUE
26
26
27
+ #include " ../../inc/MarlinConfig.h"
28
+
27
29
#include " ../gcode.h"
28
- #include " ../../module/planner.h"
29
30
30
- #include " ../../inc/MarlinConfig.h"
31
+ #include " ../../module/planner.h" // for synchronize()
32
+ #include " ../../MarlinCore.h" // for wait_for_user_response()
31
33
32
34
#if HAS_LCD_MENU
33
35
#include " ../../lcd/ultralcd.h"
34
- #endif
35
-
36
- #if ENABLED(EXTENSIBLE_UI)
36
+ #elif ENABLED(EXTENSIBLE_UI)
37
37
#include " ../../lcd/extui/ui_api.h"
38
38
#endif
39
39
40
- #if HAS_LEDS_OFF_FLAG
41
- #include " ../../feature/leds/printer_event_leds.h"
42
- #endif
43
-
44
40
#if ENABLED(HOST_PROMPT_SUPPORT)
45
41
#include " ../../feature/host_actions.h"
46
42
#endif
@@ -56,31 +52,22 @@ void GcodeSuite::M0_M1() {
56
52
57
53
planner.synchronize ();
58
54
59
- #if HAS_LEDS_OFF_FLAG
60
- const bool seenQ = parser.seen (' Q' );
61
- if (seenQ) printerEventLEDs.onPrintCompleted (); // Change LED color for Print Completed
62
- #else
63
- constexpr bool seenQ = false ;
64
- #endif
65
-
66
55
#if HAS_LCD_MENU
67
56
68
57
if (parser.string_arg )
69
58
ui.set_status (parser.string_arg , true );
70
- else if (!seenQ) {
59
+ else {
71
60
LCD_MESSAGEPGM (MSG_USERWAIT);
72
61
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
73
62
ui.reset_progress_bar_timeout ();
74
63
#endif
75
64
}
76
65
77
66
#elif ENABLED(EXTENSIBLE_UI)
78
- if (!seenQ) {
79
- if (parser.string_arg )
80
- ExtUI::onUserConfirmRequired (parser.string_arg ); // Can this take an SRAM string??
81
- else
82
- ExtUI::onUserConfirmRequired_P (GET_TEXT (MSG_USERWAIT));
83
- }
67
+ if (parser.string_arg )
68
+ ExtUI::onUserConfirmRequired (parser.string_arg ); // Can this take an SRAM string??
69
+ else
70
+ ExtUI::onUserConfirmRequired_P (GET_TEXT (MSG_USERWAIT));
84
71
#else
85
72
86
73
if (parser.string_arg ) {
@@ -90,25 +77,15 @@ void GcodeSuite::M0_M1() {
90
77
91
78
#endif
92
79
93
- KEEPALIVE_STATE (PAUSED_FOR_USER);
94
- wait_for_user = true ;
95
-
96
80
#if ENABLED(HOST_PROMPT_SUPPORT)
97
- if (!seenQ) host_prompt_do (PROMPT_USER_CONTINUE, parser.codenum ? PSTR (" M1 Stop" ) : PSTR (" M0 Stop" ), CONTINUE_STR);
81
+ host_prompt_do (PROMPT_USER_CONTINUE, parser.codenum ? PSTR (" M1 Stop" ) : PSTR (" M0 Stop" ), CONTINUE_STR);
98
82
#endif
99
83
100
- if (ms > 0 ) ms += millis (); // wait until this time for a click
101
- while (wait_for_user && (ms == 0 || PENDING (millis (), ms))) idle ();
102
-
103
- #if HAS_LEDS_OFF_FLAG
104
- printerEventLEDs.onResumeAfterWait ();
105
- #endif
84
+ wait_for_user_response (ms);
106
85
107
86
#if HAS_LCD_MENU
108
- if (!seenQ) ui.reset_status ();
87
+ ui.reset_status ();
109
88
#endif
110
-
111
- wait_for_user = false ;
112
89
}
113
90
114
91
#endif // HAS_RESUME_CONTINUE
0 commit comments