1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

fix bug when TX buffer is full and os will write.

in this case we hang endless or until wtd triggers.

new:
 now we overdrive the data in FIFO --> no hang / crash but we loss chars.
 only happens by extensive use of os_printf!
This commit is contained in:
Markus Sattler
2015-05-14 21:41:43 +02:00
parent 4644c3bad0
commit b4a8bb0653

View File

@ -392,31 +392,35 @@ void uart_ignore_char(char c) {
void uart0_write_char(char c) { void uart0_write_char(char c) {
if(&Serial != NULL && Serial.isTxEnabled()) { if(&Serial != NULL && Serial.isTxEnabled()) {
if(Serial.availableForWrite() > 0) {
if(c == '\n') { if(c == '\n') {
Serial.write('\r'); Serial.write('\r');
} }
Serial.write(c); Serial.write(c);
} else { return;
}
}
if(c == '\n') { if(c == '\n') {
USF(0) = '\r'; USF(0) = '\r';
} }
USF(0) = c; USF(0) = c;
} }
}
void uart1_write_char(char c) { void uart1_write_char(char c) {
if(&Serial1 != NULL && Serial1.isTxEnabled()) { if(&Serial1 != NULL && Serial1.isTxEnabled()) {
if(Serial1.availableForWrite() > 0) {
if(c == '\n') { if(c == '\n') {
Serial1.write('\r'); Serial1.write('\r');
} }
Serial1.write(c); Serial1.write(c);
} else { return;
}
}
if(c == '\n') { if(c == '\n') {
USF(1) = '\r'; USF(1) = '\r';
} }
USF(1) = c; USF(1) = c;
} }
}
static int s_uart_debug_nr = UART0; static int s_uart_debug_nr = UART0;