|
|
@ -218,13 +218,8 @@ bool wait_for_heatup = true;
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
wait_for_user = true;
|
|
|
|
wait_for_user = true;
|
|
|
|
if (ms) ms += millis(); // expire time
|
|
|
|
if (ms) ms += millis(); // expire time
|
|
|
|
while (wait_for_user && !(ms && ELAPSED(millis(), ms))) {
|
|
|
|
while (wait_for_user && !(ms && ELAPSED(millis(), ms)))
|
|
|
|
idle(
|
|
|
|
idle(TERN_(ADVANCED_PAUSE_FEATURE, no_sleep));
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
|
|
|
|
no_sleep
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_for_user = false;
|
|
|
|
wait_for_user = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -647,52 +642,54 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Standard idle routine keeps the machine alive
|
|
|
|
* Standard idle routine keeps the machine alive
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void idle(
|
|
|
|
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
// Handle Power-Loss Recovery
|
|
|
|
bool no_stepper_sleep/*=false*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS)
|
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS)
|
|
|
|
recovery.outage();
|
|
|
|
recovery.outage();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Run StallGuard endstop checks
|
|
|
|
#if ENABLED(SPI_ENDSTOPS)
|
|
|
|
#if ENABLED(SPI_ENDSTOPS)
|
|
|
|
if (endstops.tmc_spi_homing.any
|
|
|
|
if (endstops.tmc_spi_homing.any
|
|
|
|
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
|
|
|
&& TERN1(IMPROVE_HOMING_RELIABILITY, ELAPSED(millis(), sg_guard_period))
|
|
|
|
&& ELAPSED(millis(), sg_guard_period)
|
|
|
|
) LOOP_L_N(i, 4) // Read SGT 4 times per idle loop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
for (uint8_t i = 4; i--;) // Read SGT 4 times per idle loop
|
|
|
|
|
|
|
|
if (endstops.tmc_spi_homing_check()) break;
|
|
|
|
if (endstops.tmc_spi_homing_check()) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Max7219 heartbeat, animation, etc.
|
|
|
|
#if ENABLED(MAX7219_DEBUG)
|
|
|
|
#if ENABLED(MAX7219_DEBUG)
|
|
|
|
max7219.idle_tasks();
|
|
|
|
max7219.idle_tasks();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Read Buttons and Update the LCD
|
|
|
|
ui.update();
|
|
|
|
ui.update();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Announce Host Keepalive state (if any)
|
|
|
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
|
|
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
|
|
|
gcode.host_keepalive();
|
|
|
|
gcode.host_keepalive();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Core Marlin activities
|
|
|
|
manage_inactivity(
|
|
|
|
manage_inactivity(
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
no_stepper_sleep
|
|
|
|
no_stepper_sleep
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Manage heaters (and Watchdog)
|
|
|
|
thermalManager.manage_heater();
|
|
|
|
thermalManager.manage_heater();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update the Print Job Timer state
|
|
|
|
#if ENABLED(PRINTCOUNTER)
|
|
|
|
#if ENABLED(PRINTCOUNTER)
|
|
|
|
print_job_timer.tick();
|
|
|
|
print_job_timer.tick();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update the Beeper queue
|
|
|
|
#if USE_BEEPER
|
|
|
|
#if USE_BEEPER
|
|
|
|
buzzer.tick();
|
|
|
|
buzzer.tick();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Run i2c Position Encoders
|
|
|
|
#if ENABLED(I2C_POSITION_ENCODERS)
|
|
|
|
#if ENABLED(I2C_POSITION_ENCODERS)
|
|
|
|
static millis_t i2cpem_next_update_ms;
|
|
|
|
static millis_t i2cpem_next_update_ms;
|
|
|
|
if (planner.has_blocks_queued()) {
|
|
|
|
if (planner.has_blocks_queued()) {
|
|
|
@ -704,10 +701,12 @@ void idle(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Run HAL idle tasks
|
|
|
|
#ifdef HAL_IDLETASK
|
|
|
|
#ifdef HAL_IDLETASK
|
|
|
|
HAL_idletask();
|
|
|
|
HAL_idletask();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Auto-report Temperatures / SD Status
|
|
|
|
#if HAS_AUTO_REPORTING
|
|
|
|
#if HAS_AUTO_REPORTING
|
|
|
|
if (!gcode.autoreport_paused) {
|
|
|
|
if (!gcode.autoreport_paused) {
|
|
|
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
|
|
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
|
|
@ -719,14 +718,17 @@ void idle(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle USB Flash Drive insert / remove
|
|
|
|
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
|
|
|
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
|
|
|
Sd2Card::idle();
|
|
|
|
Sd2Card::idle();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update the Prusa MMU2
|
|
|
|
#if ENABLED(PRUSA_MMU2)
|
|
|
|
#if ENABLED(PRUSA_MMU2)
|
|
|
|
mmu2.mmu_loop();
|
|
|
|
mmu2.mmu_loop();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle Joystick jogging
|
|
|
|
#if ENABLED(POLL_JOG)
|
|
|
|
#if ENABLED(POLL_JOG)
|
|
|
|
joystick.inject_jog_moves();
|
|
|
|
joystick.inject_jog_moves();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|