Instant Freeze/Resume Function (#17462)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Jamie
2021-05-14 00:14:13 -05:00
committed by Scott Lahteine
parent 5298fa357c
commit 9e373617dc
8 changed files with 51 additions and 5 deletions

View File

@ -179,6 +179,10 @@ bool Stepper::abort_current_block;
uint32_t Stepper::acceleration_time, Stepper::deceleration_time;
uint8_t Stepper::steps_per_isr;
#if HAS_FREEZE_PIN
bool Stepper::frozen; // = false
#endif
IF_DISABLED(ADAPTIVE_STEP_SMOOTHING, constexpr) uint8_t Stepper::oversampling_factor;
xyze_long_t Stepper::delta_error{0};
@ -1531,6 +1535,9 @@ void Stepper::pulse_phase_isr() {
// If there is no current block, do nothing
if (!current_block) return;
// Skipping step processing causes motion to freeze
if (TERN0(HAS_FREEZE_PIN, frozen)) return;
// Count of pending loops and events for this iteration
const uint32_t pending_events = step_event_count - step_events_completed;
uint8_t events_to_do = _MIN(pending_events, steps_per_isr);

View File

@ -266,6 +266,10 @@ class Stepper {
static constexpr uint8_t last_moved_extruder = 0;
#endif
#if HAS_FREEZE_PIN
static bool frozen; // Set this flag to instantly freeze motion
#endif
private:
static block_t* current_block; // A pointer to the block currently being traced