Skip to content

Commit 5923326

Browse files
committed
WIP
1 parent bbb70ae commit 5923326

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/NimBLEDevice.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
866866

867867
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
868868

869-
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
869+
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || !defined(CONFIG_NIMBLE_CPP_IDF)
870870
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
871871
# if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
872872
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
@@ -881,7 +881,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
881881
# endif
882882
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
883883
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
884-
ESP_ERROR_CHECK(esp_nimble_hci_init());
884+
//ESP_ERROR_CHECK(esp_nimble_hci_init());
885885
# endif
886886
#endif
887887
nimble_port_init();
@@ -928,7 +928,7 @@ void NimBLEDevice::deinit(bool clearAll) {
928928
int ret = nimble_port_stop();
929929
if (ret == 0) {
930930
nimble_port_deinit();
931-
#if defined(CONFIG_NIMBLE_CPP_IDF)
931+
#ifdef CONFIG_NIMBLE_CPP_IDF
932932
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
933933
ret = esp_nimble_hci_and_controller_deinit();
934934
if (ret != ESP_OK) {

src/NimBLEServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ void NimBLEServer::start() {
191191
abort();
192192
}
193193

194-
#if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
194+
//#if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
195195
ble_gatts_show_local();
196-
#endif
196+
//#endif
197197
/*** Future use ***
198198
* TODO: implement service changed handling
199199

src/NimBLEService.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool NimBLEService::start() {
159159
// Nimble requires the last characteristic to have it's uuid = 0 to indicate the end
160160
// of the characteristics for the service. We create 1 extra and set it to null
161161
// for this purpose.
162-
pChr_a = new ble_gatt_chr_def[numChrs + 1];
162+
pChr_a = new ble_gatt_chr_def[numChrs + 1]{};
163163
int i = 0;
164164
for(auto chr_it = m_chrVec.begin(); chr_it != m_chrVec.end(); ++chr_it) {
165165
if((*chr_it)->m_removed > 0) {

src/nimconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@
293293
#define CONFIG_IDF_TARGET_ESP32 1
294294
#endif
295295

296+
#define CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE 1
297+
296298
#if CONFIG_BT_NIMBLE_EXT_ADV || CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
297299
# if defined(CONFIG_IDF_TARGET_ESP32)
298300
# error Extended advertising is not supported on ESP32.

0 commit comments

Comments
 (0)