Pushed limits active high option. Updated defaults.h. Misc bug fixes. Cleaned up codebase.
- Pushed limit switch active high option (i.e. NC switches). - Updated defaults.h to be in-line with the new settings. - Refactored feed hold handling and step segment buffer to be more generalized in effort to make adding feedrate overrides easier in the future. Also made it a little more clean. - Fixed G18 plane select issue. Now ZX-plane, rather than XZ-plane, per right hand rule. - Cleaned some of the system settings by more accurately renaming some of the variables and removing old obsolete ones. - Declared serial.c rx_buffer_tail to be volatile. No effect, since avr-gcc automatically does this during compilation. Helps with porting when using other compilers. - Updated version number to v0.9b. - Updates to README.md
This commit is contained in:
16
serial.c
16
serial.c
@@ -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;
|
||||
@@ -93,8 +93,7 @@ void serial_write(uint8_t data) {
|
||||
// Data Register Empty Interrupt handler
|
||||
ISR(SERIAL_UDRE)
|
||||
{
|
||||
// Temporary tx_buffer_tail (to optimize for volatile)
|
||||
uint8_t tail = tx_buffer_tail;
|
||||
uint8_t tail = tx_buffer_tail; // Temporary tx_buffer_tail (to optimize for volatile)
|
||||
|
||||
#ifdef ENABLE_XONXOFF
|
||||
if (flow_ctrl == SEND_XOFF) {
|
||||
@@ -122,12 +121,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) {
|
||||
|
Reference in New Issue
Block a user