Fix PFW-1364 & possible comms timeout during reheat

This commit is contained in:
VintagePC 2022-11-11 12:59:21 -05:00 committed by DRracer
parent fd832f9ccf
commit ecef69012a
2 changed files with 16 additions and 6 deletions

View File

@ -221,6 +221,13 @@ void MMU2::mmu_loop() {
return; return;
avoidRecursion = true; avoidRecursion = true;
mmu_loop_inner();
avoidRecursion = false;
}
void MMU2::mmu_loop_inner()
{
logicStepLastStatus = LogicStep(); // it looks like the mmu_loop doesn't need to be a blocking call logicStepLastStatus = LogicStep(); // it looks like the mmu_loop doesn't need to be a blocking call
if (is_mmu_error_monitor_active){ if (is_mmu_error_monitor_active){
@ -228,8 +235,6 @@ void MMU2::mmu_loop() {
// 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);
} }
avoidRecursion = false;
} }
void MMU2::CheckFINDARunout() 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 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 //@todo better report the event and let the GUI do its work somewhere else
ReportErrorHookSensorLineRender(); ReportErrorHookSensorLineRender();
waitForHotendTargetTemp(1000, []{ waitForHotendTargetTemp(100, [this]{
ReportErrorHookDynamicRender();
manage_inactivity(true); manage_inactivity(true);
this->mmu_loop_inner(); // This keeps the comms alive, the call in manage_inactivity is blocked by recursion guard.
ReportErrorHookDynamicRender();
}); });
lcd_update_enable(true); // temporary hack to stop this locking the printer... lcd_update_enable(true); // temporary hack to stop this locking the printer...
LogEchoEvent_P(PSTR("Hotend temperature reached")); LogEchoEvent_P(PSTR("Hotend temperature reached"));

View File

@ -227,6 +227,10 @@ private:
/// In case of an error, it parks the print head and turns off nozzle heating /// 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); void manage_response(const bool move_axes, const bool turn_off_nozzle);
/// 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!
void mmu_loop_inner();
/// Performs one step of the protocol logic state machine /// Performs one step of the protocol logic state machine
/// and reports progress and errors if needed to attached ExtUIs. /// and reports progress and errors if needed to attached ExtUIs.
/// Updates the global state of MMU (Active/Connecting/Stopped) at runtime, see @ref State /// Updates the global state of MMU (Active/Connecting/Stopped) at runtime, see @ref State