Merge branch 'feature/configurable_add_lf_after_cr_printf' into 'master'
Add cr after a lf is printed (configurable) Small menuconfig option to make the newlib stdout functions replicate the behaviour of ets_printf e.a. by sending out a \r before every \n. See merge request !14
This commit is contained in:
commit
553b08cd5e
2 changed files with 18 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
menu "WiFi config"
|
menu "ESP32-specific config"
|
||||||
|
|
||||||
config WIFI_ENABLED
|
config WIFI_ENABLED
|
||||||
bool "Enable low-level WiFi stack"
|
bool "Enable low-level WiFi stack"
|
||||||
|
@ -36,4 +36,15 @@ config WIFI_EVENT_TASK_STACK_SIZE
|
||||||
help
|
help
|
||||||
Config WiFi event task stack size in different application.
|
Config WiFi event task stack size in different application.
|
||||||
|
|
||||||
|
|
||||||
|
config NEWLIB_STDOUT_ADDCR
|
||||||
|
bool "Standard-out output adds carriage return before newline"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Most people are used to end their printf strings with a newline. If this
|
||||||
|
is sent as is to the serial port, most terminal programs will only move the
|
||||||
|
cursor one line down, not also move it to the beginning of the line. This
|
||||||
|
is usually done by an added CR character. Enabling this will make the
|
||||||
|
standard output code automatically add a CR character before a LF.
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -137,6 +137,11 @@ ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) {
|
||||||
const char* p = (const char*) data;
|
const char* p = (const char*) data;
|
||||||
if (fd == STDOUT_FILENO) {
|
if (fd == STDOUT_FILENO) {
|
||||||
while(size--) {
|
while(size--) {
|
||||||
|
#if CONFIG_NEWLIB_STDOUT_ADDCR
|
||||||
|
if (*p=='\n') {
|
||||||
|
uart_tx_one_char('\r');
|
||||||
|
}
|
||||||
|
#endif
|
||||||
uart_tx_one_char(*p);
|
uart_tx_one_char(*p);
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue