Increment errors in ReportError

This commit is contained in:
D.R.racer 2022-11-19 15:34:16 +01:00 committed by DRracer
parent 4eaabbf092
commit adb24cd410
2 changed files with 10 additions and 8 deletions

View File

@ -880,6 +880,16 @@ void MMU2::ReportError(ErrorCode ec, ErrorSource res) {
lastErrorCode = ec;
lastErrorSource = res;
LogErrorEvent_P( _O(PrusaErrorTitle(PrusaErrorCodeIndex((uint16_t)ec))) );
if( ec != ErrorCode::OK ){
IncrementMMUFails();
// check if it is a "power" failure - we consider TMC-related errors as power failures
if( (uint16_t)ec & 0x7e00 ){ // @@TODO can be optimized to uint8_t operation
// TMC-related errors are from 0x8200 higher
IncrementTMCFailures();
}
}
}
if( !mmu2.RetryIfPossible((uint16_t)ec) ) {

View File

@ -233,14 +233,6 @@ void ReportErrorHook(uint16_t ec) {
case (uint8_t)ReportErrorHookStates::RENDER_ERROR_SCREEN:
ReportErrorHookStaticRender(ei);
ReportErrorHookState = ReportErrorHookStates::MONITOR_SELECTION;
IncrementMMUFails();
// check if it is a "power" failure - we consider TMC-related errors as power failures
if( (uint16_t)ec & 0x7e00 ){ // @@TODO can be optimized to uint8_t operation
// TMC-related errors are from 0x8200 higher
// we can increment a power error at this spot
mmu2.IncrementTMCFailures();
}
[[fallthrough]];
case (uint8_t)ReportErrorHookStates::MONITOR_SELECTION:
mmu2.is_mmu_error_monitor_active = true;