Fixup: restoring temp. while Load2ExtrFailed

This commit is contained in:
D.R.racer 2022-12-27 15:21:29 +01:00 committed by DRracer
parent d4f0f363cd
commit 5e103cc24e
1 changed files with 15 additions and 9 deletions

View File

@ -311,9 +311,8 @@ bool MMU2::ToolChangeCommonOnce(uint8_t slot){
void MMU2::ToolChangeCommon(uint8_t slot){ void MMU2::ToolChangeCommon(uint8_t slot){
while( ! ToolChangeCommonOnce(slot) ){ // while not successfully fed into extruder's PTFE tube while( ! ToolChangeCommonOnce(slot) ){ // while not successfully fed into extruder's PTFE tube
// failed autoretry, report an error by forcing a "printer" error into the MMU infrastructure - it is a hack to leverage existing code // failed autoretry, report an error by forcing a "printer" error into the MMU infrastructure - it is a hack to leverage existing code
// @@TODO theoretically logic layer may not need to be spoiled with the printer error - may be just the manage_response needs it...
logic.SetPrinterError(ErrorCode::LOAD_TO_EXTRUDER_FAILED); logic.SetPrinterError(ErrorCode::LOAD_TO_EXTRUDER_FAILED);
SaveAndPark(true);
SaveHotendTemp(true);
// We only have to wait for the user to fix the issue and press "Retry". // We only have to wait for the user to fix the issue and press "Retry".
// Please see CheckUserInput() for details how we "leave" manage_response. // Please see CheckUserInput() for details how we "leave" manage_response.
// If manage_response returns false at this spot (MMU operation interrupted aka MMU reset) // If manage_response returns false at this spot (MMU operation interrupted aka MMU reset)
@ -685,12 +684,24 @@ void MMU2::CheckUserInput(){
case Right: case Right:
SERIAL_ECHOPGM("CheckUserInput-btnLMR "); SERIAL_ECHOPGM("CheckUserInput-btnLMR ");
SERIAL_ECHOLN(btn); SERIAL_ECHOLN(btn);
// clear the explicit printer error as soon as possible so that the MMU error screens + reporting doesn't get too confused
if( lastErrorCode == ErrorCode::LOAD_TO_EXTRUDER_FAILED ){
// A horrible hack - clear the explicit printer error allowing manage_response to recover on MMU's Finished state
// Moreover - if the MMU is currently doing something (like the LoadFilament - see comment above)
// we'll actually wait for it automagically in manage_response and after it finishes correctly,
// we'll issue another command (like toolchange)
logic.ClearPrinterError();
lastErrorSource = ErrorSourceMMU; // this seems to help clearing the error screen
}
ResumeHotendTemp(); // Recover the hotend temp before we attempt to do anything else... ResumeHotendTemp(); // Recover the hotend temp before we attempt to do anything else...
// In case of LOAD_TO_EXTRUDER_FAILED sending a button into the MMU has an interesting side effect // In case of LOAD_TO_EXTRUDER_FAILED sending a button into the MMU has an interesting side effect
// - it triggers the standalone LoadFilament function on the current active slot. // - it triggers the standalone LoadFilament function on the current active slot.
// Considering the fact, that we are recovering from a failed load to extruder, this side effect is actually quite beneficial // Considering the fact, that we are recovering from a failed load to extruder, this side effect is actually quite beneficial
// - it checks if the filament is correctly loaded in the MMU (we assume the user was playing with the filament to recover from the failed load) // - it checks if the filament is correctly loaded in the MMU (we assume the user was playing with the filament to recover from the failed load)
// Moreover, the "button" makes all the nice things like temp recovery
Button(btn); Button(btn);
// A quick hack: for specific error codes move the E-motor every time. // A quick hack: for specific error codes move the E-motor every time.
@ -701,13 +712,6 @@ void MMU2::CheckUserInput(){
case ErrorCode::FSENSOR_TOO_EARLY: case ErrorCode::FSENSOR_TOO_EARLY:
HelpUnloadToFinda(); HelpUnloadToFinda();
break; break;
case ErrorCode::LOAD_TO_EXTRUDER_FAILED:
// A horrible hack - clear the explicit printer error allowing manage_response to recover on MMU's Finished state
// Moreover - if the MMU is currently doing something (like the LoadFilament - see comment above)
// we'll actually wait for it automagically in manage_response and after it finishes correctly,
// we'll issue another command (like toolchange)
logic.ClearPrinterError();
break;
default: default:
break; break;
} }
@ -782,6 +786,8 @@ bool MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
CheckUserInput(); CheckUserInput();
return true; return true;
case PrinterError: case PrinterError:
SaveAndPark(move_axes);
SaveHotendTemp(turn_off_nozzle);
CheckUserInput(); CheckUserInput();
// if button pressed "Done", return true, otherwise stay within manage_response // if button pressed "Done", return true, otherwise stay within manage_response
// Please see CheckUserInput() for details how we "leave" manage_response // Please see CheckUserInput() for details how we "leave" manage_response