Skip to content

Commit

Permalink
non-volatile mm_countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 21, 2023
1 parent 8371923 commit b357399
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
19 changes: 10 additions & 9 deletions Marlin/src/feature/runout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool FilamentMonitorBase::enabled = true,

#if HAS_FILAMENT_RUNOUT_DISTANCE
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
volatile countdown_t RunoutResponseDelayed::mm_countdown;
countdown_t RunoutResponseDelayed::mm_countdown;
#if ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected;
#endif
Expand Down Expand Up @@ -101,15 +101,16 @@ void event_filament_runout(const uint8_t extruder) {

const bool run_runout_script = !runout.host_handling;

const bool park_or_pause = (false
#ifdef FILAMENT_RUNOUT_SCRIPT
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M125")
|| TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25"))
#endif
);

#if ENABLED(HOST_ACTION_COMMANDS)

const bool park_or_pause = (false
#ifdef FILAMENT_RUNOUT_SCRIPT
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M600")
|| strstr(FILAMENT_RUNOUT_SCRIPT, "M125")
|| TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25"))
#endif
);

if (run_runout_script && park_or_pause) {
hostui.paused(false);
}
Expand Down
10 changes: 8 additions & 2 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@
#define HAS_FILAMENT_SWITCH 1
#endif

typedef Flags<8> runout_flags_t;
typedef Flags<
#if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS
NUM_MOTION_SENSORS
#else
NUM_RUNOUT_SENSORS
#endif
> runout_flags_t;

void event_filament_runout(const uint8_t extruder);

Expand Down Expand Up @@ -352,7 +358,7 @@ class FilamentSensorBase {
// during a runout condition.
class RunoutResponseDelayed {
private:
static volatile countdown_t mm_countdown;
static countdown_t mm_countdown;

public:
static float runout_distance_mm;
Expand Down

0 comments on commit b357399

Please sign in to comment.