Send notifications to ExtUI for M0/M1 (#13344)

- Send notifications to ExtUI for M0/M1

- wait_for_user can be non-volatile (not changed by interrupt)
  C / C++ compilers don't optimize away reads of non-volatile variables when a function call is used between accesses, because *any* variable could be changed by the function call. Since `wait_for_user` can't be changed without a function call, it should be non-volatile so the compiler can optimize away cases where it is read more than once without an intervening function call.
This commit is contained in:
Tobias Frost
2019-03-09 21:13:50 +01:00
committed by Scott Lahteine
parent 00fc43144a
commit 60e82e3929
6 changed files with 25 additions and 4 deletions

View File

@ -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