Laser Safety Timeout (#24189)

This commit is contained in:
John Robertson
2022-05-31 23:09:44 +01:00
committed by Scott Lahteine
parent 07cd248b91
commit 9a74bcd4cf
14 changed files with 102 additions and 38 deletions

View File

@ -71,6 +71,10 @@
#include "../libs/nozzle.h"
#endif
#if LASER_SAFETY_TIMEOUT_MS > 0
#include "../feature/spindle_laser.h"
#endif
// MAX TC related macros
#define TEMP_SENSOR_IS_MAX(n, M) (ENABLED(TEMP_SENSOR_##n##_IS_MAX##M) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX##M) && REDUNDANT_TEMP_MATCH(SOURCE, E##n)))
#define TEMP_SENSOR_IS_ANY_MAX_TC(n) (ENABLED(TEMP_SENSOR_##n##_IS_MAX_TC) || (ENABLED(TEMP_SENSOR_REDUNDANT_IS_MAX_TC) && REDUNDANT_TEMP_MATCH(SOURCE, E##n)))
@ -3325,6 +3329,7 @@ public:
/**
* Handle various ~1kHz tasks associated with temperature
* - Check laser safety timeout
* - Heater PWM (~1kHz with scaler)
* - LCD Button polling (~500Hz)
* - Start / Read one ADC sensor
@ -3334,6 +3339,14 @@ public:
*/
void Temperature::isr() {
// Shut down the laser if steppers are inactive for > LASER_SAFETY_TIMEOUT_MS ms
#if LASER_SAFETY_TIMEOUT_MS > 0
if (cutter.last_power_applied && ELAPSED(millis(), gcode.previous_move_ms + (LASER_SAFETY_TIMEOUT_MS))) {
cutter.power = 0; // Prevent planner idle from re-enabling power
cutter.apply_power(0);
}
#endif
static int8_t temp_count = -1;
static ADCSensorState adc_sensor_state = StartupDelay;
static uint8_t pwm_count = _BV(SOFT_PWM_SCALE);