Remove old XON/XOFF implementation, as it's redundant now.

This commit is contained in:
Markus Hitter 2010-10-05 20:44:27 +02:00
parent a438a3fa2f
commit f799228a8e
4 changed files with 3 additions and 54 deletions

View File

@ -3,7 +3,7 @@
#include <string.h>
#include <avr/interrupt.h>
#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() {

View File

@ -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

View File

@ -2,6 +2,7 @@
#include <avr/interrupt.h>
#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

View File

@ -5,8 +5,6 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#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 */