Pushed bug fixes. Updated readme.

- G18 plane select fix from XZ-plane to ZX-plane per right hand rule.

- Added volatile declaration for rx_buffer_tail in serial.c. No real
effect to operation as avr-gcc adds this upon compilation. Helps with
porting issues when using a different compiler.
This commit is contained in:
Sonny Jeon
2013-12-07 10:10:36 -07:00
parent cc3212d54a
commit d00525d384
3 changed files with 18 additions and 12 deletions

View File

@ -30,7 +30,7 @@
uint8_t rx_buffer[RX_BUFFER_SIZE];
uint8_t rx_buffer_head = 0;
uint8_t rx_buffer_tail = 0;
volatile uint8_t rx_buffer_tail = 0;
uint8_t tx_buffer[TX_BUFFER_SIZE];
uint8_t tx_buffer_head = 0;
@ -122,13 +122,15 @@ ISR(SERIAL_UDRE)
uint8_t serial_read()
{
if (rx_buffer_head == rx_buffer_tail) {
uint8_t tail = rx_buffer_tail; // Temporary rx_buffer_tail (to optimize for volatile)
if (rx_buffer_head == tail) {
return SERIAL_NO_DATA;
} else {
uint8_t data = rx_buffer[rx_buffer_tail];
rx_buffer_tail++;
if (rx_buffer_tail == RX_BUFFER_SIZE) { rx_buffer_tail = 0; }
uint8_t data = rx_buffer[tail];
tail++;
if (tail == RX_BUFFER_SIZE) { tail = 0; }
rx_buffer_tail = tail;
#ifdef ENABLE_XONXOFF
if ((get_rx_buffer_count() < RX_BUFFER_LOW) && flow_ctrl == XOFF_SENT) {
flow_ctrl = SEND_XON;