Merge pull request #835 from PavelSindler/safety_timer_gcode
Safety timer gcode
This commit is contained in:
commit
9ba49affc6
6 changed files with 27 additions and 3 deletions
|
@ -195,6 +195,7 @@
|
|||
// M84 - Disable steppers until next move,
|
||||
// or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
||||
// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
||||
// M86 - Set safety timer expiration time with parameter S<seconds>; M86 S0 will disable safety timer
|
||||
// M92 - Set axis_steps_per_unit - same syntax as G92
|
||||
// M104 - Set extruder target temp
|
||||
// M105 - Read current temp
|
||||
|
@ -493,6 +494,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
|
|||
static unsigned long previous_millis_cmd = 0;
|
||||
unsigned long max_inactive_time = 0;
|
||||
static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l;
|
||||
static unsigned long safetytimer_inactive_time = DEFAULT_SAFETYTIMER_TIME_MINS*60*1000ul;
|
||||
|
||||
unsigned long starttime=0;
|
||||
unsigned long stoptime=0;
|
||||
|
@ -5439,6 +5441,15 @@ Sigma_Exit:
|
|||
max_inactive_time = code_value() * 1000;
|
||||
}
|
||||
break;
|
||||
#ifdef SAFETYTIMER
|
||||
case 86: // M86 - set safety timer expiration time in seconds; M86 S0 will disable safety timer
|
||||
//when safety timer expires heatbed and nozzle target temperatures are set to zero
|
||||
if (code_seen('S')) {
|
||||
safetytimer_inactive_time = code_value() * 1000;
|
||||
safetyTimer.start();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case 92: // M92
|
||||
for(int8_t i=0; i < NUM_AXIS; i++)
|
||||
{
|
||||
|
@ -7422,18 +7433,20 @@ void handle_status_leds(void) {
|
|||
|
||||
#ifdef SAFETYTIMER
|
||||
/**
|
||||
* @brief Turn off heating after 30 minutes of inactivity
|
||||
* @brief Turn off heating after safetytimer_inactive_time milliseconds of inactivity
|
||||
*
|
||||
* Full screen blocking notification message is shown after heater turning off.
|
||||
* Paused print is not considered inactivity, as nozzle is cooled anyway and bed cooling would
|
||||
* damage print.
|
||||
*
|
||||
* If safetytimer_inactive_time is zero, feature is disabled (heating is never turned off because of inactivity)
|
||||
*/
|
||||
static void handleSafetyTimer()
|
||||
{
|
||||
#if (EXTRUDERS > 1)
|
||||
#error Implemented only for one extruder.
|
||||
#endif //(EXTRUDERS > 1)
|
||||
if ((PRINTER_ACTIVE) || (!degTargetBed() && !degTargetHotend(0)))
|
||||
if ((PRINTER_ACTIVE) || (!degTargetBed() && !degTargetHotend(0)) || (!safetytimer_inactive_time))
|
||||
{
|
||||
safetyTimer.stop();
|
||||
}
|
||||
|
@ -7441,7 +7454,7 @@ static void handleSafetyTimer()
|
|||
{
|
||||
safetyTimer.start();
|
||||
}
|
||||
else if (safetyTimer.expired(1800000ul)) //30 min
|
||||
else if (safetyTimer.expired(safetytimer_inactive_time))
|
||||
{
|
||||
setTargetBed(0);
|
||||
setTargetHotend(0, 0);
|
||||
|
|
|
@ -422,6 +422,10 @@ THERMISTORS SETTINGS
|
|||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
// Safety timer
|
||||
#define SAFETYTIMER
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
#define M600_TIMEOUT 600 //seconds
|
||||
|
||||
#ifndef SNMM
|
||||
|
|
|
@ -422,6 +422,10 @@ THERMISTORS SETTINGS
|
|||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
// Safety timer
|
||||
#define SAFETYTIMER
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
#define M600_TIMEOUT 600 //seconds
|
||||
|
||||
#ifndef SNMM
|
||||
|
|
|
@ -106,6 +106,7 @@
|
|||
|
||||
// Safety timer
|
||||
#define SAFETYTIMER
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
|
|
|
@ -106,6 +106,7 @@
|
|||
|
||||
// Safety timer
|
||||
#define SAFETYTIMER
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
|
||||
// Safety timer
|
||||
#define SAFETYTIMER
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
|
|
Loading…
Reference in a new issue