diff --git a/Makefile b/Makefile index 6011ae0..922f2b6 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m # Tune the lines below only if you know what you are doing: AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE) -B 10 -F -COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections +COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE) -I. -ffunction-sections # symbolic targets: all: grbl.hex @@ -81,8 +81,7 @@ main.elf: $(OBJECTS) grbl.hex: main.elf rm -f grbl.hex avr-objcopy -j .text -j .data -O ihex main.elf grbl.hex - avr-objdump -h main.elf | grep .bss | ruby -e 'puts "\n\n--- Requires %s bytes of SRAM" % STDIN.read.match(/0[0-9a-f]+\s/)[0].to_i(16)' - avr-size *.hex *.elf *.o + avr-size -C --mcu=$(DEVICE) main.elf # If you have an EEPROM section, you must also create a hex file for the # EEPROM and add it to the "flash" target. diff --git a/config.h b/config.h index 591b620..9c2305a 100644 --- a/config.h +++ b/config.h @@ -115,12 +115,15 @@ #define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds) // FOR ADVANCED USERS ONLY: Toggles XON/XOFF software flow control for serial communications. -// Officially not supported due to problems involving USB-to-serial chip latency (Atmega8U2/FTDI) -// when connecting to an Arduino through the USB port. This problem has to do with having no control -// of the USB packets and causing standard terminal programs not being able to honor the XON/XOFF -// control characters on time. However, with specially programmed UI's or avoiding the USB interface -// completely, XON/XOFF flow control should work. In any case, please report any successes to grbl -// administrators! +// Officially not supported due to problems involving the Atmega8U2 USB-to-serial chips on current +// future Arduinos boards. The firmware on these chips do not support XON/XOFF flow control +// characters and the intermediate buffer in the chips cause latency and overflow problems with +// standard terminal programs. However, using specifically-programmed UI's to manage this latency +// problem has been confirmed to work, as well as, using older FTDI FT232RL-based Arduinos +// (Duemilanove) since their firmaware correctly manage the XON/XOFF characters. Other unconfirmed +// methods include using an FTDI board/cable or directly communicate on the RX/TX pins on the +// Arduino, both of which circumvent the Atmega8U2 chip altogether. In any case, please report any +// successes to grbl administrators! #define ENABLE_XONXOFF 0 // Boolean. Default disabled. // ----------------------------------------------- diff --git a/gcode.c b/gcode.c index 4a054e7..7e20f89 100644 --- a/gcode.c +++ b/gcode.c @@ -569,7 +569,7 @@ static int next_statement(char *letter, double *double_ptr, char *line, uint8_t - Evaluation of expressions - Variables - Multiple home locations - - Multiple coordinate systems (May be added in the future) + - Multiple coordinate systems (Additional ones maybe added in config.h) - Probing - Override control - Tool changes diff --git a/limits.c b/limits.c index be93b78..64ff53f 100644 --- a/limits.c +++ b/limits.c @@ -1,5 +1,5 @@ /* - limits.h - code pertaining to limit-switches and performing the homing cycle + limits.c - code pertaining to limit-switches and performing the homing cycle Part of Grbl Copyright (c) 2009-2011 Simen Svale Skogsrud diff --git a/serial.c b/serial.c index 4202c3a..6036d3a 100644 --- a/serial.c +++ b/serial.c @@ -111,24 +111,24 @@ ISR(USART_UDRE_vect) uint8_t tail = tx_buffer_tail; #if ENABLE_XONXOFF - switch (flow_ctrl) { - case SEND_XOFF: UDR0 = XOFF_CHAR; flow_ctrl = XOFF_SENT; break; - case SEND_XON: UDR0 = XON_CHAR; flow_ctrl = XON_SENT; break; - default: + if (flow_ctrl == SEND_XOFF) { + UDR0 = XOFF_CHAR; + flow_ctrl = XOFF_SENT; + } else if (flow_ctrl == SEND_XON) { + UDR0 = XON_CHAR; + flow_ctrl = XON_SENT; + } else #endif + { + // Send a byte from the buffer + UDR0 = tx_buffer[tail]; - // Send a byte from the buffer - UDR0 = tx_buffer[tail]; - - // Update tail position - tail++; - if (tail == TX_BUFFER_SIZE) { tail = 0; } - - tx_buffer_tail = tail; - - #if ENABLE_XONXOFF - } - #endif + // Update tail position + tail++; + if (tail == TX_BUFFER_SIZE) { tail = 0; } + + tx_buffer_tail = tail; + } // Turn off Data Register Empty Interrupt to stop tx-streaming if this concludes the transfer if (tail == tx_buffer_head) { UCSR0B &= ~(1 << UDRIE0); } @@ -144,7 +144,7 @@ uint8_t serial_read() if (rx_buffer_tail == RX_BUFFER_SIZE) { rx_buffer_tail = 0; } #if ENABLE_XONXOFF - if ((get_rx_buffer_count() < RX_BUFFER_LOW) && flow_ctrl != XON_SENT) { + if ((get_rx_buffer_count() < RX_BUFFER_LOW) && flow_ctrl == XOFF_SENT) { flow_ctrl = SEND_XON; UCSR0B |= (1 << UDRIE0); // Force TX } @@ -183,7 +183,7 @@ ISR(USART_RX_vect) rx_buffer_head = next_head; #if ENABLE_XONXOFF - if ((get_rx_buffer_count() >= RX_BUFFER_FULL) && flow_ctrl != XOFF_SENT) { + if ((get_rx_buffer_count() >= RX_BUFFER_FULL) && flow_ctrl == XON_SENT) { flow_ctrl = SEND_XOFF; UCSR0B |= (1 << UDRIE0); // Force TX }