Skip to content

Fix a esp32-hal-misc.c compilation error if Bluetooth not enabled #2172

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

ahornerr
Copy link
Contributor

@ahornerr ahornerr commented Dec 9, 2018

The file cores/esp32/esp32-hal-misc.c attempts to #include "esp_bt.h" regardless if Bluetooth is enabled or not (typically via sdkconfig) which causes a compilation error. The actual logic in esp32-hal-misc.c is guarded by the CONFIG_BT_ENABLED flag so all we have to do is wrap the include with the same flag.

Currently

Config with CONFIG_BT_ENABLED not set to true will fail compilation with the following error:

../components/arduino/cores/esp32/esp32-hal-misc.c:24:20: fatal error: esp_bt.h: No such file or directory

This is because esp_bt.h isn't added to the CMake includes unless the CONFIG_BT_ENABLED flag is set to true. https://github.com/espressif/esp-idf/blob/ae5df5d6ce7c9abd9c8c4731ced96031c29f7fc1/components/bt/CMakeLists.txt#L1-L4

After the fix

Successful compilation with the CONFIG_BT_ENABLED flag set to a falsey value

@me-no-dev
Copy link
Member

Ahh nice catch :) I should maybe figure out how to test such cases. Arduino is tested only with the IDE as of now and BT is enabled for it

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants