Skip to content

Commit c66a020

Browse files
committed
Add guards to not compile BT code if not enabled
1 parent 4092fc4 commit c66a020

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

Diff for: cores/esp32/esp32-hal-bt.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
#include "esp32-hal-bt.h"
1616

17-
#if CONFIG_BT_ENABLED
17+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED)
18+
1819

1920
#include "bt.h"
2021
#include "esp_bt_defs.h"

Diff for: libraries/SimpleBLE/examples/SimpleBleDevice/SimpleBleDevice.ino

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
// Useful if you want to advertise some sort of message
1717
// Button is attached between GPIO 0 and GND, and the device name changes each time the button is pressed
1818

19+
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
20+
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
21+
#endif
22+
1923
#include "SimpleBLE.h"
2024
SimpleBLE ble;
2125

Diff for: libraries/SimpleBLE/src/SimpleBLE.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED)
16+
1517
#include "SimpleBLE.h"
1618
#include "esp32-hal-log.h"
1719

@@ -125,3 +127,5 @@ void SimpleBLE::end()
125127
{
126128
_stop_gap();
127129
}
130+
131+
#endif

Diff for: libraries/SimpleBLE/src/SimpleBLE.h

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#ifndef _SIMPLE_BLE_H_
1616
#define _SIMPLE_BLE_H_
1717

18+
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BLUEDROID_ENABLED)
1819

1920
#include <cstdint>
2021
#include <cstdio>
@@ -58,3 +59,5 @@ class SimpleBLE {
5859
};
5960

6061
#endif
62+
63+
#endif

0 commit comments

Comments
 (0)