1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-27 21:16:50 +03:00

fix printf corrupts Serial.print

This commit is contained in:
Markus Sattler 2015-04-06 19:15:10 +02:00
parent 3c7eaafeaf
commit 0276148613

View File

@ -394,17 +394,31 @@ void ICACHE_FLASH_ATTR uart_ignore_char(char c) {
} }
void ICACHE_FLASH_ATTR uart0_write_char(char c) { void ICACHE_FLASH_ATTR uart0_write_char(char c) {
if(c == '\n') { if(&Serial != NULL && Serial.isTxEnabled()) {
WRITE_PERI_REG(UART_FIFO(0), '\r'); if(c == '\n') {
} Serial.write('\r');
WRITE_PERI_REG(UART_FIFO(0), c); }
Serial.write(c);
} else {
if(c == '\n') {
WRITE_PERI_REG(UART_FIFO(0), '\r');
}
WRITE_PERI_REG(UART_FIFO(0), c);
}
} }
void ICACHE_FLASH_ATTR uart1_write_char(char c) { void ICACHE_FLASH_ATTR uart1_write_char(char c) {
if(c == '\n') { if(&Serial1 != NULL && Serial1.isTxEnabled()) {
WRITE_PERI_REG(UART_FIFO(1), '\r'); if(c == '\n') {
} Serial1.write('\r');
WRITE_PERI_REG(UART_FIFO(1), c); }
Serial1.write(c);
} else {
if(c == '\n') {
WRITE_PERI_REG(UART_FIFO(1), '\r');
}
WRITE_PERI_REG(UART_FIFO(1), c);
}
} }
static UARTnr_t s_uart_debug_nr = UART_NO; static UARTnr_t s_uart_debug_nr = UART_NO;