diff options
Diffstat (limited to 'Firmware/MarlinSerial.cpp')
-rw-r--r-- | Firmware/MarlinSerial.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Firmware/MarlinSerial.cpp b/Firmware/MarlinSerial.cpp index e4e737433..fba87cc86 100644 --- a/Firmware/MarlinSerial.cpp +++ b/Firmware/MarlinSerial.cpp @@ -53,8 +53,16 @@ FORCE_INLINE void store_char(unsigned char c) //SIGNAL(SIG_USART_RECV) SIGNAL(M_USARTx_RX_vect) { - unsigned char c = M_UDRx; - store_char(c); + // Test for a framing error. + if (M_UCSRxA & (1<<M_FEx)) { + // Characters received with the framing errors will be ignored. + // The temporary variable "c" was made volatile, so the compiler does not optimize this out. + volatile unsigned char c = M_UDRx; + } else { + // Read the input register. + unsigned char c = M_UDRx; + store_char(c); + } } #endif |