clear_block_buffer, kill_current_block in quick_stop
This commit is contained in:
parent
a783caabac
commit
9769d799df
@ -85,8 +85,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],
|
||||||
@ -192,7 +192,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);
|
||||||
@ -202,6 +201,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MINIMAL_STEP_RATE 120
|
#define MINIMAL_STEP_RATE 120
|
||||||
|
@ -296,6 +296,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
|
||||||
@ -581,7 +583,7 @@ class Planner {
|
|||||||
return bbru;
|
return bbru;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_block_buffer_runtime(){
|
static void clear_block_buffer_runtime() {
|
||||||
CRITICAL_SECTION_START
|
CRITICAL_SECTION_START
|
||||||
block_buffer_runtime_us = 0;
|
block_buffer_runtime_us = 0;
|
||||||
CRITICAL_SECTION_END
|
CRITICAL_SECTION_END
|
||||||
|
@ -1210,10 +1210,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();
|
||||||
|
Loading…
Reference in New Issue
Block a user