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:
parent
3c7eaafeaf
commit
0276148613
@ -394,18 +394,32 @@ 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(&Serial != NULL && Serial.isTxEnabled()) {
|
||||||
|
if(c == '\n') {
|
||||||
|
Serial.write('\r');
|
||||||
|
}
|
||||||
|
Serial.write(c);
|
||||||
|
} else {
|
||||||
if(c == '\n') {
|
if(c == '\n') {
|
||||||
WRITE_PERI_REG(UART_FIFO(0), '\r');
|
WRITE_PERI_REG(UART_FIFO(0), '\r');
|
||||||
}
|
}
|
||||||
WRITE_PERI_REG(UART_FIFO(0), c);
|
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(&Serial1 != NULL && Serial1.isTxEnabled()) {
|
||||||
|
if(c == '\n') {
|
||||||
|
Serial1.write('\r');
|
||||||
|
}
|
||||||
|
Serial1.write(c);
|
||||||
|
} else {
|
||||||
if(c == '\n') {
|
if(c == '\n') {
|
||||||
WRITE_PERI_REG(UART_FIFO(1), '\r');
|
WRITE_PERI_REG(UART_FIFO(1), '\r');
|
||||||
}
|
}
|
||||||
WRITE_PERI_REG(UART_FIFO(1), c);
|
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;
|
||||||
void ICACHE_FLASH_ATTR uart_set_debug(UARTnr_t uart_nr) {
|
void ICACHE_FLASH_ATTR uart_set_debug(UARTnr_t uart_nr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user