diff --git a/dda_queue.c b/dda_queue.c index 87effa7..9712160 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -3,7 +3,7 @@ #include #include -#include "config.h" // for XONXOFF +#include "config.h" #include "timer.h" #include "serial.h" #include "sermsg.h" @@ -76,13 +76,6 @@ void enqueue(TARGET *t) { mb_head = h; - #ifdef XONXOFF - // If the queue has only two slots remaining, stop transmission. More - // characters might come in until the stop takes effect. - if (((mb_tail - mb_head - 1) & (MOVEBUFFER_SIZE - 1)) < (MOVEBUFFER_SIZE - 2)) - xoff(); - #endif - // fire up in case we're not running yet if (timerInterruptIsEnabled() == 0) next_move(); @@ -99,12 +92,6 @@ void next_move() { } else disableTimerInterrupt(); - - #ifdef XONXOFF - // restart transmission if the move buffer is only half full - if (((mb_tail - mb_head - 1) & (MOVEBUFFER_SIZE - 1)) > (MOVEBUFFER_SIZE / 2)) - xon(); - #endif } void print_queue() { diff --git a/gcode.c b/gcode.c index 2c5e717..aa8a1c2 100644 --- a/gcode.c +++ b/gcode.c @@ -411,17 +411,11 @@ void process_gcode_command(GCODE_COMMAND *gcmd) { // G4 - Dwell case 4: - #ifdef XONXOFF - xoff(); - #endif // wait for all moves to complete for (;queue_empty() == 0;) wd_reset(); // delay delay_ms(gcmd->P); - #ifdef XONXOFF - xon(); - #endif break; // G20 - inches as units diff --git a/serial.c b/serial.c index 233323c..f592973 100644 --- a/serial.c +++ b/serial.c @@ -2,6 +2,7 @@ #include +#include "config.h" // for XONXOFF #include "arduino.h" #define BUFSIZE 64 @@ -94,6 +95,7 @@ ISR(USART0_RX_vect) // the buffer has only 16 free characters left, so send an XOFF // more characters might come in until the XOFF takes effect flowflags = FLOWFLAG_SEND_XOFF | FLOWFLAG_STATE_XON; + // enable TX interrupt so we can send this character UCSR0B |= MASK(UDRIE0); } #endif @@ -214,29 +216,3 @@ void serial_writestr_P(PGM_P data) while ((r = pgm_read_byte(&data[i++]))) serial_writechar(r); } - -#ifdef XONXOFF -void xon() { - // disable TX interrupt - UCSR0B &= ~MASK(UDRIE0); - - if ((flowflags & FLOWFLAG_STATE_XON) == 0) - flowflags = FLOWFLAG_SEND_XON; - else - flowflags = FLOWFLAG_STATE_XON; // purge a possible FLOWFLAG_SEND_XOFF - - // enable TX interrupt so we can send this character - UCSR0B |= MASK(UDRIE0); -} - -void xoff() { - UCSR0B &= ~MASK(UDRIE0); - - if (flowflags & FLOWFLAG_STATE_XON) - flowflags = FLOWFLAG_SEND_XOFF | FLOWFLAG_STATE_XON; - else - flowflags = 0; - - UCSR0B |= MASK(UDRIE0); -} -#endif diff --git a/serial.h b/serial.h index 982ffb9..cd6a54f 100644 --- a/serial.h +++ b/serial.h @@ -5,8 +5,6 @@ #include #include -#include "config.h" // for XONXOFF - // initialise serial subsystem void serial_init(void); @@ -29,10 +27,4 @@ void serial_writestr(uint8_t *data); void serial_writeblock_P(PGM_P data, int datalen); void serial_writestr_P(PGM_P data); -#ifdef XONXOFF -// XON/XOFF flow control -void xon(void); -void xoff(void); -#endif - #endif /* _SERIAL_H */