maximkulkin / esp-homekit

Apple HomeKit accessory server library for ESP-OPEN-RTOS
MIT License
1.11k stars 170 forks source link

Silence the serial port #45

Closed cduvenhorst closed 6 years ago

cduvenhorst commented 6 years ago

Is there a way to silence the outputs on the serial port?

maximkulkin commented 6 years ago

Well, as with other parts of SDK which unconditionally write to serial console, I guess the only option is to not initialize UART (uart_set_baud()).

cduvenhorst commented 6 years ago

Well, that‘s what Is quite obvious but - take the Sonoff SC for instance, which communicates with the sensor unit via the UART with AT+ commands. Currently the homekit-info messages all get printed to the sensor unit which reads the UART.

I took a first stab to solve this little problem with the definition of debug levels (INFO, WARN, DEBUG, ...) which works for me now. I am not quite sure if this is of wide interest, since this seems to be a special case.

maximkulkin commented 6 years ago

Thing is that as I said apart from esp-homekit itself there are quite a few places inside SDK that also write to serial (e.g. when you connect to WiFI it prints it's state). I've seen that people who really want to silence everything use some linker magic to substitute printf() function with a dummy one.

Just a small hint: https://github.com/SuperHouse/esp-open-rtos/blob/master/common.mk#L209-L211

cduvenhorst commented 6 years ago

Thanks!