Fix large serial command input triggering watchdog
This commit is contained in:
@@ -48,6 +48,7 @@ void USART_Putc(char ch)
|
||||
{
|
||||
short head;
|
||||
|
||||
// Wrap around if end of buffer reached
|
||||
head = (txhead + 1) & USART_TXBUF_MASK;
|
||||
while (head == txtail); // Wait for space
|
||||
|
||||
@@ -62,16 +63,18 @@ void USART_Putc(char ch)
|
||||
ISR(USART_RXC_vect)
|
||||
{
|
||||
short head;
|
||||
byte data;
|
||||
|
||||
// Next byte ready to read from serial
|
||||
data = UDR; // Next byte ready
|
||||
|
||||
// Wrap around if end of buffer reached
|
||||
head = (rxhead + 1) & USART_RXBUF_MASK;
|
||||
|
||||
// Free space in RX buffer?
|
||||
// Otherwise discard overflow
|
||||
if (head != rxtail) {
|
||||
// Copy from register
|
||||
rxbuf[head] = UDR;
|
||||
rxbuf[head] = data;
|
||||
rxhead = head;
|
||||
} else {
|
||||
// XXX: Discard overflow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
// TODO: Config header for chip specifics like EEPROM size.
|
||||
// TODO: Fix huge serial command input triggering watchdog.
|
||||
// TODO: Only update EEPROM if value differs from previous.
|
||||
// TODO: Check thermistor conversion results /w thermometer.
|
||||
// TODO: Implement primary state machine for update loop.
|
||||
|
||||
Reference in New Issue
Block a user