@ -376,6 +376,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
//Inactivity shutdown variables
//Inactivity shutdown variables
static unsigned long previous_millis_cmd = 0 ;
static unsigned long previous_millis_cmd = 0 ;
static unsigned long previous_millis_ok = 0 ;
static unsigned long max_inactive_time = 0 ;
static unsigned long max_inactive_time = 0 ;
static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000l ;
static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000l ;
@ -645,6 +646,7 @@ void loop()
else
else
{
{
SERIAL_PROTOCOLLNPGM ( MSG_OK ) ;
SERIAL_PROTOCOLLNPGM ( MSG_OK ) ;
previous_millis_ok = millis ( ) ;
}
}
}
}
else
else
@ -3155,12 +3157,13 @@ Sigma_Exit:
}
}
}
}
else if ( servo_index > = 0 ) {
else if ( servo_index > = 0 ) {
SERIAL_PROTOCOL ( MSG_OK ) ;
SERIAL_PROTOCOL ( MSG_OK ) ;
SERIAL_PROTOCOL ( " Servo " ) ;
SERIAL_PROTOCOL ( " Servo " ) ;
SERIAL_PROTOCOL ( servo_index ) ;
SERIAL_PROTOCOL ( servo_index ) ;
SERIAL_PROTOCOL ( " : " ) ;
SERIAL_PROTOCOL ( " : " ) ;
SERIAL_PROTOCOL ( servos [ servo_index ] . read ( ) ) ;
SERIAL_PROTOCOL ( servos [ servo_index ] . read ( ) ) ;
SERIAL_PROTOCOLLN ( " " ) ;
SERIAL_PROTOCOLLN ( " " ) ;
previous_millis_ok = millis ( ) ;
}
}
}
}
break ;
break ;
@ -3235,6 +3238,7 @@ Sigma_Exit:
SERIAL_PROTOCOL ( " d: " ) ;
SERIAL_PROTOCOL ( " d: " ) ;
SERIAL_PROTOCOL ( unscalePID_d ( bedKd ) ) ;
SERIAL_PROTOCOL ( unscalePID_d ( bedKd ) ) ;
SERIAL_PROTOCOLLN ( " " ) ;
SERIAL_PROTOCOLLN ( " " ) ;
previous_millis_ok = millis ( ) ;
}
}
break ;
break ;
# endif //PIDTEMP
# endif //PIDTEMP
@ -3525,6 +3529,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
SERIAL_ECHO_START ;
SERIAL_ECHO_START ;
SERIAL_ECHOLNPGM ( MSG_ZPROBE_ZOFFSET " " MSG_OK ) ;
SERIAL_ECHOLNPGM ( MSG_ZPROBE_ZOFFSET " " MSG_OK ) ;
SERIAL_PROTOCOLLN ( " " ) ;
SERIAL_PROTOCOLLN ( " " ) ;
previous_millis_ok = millis ( ) ;
}
}
else
else
{
{
@ -3911,6 +3916,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
ClearToSend ( ) ;
ClearToSend ( ) ;
}
}
void FlushSerialRequestResend ( )
void FlushSerialRequestResend ( )
{
{
//char cmdbuffer[bufindr][100]="Resend:";
//char cmdbuffer[bufindr][100]="Resend:";
@ -3928,6 +3934,7 @@ void ClearToSend()
return ;
return ;
# endif //SDSUPPORT
# endif //SDSUPPORT
SERIAL_PROTOCOLLNPGM ( MSG_OK ) ;
SERIAL_PROTOCOLLNPGM ( MSG_OK ) ;
previous_millis_ok = millis ( ) ;
}
}
void get_coordinates ( )
void get_coordinates ( )
@ -4352,6 +4359,14 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
if ( ( millis ( ) - previous_millis_cmd ) > max_inactive_time )
if ( ( millis ( ) - previous_millis_cmd ) > max_inactive_time )
if ( max_inactive_time )
if ( max_inactive_time )
kill ( ) ;
kill ( ) ;
// If 'OK' is garbled on sending PC won't receive it. Both machines will wait on each other forever.
// This resends OK if nothing is heard from PC for a while to avoid this bad case.
if ( ( millis ( ) - previous_millis_ok ) > max_inactive_time / 4 ) {
SERIAL_PROTOCOL ( MSG_OK ) ;
previous_millis_ok = millis ( ) ;
}
if ( stepper_inactive_time ) {
if ( stepper_inactive_time ) {
if ( ( millis ( ) - previous_millis_cmd ) > stepper_inactive_time )
if ( ( millis ( ) - previous_millis_cmd ) > stepper_inactive_time )
{
{