add flush queue for emergency stop

This commit is contained in:
Michael Moon 2010-10-18 18:43:03 +11:00
parent ea2c7cd469
commit 549e60e69d
3 changed files with 19 additions and 0 deletions

View File

@ -106,3 +106,18 @@ void print_queue() {
serial_writechar('E');
serial_writechar('\n');
}
void queue_flush() {
// save interrupt flag
uint8_t sreg = SREG;
// disable interrupts
cli();
// flush queue
mb_tail = mb_head;
movebuffer[mb_head].live = 0;
// restore interrupt flag
SREG = sreg;
}

View File

@ -33,4 +33,7 @@ void next_move(void) __attribute__ ((hot));
// print queue status
void print_queue(void);
// flush the queue for eg; emergency stop
void queue_flush(void);
#endif /* _DDA_QUEUE */

View File

@ -249,6 +249,7 @@ void process_gcode_command() {
// M112- immediate stop
case 112:
disableTimerInterrupt();
queue_flush();
power_off();
break;
// M113- extruder PWM