clear_block_buffer, kill_current_block in quick_stop

This commit is contained in:
Scott Lahteine 2018-04-13 22:04:53 -05:00
parent 99282a46e9
commit 36b97bde9f
3 changed files with 9 additions and 6 deletions

View file

@ -100,8 +100,8 @@ Planner planner;
* A ring buffer of moves described in steps * A ring buffer of moves described in steps
*/ */
block_t Planner::block_buffer[BLOCK_BUFFER_SIZE]; block_t Planner::block_buffer[BLOCK_BUFFER_SIZE];
volatile uint8_t Planner::block_buffer_head = 0, // Index of the next block to be pushed volatile uint8_t Planner::block_buffer_head, // Index of the next block to be pushed
Planner::block_buffer_tail = 0; Planner::block_buffer_tail;
float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
Planner::axis_steps_per_mm[XYZE_N], Planner::axis_steps_per_mm[XYZE_N],
@ -207,7 +207,6 @@ float Planner::previous_speed[NUM_AXIS],
Planner::Planner() { init(); } Planner::Planner() { init(); }
void Planner::init() { void Planner::init() {
block_buffer_head = block_buffer_tail = 0;
ZERO(position); ZERO(position);
#if HAS_POSITION_FLOAT #if HAS_POSITION_FLOAT
ZERO(position_float); ZERO(position_float);
@ -217,6 +216,7 @@ void Planner::init() {
#if ABL_PLANAR #if ABL_PLANAR
bed_level_matrix.set_to_identity(); bed_level_matrix.set_to_identity();
#endif #endif
clear_block_buffer();
} }
#if ENABLED(BEZIER_JERK_CONTROL) #if ENABLED(BEZIER_JERK_CONTROL)

View file

@ -309,6 +309,8 @@ class Planner {
*/ */
FORCE_INLINE static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); } FORCE_INLINE static uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
FORCE_INLINE static void clear_block_buffer() { block_buffer_head = block_buffer_tail = 0; }
FORCE_INLINE static bool is_full() { return block_buffer_tail == next_block_index(block_buffer_head); } FORCE_INLINE static bool is_full() { return block_buffer_tail == next_block_index(block_buffer_head); }
// Update multipliers based on new diameter measurements // Update multipliers based on new diameter measurements

View file

@ -2083,10 +2083,11 @@ void Stepper::finish_and_disable() {
} }
void Stepper::quick_stop() { void Stepper::quick_stop() {
cleaning_buffer_counter = 5000;
DISABLE_STEPPER_DRIVER_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT();
while (planner.has_blocks_queued()) planner.discard_current_block(); kill_current_block();
current_block = NULL; current_block = NULL;
cleaning_buffer_counter = 5000;
planner.clear_block_buffer();
ENABLE_STEPPER_DRIVER_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT();
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
planner.clear_block_buffer_runtime(); planner.clear_block_buffer_runtime();