when I printf using the \r option only nothing goes to the terminal.
I want to be able to print on the same line without a CR.
for (int i = 10; i >= 0; i--) {
printf("Restarting in %d seconds...\r", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
This prints nothing, even if I use fflush(stdout); after the printf.
Anyone have any ideas to do this ?
using printf with \r help
Re: using printf with \r help
Maybe you can try ESP_LOGI() instead of printf(). (but my printf() is fine).
-
- Posts: 2045
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: using printf with \r help
You can try ANSI codes, like
Code: Select all
printf("... \033[1G"); // Move cursor to column 1
Re: using printf with \r help
ESP_LOGI() wont work because all the ESP_LOGx's slap a CR at the end of what your printing.Maybe you can try ESP_LOGI() instead of printf(). (but my printf() is fine).
Thanks, but the issue is without the \n the uart never shoots anything out. It gets buffered to some length, and when that buffer gets full everything gets dumped at once. I need a way to force the uart to dump what it has.printf("... \033[1G"); // Move cursor to column 1
Who is online
Users browsing this forum: No registered users and 94 guests