diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index d6b6b534d7..7a3e815068 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -183,7 +183,7 @@ volatile bool wait_for_heatup = true; // For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop #if HAS_RESUME_CONTINUE - volatile bool wait_for_user; // = false; + bool wait_for_user; // = false; #endif #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE) diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h index bea5c358c9..cfb5f9b317 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -333,7 +333,7 @@ inline bool IsStopped() { return !Running; } extern volatile bool wait_for_heatup; #if HAS_RESUME_CONTINUE - extern volatile bool wait_for_user; + extern bool wait_for_user; #endif #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE) diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index df20c62658..9b8b859e24 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -31,6 +31,10 @@ #include "../../lcd/ultralcd.h" #endif +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + #include "../../sd/cardreader.h" #if HAS_LEDS_OFF_FLAG @@ -74,6 +78,10 @@ void GcodeSuite::M0_M1() { #endif } + #elif ENABLED(EXTENSIBLE_UI) + + ExtUI::onUserConfirmRequired(has_message ? args : MSG_USERWAIT); // SRAM string + #else if (has_message) { @@ -97,6 +105,10 @@ void GcodeSuite::M0_M1() { else while (wait_for_user) idle(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onUserConfirmRequired(nullptr); + #endif + #if HAS_LEDS_OFF_FLAG printerEventLEDs.onResumeAfterWait(); #endif diff --git a/Marlin/src/lcd/extensible_ui/lib/example.cpp b/Marlin/src/lcd/extensible_ui/lib/example.cpp index 51040cde04..2a11d5c3c4 100644 --- a/Marlin/src/lcd/extensible_ui/lib/example.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/example.cpp @@ -46,7 +46,7 @@ namespace ExtUI { */ } void onIdle() {} - void onPrinterKilled(const char* msg) {} + void onPrinterKilled(PGM_P const msg) {} void onMediaInserted() {}; void onMediaError() {}; void onMediaRemoved() {}; @@ -55,6 +55,7 @@ namespace ExtUI { void onPrintTimerPaused() {} void onPrintTimerStopped() {} void onFilamentRunout() {} + void onUserConfirmRequired(const char * const msg) {} void onStatusChanged(const char * const msg) {} void onFactoryReset() {} void onLoadSettings() {} diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 929351201b..ae58b51eb8 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -630,6 +630,12 @@ namespace ExtUI { feedrate_percentage = clamp(value, 10, 500); } + void setUserConfirmed(void) { + #if HAS_RESUME_CONTINUE + wait_for_user = false; + #endif + } + void printFile(const char *filename) { IFSD(card.openAndPrintFile(filename), NOOP); } diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index 0a7ffbea63..2bd87c9e91 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -117,6 +117,7 @@ namespace ExtUI { void setRetractAcceleration_mm_s2(const float); void setTravelAcceleration_mm_s2(const float); void setFeedrate_percent(const float); + void setUserConfirmed(void); #if ENABLED(LIN_ADVANCE) float getLinearAdvance_mm_mm_s(const extruder_t); @@ -239,11 +240,12 @@ namespace ExtUI { void onMediaError(); void onMediaRemoved(); void onPlayTone(const uint16_t frequency, const uint16_t duration); - void onPrinterKilled(const char* msg); + void onPrinterKilled(PGM_P const msg); void onPrintTimerStarted(); void onPrintTimerPaused(); void onPrintTimerStopped(); void onFilamentRunout(const extruder_t extruder); + void onUserConfirmRequired(const char * const msg); void onStatusChanged(const char * const msg); void onFactoryReset(); void onStoreSettings();