Restart USB timer during long moves

When long moves are planned and executed the USB timer can expire.

In PrusaSlicer 2.7.1 the Toolchange command (T0, T1, etc.) is sent while the USB timer is expired. This will trigger
a manual MMU unload in the firmware. Not only does this trigger a loud beep from the buzzer, but this will also significantly increase print time.

The issue only affects host prints. SD card printing does not have this issue.

Fixes #4551

The fix in this commit is the following:
If there are blocks queued while printing via host AND the USB timer is halfway expired WHILE executing a move. Then simply restart the timer to keep it alive.

Change in memory:
Flash: +62 bytes
SRAM: 0 bytes
This commit is contained in:
gudnimg 2024-01-02 17:25:38 +00:00 committed by Guðni Már Gilbert
parent ba027dd41e
commit 09952db139
2 changed files with 11 additions and 1 deletions

View File

@ -69,6 +69,9 @@
// Keepalive period which is restarted with M79
#define M79_TIMEOUT 30 * 1000 // ms
// A timer which is restarted everytime a G-command is added to the command queue.
#define USB_TIMER_TIMEOUT 10 * 1000 // ms
//===========================================================================
//=============================Mechanical Settings===========================
//===========================================================================

View File

@ -1728,7 +1728,7 @@ void loop()
if (print_job_timer.isPaused() && saved_printing_type == PowerPanic::PRINT_TYPE_USB) { //keep believing that usb is being printed. Prevents accessing dangerous menus while pausing.
usb_timer.start();
}
else if (usb_timer.expired(10000)) { //just need to check if it expired. Nothing else is needed to be done.
else if (usb_timer.expired(USB_TIMER_TIMEOUT)) { //just need to check if it expired. Nothing else is needed to be done.
SetPrinterState(PrinterState::HostPrintingFinished); //set printer state to show LCD menu after finished SD print
}
@ -9600,6 +9600,13 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
get_command();
}
if (blocks_queued() && GetPrinterState() == PrinterState::IsHostPrinting && usb_timer.elapsed() > ((USB_TIMER_TIMEOUT) / 2))
{
// Handle the case where planned moves may take a longer time to execute than the USB timer period.
// An example is the toolchange unload sequence generated by PrusaSlicer with default settings.
usb_timer.start();
}
if(max_inactive_time && previous_millis_cmd.expired(max_inactive_time))
kill(PSTR("Inactivity Shutdown"));
if(stepper_inactive_time && previous_millis_cmd.expired(stepper_inactive_time)) {