|
|
@ -35,13 +35,22 @@
|
|
|
|
#include "../inc/MarlinConfig.h"
|
|
|
|
#include "../inc/MarlinConfig.h"
|
|
|
|
|
|
|
|
|
|
|
|
class FilamentRunoutSensor {
|
|
|
|
class FilamentRunoutSensor {
|
|
|
|
|
|
|
|
public:
|
|
|
|
FilamentRunoutSensor() {}
|
|
|
|
FilamentRunoutSensor() {}
|
|
|
|
|
|
|
|
|
|
|
|
static bool filament_ran_out;
|
|
|
|
|
|
|
|
static void setup();
|
|
|
|
static void setup();
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static reset() { filament_ran_out = false; }
|
|
|
|
FORCE_INLINE static void reset() { filament_ran_out = false; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static void run() {
|
|
|
|
|
|
|
|
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
|
|
|
|
|
|
|
|
filament_ran_out = true;
|
|
|
|
|
|
|
|
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
static bool filament_ran_out;
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static bool check() {
|
|
|
|
FORCE_INLINE static bool check() {
|
|
|
|
#if NUM_RUNOUT_SENSORS < 2
|
|
|
|
#if NUM_RUNOUT_SENSORS < 2
|
|
|
@ -65,15 +74,6 @@ class FilamentRunoutSensor {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE static void run() {
|
|
|
|
|
|
|
|
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
|
|
|
|
|
|
|
|
filament_ran_out = true;
|
|
|
|
|
|
|
|
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern FilamentRunoutSensor runout;
|
|
|
|
extern FilamentRunoutSensor runout;
|
|
|
|