Hello - hopefully this is the right place for this question.
It seems the esp-idf Bluetooth library doesn't have much BT/RFCOMM support, so I'm starting to work on a Bluetooth implementation using Blue Kitchen's BTStack. BTStack is a third-party library that supports many hardware platforms, among them the esp32. I've got it working, but their library is rich with informational printf's that would be much better suited for ESP_LOGI() calls. The library is rather, uh, loquacious.
So, one solution would be to go through all of their code and manually change printfs to ESP_LOGI calls, but that's a lot of code to change and I'd have to redo it every time the library gets updated. Or I could try to write a little .h file with a macro redefining printf to an ESP_LOGI wrapper using some VA_ARGS magic. I'd still have to touch every module, but at least it would just be a header file include.
But the cleanest solution would be to somehow hijack the esp32 printf library function, assuming it's not needed elsewhere or by ESP_LOG itself. I'm wondering if anyone has run into this or a similar issue before, and how they solved it.
Ideas?
redirecting printf to ESP_LOGx
Re: redirecting printf to ESP_LOGx
Dang, perfect. High five, WiFive! Thanks much.
Re: redirecting printf to ESP_LOGx
Just to follow up (and for anyone who's as lost as me), now that I've tinkered with this I see they don't quite follow the ESP logging convention. They are not routing their calls through ESP_LOGx, so debug levels are not handled in config, like everyone else.
Unless I'm missing something, to change the BTStack log levels, it appears you have to
1) edit .../port/esp32/components/btstack/include/btstack_config.h which resides in the btstack-master, and comment out each #define for the log levels you want to disable. So for example
enables ERROR but disables INFO and DEBUG.
2) re-install BTstack by re-running .../port/esp32/integrate_btstack.py to repopulate the esp-idf tree
3) then you can do your clean and rebuild.
Thanks again,
Dave
Unless I'm missing something, to change the BTStack log levels, it appears you have to
1) edit .../port/esp32/components/btstack/include/btstack_config.h which resides in the btstack-master, and comment out each #define for the log levels you want to disable. So for example
Code: Select all
#define ENABLE_LOG_ERROR
// #define ENABLE_LOG_INFO
// #define ENABLE_LOG_DEBUG
2) re-install BTstack by re-running .../port/esp32/integrate_btstack.py to repopulate the esp-idf tree
3) then you can do your clean and rebuild.
Thanks again,
Dave
Who is online
Users browsing this forum: No registered users and 59 guests