Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp8266/ets_printf: Introduce __ets_vprintf_disable (GIT8266O-829) #1253

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions components/esp8266/include/esp_libc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ int ets_putc(int c);
*/
int ets_vprintf(const char *fmt, va_list ap);

/**
* libnet80211.a produces some debug output using ets_printf(), and continues
* to use this function well after bootup. If the serial port is used for other
* purposes than logging, it disrupts serial communication at arbitraty moments.
* The output looks like:
* I (5504) wifi:state: 0 -> 2 (b0)
* I (5545) wifi:state: 2 -> 3 (0)
* I (5551) wifi:state: 3 -> 5 (10)
* This flag is a quick stopgap solution. If set by the app, ets_vprintf() output
* is completely supressed.
* See https://github.com/espressif/ESP8266_RTOS_SDK/issues/1082
*/
extern int __ets_vprintf_disable;

#ifndef os_printf
#define os_printf printf
#endif
Expand Down
5 changes: 5 additions & 0 deletions components/esp8266/source/ets_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,13 @@ static int ets_printf_int(val_attr_t * const attr, uint8_t hex)
return 0;
}

int __ets_vprintf_disable = 0;

int ets_vprintf(const char *fmt, va_list va)
{
if (__ets_vprintf_disable)
return 0;

for (; ;) {
const char *ps = fmt;
val_attr_t attr;
Expand Down