@ -336,7 +336,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
const millis_t ms = millis ( ) ;
const millis_t ms = millis ( ) ;
if ( max_inactive_time & & ELAPSED ( ms , gcode . previous_cmd _ms + max_inactive_time ) ) {
if ( max_inactive_time & & ELAPSED ( ms , gcode . previous_move _ms + max_inactive_time ) ) {
SERIAL_ERROR_START ( ) ;
SERIAL_ERROR_START ( ) ;
SERIAL_ECHOLNPAIR ( MSG_KILL_INACTIVE_TIME , parser . command_ptr ) ;
SERIAL_ECHOLNPAIR ( MSG_KILL_INACTIVE_TIME , parser . command_ptr ) ;
kill ( PSTR ( MSG_KILLED ) ) ;
kill ( PSTR ( MSG_KILLED ) ) ;
@ -349,8 +349,10 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
# define MOVE_AWAY_TEST true
# define MOVE_AWAY_TEST true
# endif
# endif
if ( MOVE_AWAY_TEST & & stepper_inactive_time & & ELAPSED ( ms , gcode . previous_cmd_ms + stepper_inactive_time )
if ( stepper_inactive_time ) {
& & ! ignore_stepper_queue & & ! planner . blocks_queued ( ) ) {
if ( planner . has_blocks_queued ( ) )
gcode . previous_move_ms = ms ; // reset_stepper_timeout to keep steppers powered
else if ( MOVE_AWAY_TEST & & ! ignore_stepper_queue & & ELAPSED ( ms , gcode . previous_move_ms + stepper_inactive_time ) ) {
# if ENABLED(DISABLE_INACTIVE_X)
# if ENABLED(DISABLE_INACTIVE_X)
disable_X ( ) ;
disable_X ( ) ;
# endif
# endif
@ -367,6 +369,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
if ( ubl . lcd_map_control ) ubl . lcd_map_control = defer_return_to_status = false ;
if ( ubl . lcd_map_control ) ubl . lcd_map_control = defer_return_to_status = false ;
# endif
# endif
}
}
}
# ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH
# ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH
if ( chdkActive & & ELAPSED ( ms , chdkHigh + CHDK_DELAY ) ) {
if ( chdkActive & & ELAPSED ( ms , chdkHigh + CHDK_DELAY ) ) {
@ -424,8 +427,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
# if ENABLED(EXTRUDER_RUNOUT_PREVENT)
# if ENABLED(EXTRUDER_RUNOUT_PREVENT)
if ( thermalManager . degHotend ( active_extruder ) > EXTRUDER_RUNOUT_MINTEMP
if ( thermalManager . degHotend ( active_extruder ) > EXTRUDER_RUNOUT_MINTEMP
& & ELAPSED ( ms , gcode . previous_cmd _ms + ( EXTRUDER_RUNOUT_SECONDS ) * 1000UL )
& & ELAPSED ( ms , gcode . previous_move _ms + ( EXTRUDER_RUNOUT_SECONDS ) * 1000UL )
& & ! planner . blocks_queued ( )
& & ! planner . has_ blocks_queued( )
) {
) {
# if ENABLED(SWITCHING_EXTRUDER)
# if ENABLED(SWITCHING_EXTRUDER)
const bool oldstatus = E0_ENABLE_READ ;
const bool oldstatus = E0_ENABLE_READ ;
@ -449,8 +452,6 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
}
}
# endif // !SWITCHING_EXTRUDER
# endif // !SWITCHING_EXTRUDER
gcode . refresh_cmd_timeout ( ) ;
const float olde = current_position [ E_AXIS ] ;
const float olde = current_position [ E_AXIS ] ;
current_position [ E_AXIS ] + = EXTRUDER_RUNOUT_EXTRUDE ;
current_position [ E_AXIS ] + = EXTRUDER_RUNOUT_EXTRUDE ;
planner . buffer_line_kinematic ( current_position , MMM_TO_MMS ( EXTRUDER_RUNOUT_SPEED ) , active_extruder ) ;
planner . buffer_line_kinematic ( current_position , MMM_TO_MMS ( EXTRUDER_RUNOUT_SPEED ) , active_extruder ) ;
@ -476,6 +477,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
# endif // E_STEPPERS > 1
# endif // E_STEPPERS > 1
}
}
# endif // !SWITCHING_EXTRUDER
# endif // !SWITCHING_EXTRUDER
gcode . previous_move_ms = ms ; // reset_stepper_timeout to keep steppers powered
}
}
# endif // EXTRUDER_RUNOUT_PREVENT
# endif // EXTRUDER_RUNOUT_PREVENT
@ -541,7 +544,7 @@ void idle(
# 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 . blocks_queued ( ) & & ELAPSED ( millis ( ) , i2cpem_next_update_ms ) ) {
if ( planner . has_ blocks_queued( ) & & ELAPSED ( millis ( ) , i2cpem_next_update_ms ) ) {
I2CPEM . update ( ) ;
I2CPEM . update ( ) ;
i2cpem_next_update_ms = millis ( ) + I2CPE_MIN_UPD_TIME_MS ;
i2cpem_next_update_ms = millis ( ) + I2CPE_MIN_UPD_TIME_MS ;
}
}