diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index 47e29d16e..6d80c982c 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -191,12 +191,7 @@ void MMU2::mmu_loop() { void __attribute__((noinline)) MMU2::mmu_loop_inner(bool reportErrors) { logicStepLastStatus = LogicStep(reportErrors); // it looks like the mmu_loop doesn't need to be a blocking call - - if (isErrorScreenRunning()) { - // Call this every iteration to keep the knob rotation responsive - // This includes when mmu_loop is called within manage_response - ReportErrorHook((CommandInProgress)logic.CommandInProgress(), lastErrorCode, uint8_t(lastErrorSource)); - } + CheckErrorScreenUserInput(); } void MMU2::CheckFINDARunout() { diff --git a/Firmware/mmu2.h b/Firmware/mmu2.h index 750154ce0..f5eea95b9 100644 --- a/Firmware/mmu2.h +++ b/Firmware/mmu2.h @@ -160,9 +160,15 @@ public: /// @returns Current error code inline ErrorCode MMUCurrentErrorCode() const { return logic.Error(); } + /// @returns Command in progress + inline uint8_t GetCommandInProgress() const { return logic.CommandInProgress(); } + /// @returns Last error source inline ErrorSource MMULastErrorSource() const { return lastErrorSource; } + /// @returns Last error code + inline ErrorCode GetLastErrorCode() const { return lastErrorCode; } + /// @returns the version of the connected MMU FW. /// In the future we'll return the trully detected FW version Version GetMMUFWVersion() const { diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index e2ced92f1..5bbf4e60a 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -221,6 +221,14 @@ static bool is_mmu_error_monitor_active; // Set to false to allow the error screen to render again. static bool putErrorScreenToSleep; +void CheckErrorScreenUserInput() { + if (isErrorScreenRunning()) { + // Call this every iteration to keep the knob rotation responsive + // This includes when mmu_loop is called within manage_response + ReportErrorHook((CommandInProgress)mmu2.GetCommandInProgress(), mmu2.GetLastErrorCode(), mmu2.MMULastErrorSource()); + } +} + bool isErrorScreenRunning() { return is_mmu_error_monitor_active; } diff --git a/Firmware/mmu2_reporting.h b/Firmware/mmu2_reporting.h index 2a01afa0c..9429ecbac 100644 --- a/Firmware/mmu2_reporting.h +++ b/Firmware/mmu2_reporting.h @@ -29,6 +29,9 @@ void BeginReport(CommandInProgress cip, ProgressCode ec); /// Called at the end of every MMU operation void EndReport(CommandInProgress cip, ProgressCode ec); +/// Checks for error screen user input, if the error screen is open +void CheckErrorScreenUserInput(); + /// Return true if the printer's LCD is drawing the error screen bool isErrorScreenRunning();