mmu: move RetryIfPossible outside the error screen

This fixes issue where 'retryAttempts=3' may be spammed in the logs

Change in memory:
Flash: 0 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2022-10-29 13:17:45 +00:00 committed by DRracer
parent 1a35bf506a
commit 7bc7f21fa5
3 changed files with 8 additions and 8 deletions

View File

@ -839,7 +839,12 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
LogErrorEvent_P( _O(PrusaErrorTitle(PrusaErrorCodeIndex((uint16_t)ec))) );
}
ReportErrorHook((uint16_t)ec);
if( !mmu2.RetryIfPossible((uint16_t)ec) ) {
// If retry attempts are all used up
// or if 'Retry' operation is not available
// raise the MMU error sceen and wait for user input
ReportErrorHook((uint16_t)ec);
}
static_assert(mmu2Magic[0] == 'M'
&& mmu2Magic[1] == 'M'

View File

@ -185,6 +185,8 @@ public:
bool MMU_PRINT_SAVED() const { return mmu_print_saved != SavedState::None; }
/// Automagically "press" a Retry button if we have any retry attempts left
/// @param ec ErrorCode enum value
/// @returns true if auto-retry is ongoing, false when retry is unavailable or retry attempts are all used up
bool RetryIfPossible(uint16_t ec);
/// Decrement the retry attempts, if in a retry.

View File

@ -224,13 +224,6 @@ void ReportErrorHook(uint16_t ec) {
// a button was pushed on the MMU and the LCD should
// dismiss the error screen until MMU raises a new error
ReportErrorHookState = ReportErrorHookStates::DISMISS_ERROR_SCREEN;
} else {
// attempt an automatic Retry button
if( ReportErrorHookState == ReportErrorHookStates::MONITOR_SELECTION ){
if( mmu2.RetryIfPossible(ec) ){
ReportErrorHookState = ReportErrorHookStates::DISMISS_ERROR_SCREEN;
}
}
}
const uint8_t ei = PrusaErrorCodeIndex(ec);