diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 31e825ba4..0985073a9 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -91,6 +91,7 @@ MMU2::MMU2() , mmu_print_saved(false) , loadFilamentStarted(false) , loadingToNozzle(false) + , is_mmu_error_monitor_active(false) { } @@ -166,7 +167,14 @@ void MMU2::mmu_loop() { avoidRecursion = true; logicStepLastStatus = LogicStep(); // it looks like the mmu_loop doesn't need to be a blocking call - + + if (is_mmu_error_monitor_active) + { + // Call this every iteration to keep the knob rotation responsive + // This includes when mmu_loop is called within manage_response + ReportErrorHook((uint16_t)lastErrorCode); + } + avoidRecursion = false; } @@ -607,7 +615,7 @@ void MMU2::ReportError(ErrorCode ec) { // - report only changes of states (we can miss an error message) // - may be some combination of MMUAvailable + UseMMU flags and decide based on their state // Right now the filtering of MMU_NOT_RESPONDING is done in ReportErrorHook() as it is not a problem if mmu2.cpp - ReportErrorHook((CommandInProgress)logic.CommandInProgress(), (uint16_t)ec); + ReportErrorHook((uint16_t)ec); if( ec != lastErrorCode ){ // deduplicate: only report changes in error codes into the log lastErrorCode = ec; diff --git a/Firmware/mmu2.h b/Firmware/mmu2.h index d08e8624a..f4fa41772 100644 --- a/Firmware/mmu2.h +++ b/Firmware/mmu2.h @@ -130,6 +130,9 @@ public: } } + // Helper variable to monitor knob in MMU error screen in blocking functions e.g. manage_response + bool is_mmu_error_monitor_active; + /// Method to read-only mmu_print_saved bool MMU_PRINT_SAVED() const { return mmu_print_saved; } diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index 0285b1827..69bcc9b66 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -199,11 +199,9 @@ enum ReportErrorHookStates ReportErrorHookState; /** * @brief Render MMU error screen on the LCD. This must be non-blocking * and allow the MMU and printer to communicate with each other. - * @param[in] cip Command in progress * @param[in] ec Error code */ -void ReportErrorHook(CommandInProgress cip, uint16_t ec) { - +void ReportErrorHook(uint16_t ec) { switch ((uint8_t)ReportErrorHookState) { case (uint8_t)ReportErrorHookStates::RENDER_ERROR_SCREEN: @@ -211,6 +209,7 @@ void ReportErrorHook(CommandInProgress cip, uint16_t ec) { ReportErrorHookState = ReportErrorHookStates::MONITOR_SELECTION; // Fall through case (uint8_t)ReportErrorHookStates::MONITOR_SELECTION: + mmu2.is_mmu_error_monitor_active = true; ReportErrorHookDynamicRender(); // Render dynamic characters switch (ReportErrorHookMonitor(ec)) { @@ -227,6 +226,7 @@ void ReportErrorHook(CommandInProgress cip, uint16_t ec) { lcd_update_enable(true); lcd_return_to_status(); // Reset the state in case a new error is reported + mmu2.is_mmu_error_monitor_active = false; ReportErrorHookState = ReportErrorHookStates::RENDER_ERROR_SCREEN; break; default: diff --git a/Firmware/mmu2_reporting.h b/Firmware/mmu2_reporting.h index 5317153ba..fedc6c1d7 100644 --- a/Firmware/mmu2_reporting.h +++ b/Firmware/mmu2_reporting.h @@ -23,7 +23,7 @@ void BeginReport(CommandInProgress cip, uint16_t ec); void EndReport(CommandInProgress cip, uint16_t ec); /// Called when the MMU sends operation error (even repeatedly) -void ReportErrorHook(CommandInProgress cip, uint16_t ec); +void ReportErrorHook(uint16_t ec); /// Called when the MMU sends operation progress update void ReportProgressHook(CommandInProgress cip, uint16_t ec);