Compare commits

...

3 Commits

Author SHA1 Message Date
Guðni Már Gilbert 738dc511ee Don't raise MMU error screen until retry is done
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2022-11-12 16:45:39 +00:00
VintagePC 853c2ad6e9 Fix excessive flash usage. 2022-11-12 07:49:36 -05:00
VintagePC 68ef03f46a Fix PFW-1364 & possible comms timeout during reheat 2022-11-11 12:59:21 -05:00
2 changed files with 44 additions and 26 deletions

View File

@ -221,15 +221,20 @@ void MMU2::mmu_loop() {
return;
avoidRecursion = true;
logicStepLastStatus = LogicStep(); // it looks like the mmu_loop doesn't need to be a blocking call
mmu_loop_inner(true);
avoidRecursion = false;
}
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 (is_mmu_error_monitor_active){
// Call this every iteration to keep the knob rotation responsive
// This includes when mmu_loop is called within manage_response
ReportErrorHook((uint16_t)lastErrorCode);
}
avoidRecursion = false;
}
void MMU2::CheckFINDARunout()
@ -630,9 +635,10 @@ void MMU2::ResumeHotendTemp() {
lcd_display_message_fullscreen_P(_i("MMU Retry: Restoring temperature...")); ////MSG_MMU_RESTORE_TEMP c=20 r=4
//@todo better report the event and let the GUI do its work somewhere else
ReportErrorHookSensorLineRender();
waitForHotendTargetTemp(1000, []{
ReportErrorHookDynamicRender();
waitForHotendTargetTemp(100, []{
manage_inactivity(true);
mmu2.mmu_loop_inner(false);
ReportErrorHookDynamicRender();
});
lcd_update_enable(true); // temporary hack to stop this locking the printer...
LogEchoEvent_P(PSTR("Hotend temperature reached"));
@ -762,7 +768,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
}
}
StepStatus MMU2::LogicStep() {
StepStatus MMU2::LogicStep(bool reportErrors) {
CheckUserInput(); // Process any buttons before proceeding with another MMU Query
StepStatus ss = logic.Step();
switch (ss) {
@ -773,30 +779,36 @@ StepStatus MMU2::LogicStep() {
case Processing:
OnMMUProgressMsg(logic.Progress());
break;
case CommandError:
ReportError(logic.Error(), ErrorSourceMMU);
break;
case CommunicationTimeout:
state = xState::Connecting;
ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
break;
case ProtocolError:
state = xState::Connecting;
ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
break;
case VersionMismatch:
StopKeepPowered();
ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
break;
case ButtonPushed:
lastButton = logic.Button();
LogEchoEvent_P(PSTR("MMU Button pushed"));
CheckUserInput(); // Process the button immediately
break;
default:
break;
if(reportErrors) {
switch (ss)
{
case CommandError:
ReportError(logic.Error(), ErrorSourceMMU);
break;
case CommunicationTimeout:
state = xState::Connecting;
ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
break;
case ProtocolError:
state = xState::Connecting;
ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
break;
case VersionMismatch:
StopKeepPowered();
ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
break;
default:
break;
}
}
}
if( logic.Running() ){
state = xState::Active;
}

View File

@ -226,11 +226,17 @@ private:
/// Along with the mmu_loop method, this loops until a response from the MMU is received and acts upon.
/// In case of an error, it parks the print head and turns off nozzle heating
void manage_response(const bool move_axes, const bool turn_off_nozzle);
/// Performs one step of the protocol logic state machine
/// The inner private implementation of mmu_loop()
/// which is NOT (!!!) recursion-guarded. Use caution - but we do need it during waiting for hotend resume to keep comms alive!
/// @param reportErrors true if Errors should raise MMU Error screen, false otherwise
void mmu_loop_inner(bool reportErrors);
/// Performs one step of the protocol logic state machine
/// and reports progress and errors if needed to attached ExtUIs.
/// Updates the global state of MMU (Active/Connecting/Stopped) at runtime, see @ref State
StepStatus LogicStep();
/// @param reportErrors true if Errors should raise MMU Error screen, false otherwise
StepStatus LogicStep(bool reportErrors);
void filament_ramming();
void execute_extruder_sequence(const E_Step *sequence, uint8_t steps);