Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
h2zero committed Jun 12, 2024
1 parent bbb70ae commit 5923326
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/NimBLEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ void NimBLEDevice::init(const std::string &deviceName) {

esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);

# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || !defined(CONFIG_NIMBLE_CPP_IDF)
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
# if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
Expand All @@ -881,7 +881,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
# endif
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
ESP_ERROR_CHECK(esp_nimble_hci_init());
//ESP_ERROR_CHECK(esp_nimble_hci_init());
# endif
#endif
nimble_port_init();
Expand Down Expand Up @@ -928,7 +928,7 @@ void NimBLEDevice::deinit(bool clearAll) {
int ret = nimble_port_stop();
if (ret == 0) {
nimble_port_deinit();
#if defined(CONFIG_NIMBLE_CPP_IDF)
#ifdef CONFIG_NIMBLE_CPP_IDF
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
ret = esp_nimble_hci_and_controller_deinit();
if (ret != ESP_OK) {
Expand Down
4 changes: 2 additions & 2 deletions src/NimBLEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ void NimBLEServer::start() {
abort();
}

#if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
//#if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
ble_gatts_show_local();
#endif
//#endif
/*** Future use ***
* TODO: implement service changed handling
Expand Down
2 changes: 1 addition & 1 deletion src/NimBLEService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool NimBLEService::start() {
// Nimble requires the last characteristic to have it's uuid = 0 to indicate the end
// of the characteristics for the service. We create 1 extra and set it to null
// for this purpose.
pChr_a = new ble_gatt_chr_def[numChrs + 1];
pChr_a = new ble_gatt_chr_def[numChrs + 1]{};
int i = 0;
for(auto chr_it = m_chrVec.begin(); chr_it != m_chrVec.end(); ++chr_it) {
if((*chr_it)->m_removed > 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/nimconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@
#define CONFIG_IDF_TARGET_ESP32 1
#endif

#define CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE 1

#if CONFIG_BT_NIMBLE_EXT_ADV || CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV
# if defined(CONFIG_IDF_TARGET_ESP32)
# error Extended advertising is not supported on ESP32.
Expand Down

0 comments on commit 5923326

Please sign in to comment.