mmu: Add CheckErrorScreenUserInput

Due to differences in 8-bit FW I had to implement two new get functions

* GetCommandInProgress
* GetLastErrorCode
This commit is contained in:
Guðni Már Gilbert 2023-10-18 22:54:51 +00:00
parent 7bc7e7a7e8
commit 12a3051c50
4 changed files with 18 additions and 6 deletions

View File

@ -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() {

View File

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

View File

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

View File

@ -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();