|
@@ -46,6 +46,7 @@ block_t *current_block; // A pointer to the block currently being traced
|
46
|
46
|
|
47
|
47
|
// Variables used by The Stepper Driver Interrupt
|
48
|
48
|
static unsigned char out_bits; // The next stepping-bits to be output
|
|
49
|
+static unsigned int cleaning_buffer_counter;
|
49
|
50
|
|
50
|
51
|
// Counter variables for the bresenham line tracer
|
51
|
52
|
static long counter_x, counter_y, counter_z, counter_e;
|
|
@@ -346,6 +347,17 @@ FORCE_INLINE void trapezoid_generator_reset() {
|
346
|
347
|
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
|
347
|
348
|
// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
|
348
|
349
|
ISR(TIMER1_COMPA_vect) {
|
|
350
|
+
|
|
351
|
+ if(cleaning_buffer_counter)
|
|
352
|
+ {
|
|
353
|
+ current_block = NULL;
|
|
354
|
+ plan_discard_current_block();
|
|
355
|
+ if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
|
356
|
+ cleaning_buffer_counter--;
|
|
357
|
+ OCR1A = 200;
|
|
358
|
+ return;
|
|
359
|
+ }
|
|
360
|
+
|
349
|
361
|
// If there is no current block, attempt to pop one from the buffer
|
350
|
362
|
if (!current_block) {
|
351
|
363
|
// Anything in the buffer?
|
|
@@ -972,6 +984,7 @@ void finishAndDisableSteppers() {
|
972
|
984
|
}
|
973
|
985
|
|
974
|
986
|
void quickStop() {
|
|
987
|
+ cleaning_buffer_counter = 5000;
|
975
|
988
|
DISABLE_STEPPER_DRIVER_INTERRUPT();
|
976
|
989
|
while (blocks_queued()) plan_discard_current_block();
|
977
|
990
|
current_block = NULL;
|