|
@@ -177,7 +177,7 @@ void MMU2::mmu_loop() {
|
|
if (is_mmu_error_monitor_active){
|
|
if (is_mmu_error_monitor_active){
|
|
// Call this every iteration to keep the knob rotation responsive
|
|
// Call this every iteration to keep the knob rotation responsive
|
|
// This includes when mmu_loop is called within manage_response
|
|
// This includes when mmu_loop is called within manage_response
|
|
- ReportErrorHook((uint16_t)lastErrorCode);
|
|
|
|
|
|
+ ReportErrorHook((uint16_t)lastErrorCode, mmu2.MMUCurrentErrorCode() == ErrorCode::OK ? ErrorSourcePrinter : ErrorSourceMMU);
|
|
}
|
|
}
|
|
|
|
|
|
avoidRecursion = false;
|
|
avoidRecursion = false;
|
|
@@ -667,22 +667,22 @@ StepStatus MMU2::LogicStep() {
|
|
OnMMUProgressMsg(logic.Progress());
|
|
OnMMUProgressMsg(logic.Progress());
|
|
break;
|
|
break;
|
|
case CommandError:
|
|
case CommandError:
|
|
- ReportError(logic.Error());
|
|
|
|
|
|
+ ReportError(logic.Error(), ErrorSourceMMU);
|
|
CheckUserInput();
|
|
CheckUserInput();
|
|
break;
|
|
break;
|
|
case CommunicationTimeout:
|
|
case CommunicationTimeout:
|
|
state = xState::Connecting;
|
|
state = xState::Connecting;
|
|
- ReportError(ErrorCode::MMU_NOT_RESPONDING);
|
|
|
|
|
|
+ ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
|
|
CheckUserInput();
|
|
CheckUserInput();
|
|
break;
|
|
break;
|
|
case ProtocolError:
|
|
case ProtocolError:
|
|
state = xState::Connecting;
|
|
state = xState::Connecting;
|
|
- ReportError(ErrorCode::PROTOCOL_ERROR);
|
|
|
|
|
|
+ ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
|
|
CheckUserInput();
|
|
CheckUserInput();
|
|
break;
|
|
break;
|
|
case VersionMismatch:
|
|
case VersionMismatch:
|
|
StopKeepPowered();
|
|
StopKeepPowered();
|
|
- ReportError(ErrorCode::VERSION_MISMATCH);
|
|
|
|
|
|
+ ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
|
|
CheckUserInput();
|
|
CheckUserInput();
|
|
break;
|
|
break;
|
|
case ButtonPushed:
|
|
case ButtonPushed:
|
|
@@ -721,7 +721,7 @@ void MMU2::SetActiveExtruder(uint8_t ex){
|
|
active_extruder = ex;
|
|
active_extruder = ex;
|
|
}
|
|
}
|
|
|
|
|
|
-void MMU2::ReportError(ErrorCode ec) {
|
|
|
|
|
|
+void MMU2::ReportError(ErrorCode ec, uint8_t res) {
|
|
// Due to a potential lossy error reporting layers linked to this hook
|
|
// Due to a potential lossy error reporting layers linked to this hook
|
|
// we'd better report everything to make sure especially the error states
|
|
// we'd better report everything to make sure especially the error states
|
|
// do not get lost.
|
|
// do not get lost.
|
|
@@ -733,7 +733,7 @@ void MMU2::ReportError(ErrorCode ec) {
|
|
// - report only changes of states (we can miss an error message)
|
|
// - 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
|
|
// - 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
|
|
// Right now the filtering of MMU_NOT_RESPONDING is done in ReportErrorHook() as it is not a problem if mmu2.cpp
|
|
- ReportErrorHook((uint16_t)ec);
|
|
|
|
|
|
+ ReportErrorHook((uint16_t)ec, res);
|
|
|
|
|
|
if( ec != lastErrorCode ){ // deduplicate: only report changes in error codes into the log
|
|
if( ec != lastErrorCode ){ // deduplicate: only report changes in error codes into the log
|
|
lastErrorCode = ec;
|
|
lastErrorCode = ec;
|