Skip to content

Commit 60b26f8

Browse files
committed
not crashing
1 parent 2aebb92 commit 60b26f8

File tree

5 files changed

+187
-32
lines changed

5 files changed

+187
-32
lines changed

src/NimBLEDevice.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,12 @@ void NimBLEDevice::init(const std::string &deviceName) {
877877

878878
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
879879

880-
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
880+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) || !defined(CONFIG_NIMBLE_CPP_IDF)
881881
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
882882
# if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
883883
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
884+
# elif defined (CONFIG_IDF_TARGET_ESP32C6)
885+
bt_cfg.nimble_max_connections = CONFIG_BT_NIMBLE_MAX_CONNECTIONS;
884886
# else
885887
bt_cfg.mode = ESP_BT_MODE_BLE;
886888
bt_cfg.ble_max_conn = CONFIG_BT_NIMBLE_MAX_CONNECTIONS;

src/nimble/porting/nimble/src/nimble_port.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ esp_err_t esp_nimble_init(void)
102102
/* Initialize the function pointers for OS porting */
103103
npl_freertos_funcs_init();
104104

105-
npl_freertos_mempool_init();
105+
npl_freertos_mempool_init_ovr();
106106
#endif
107107

108108
#if false // Arduino disabled
@@ -118,6 +118,7 @@ esp_err_t esp_nimble_init(void)
118118
os_msys_init();
119119

120120
#else
121+
npl_freertos_mempool_init_ovr();
121122
ble_npl_eventq_init(&g_eventq_dflt);
122123
#endif
123124

@@ -201,7 +202,7 @@ nimble_port_init(void)
201202
/* Initialize the function pointers for OS porting */
202203
npl_freertos_funcs_init();
203204

204-
npl_freertos_mempool_init();
205+
npl_freertos_mempool_init_ovr();
205206
#endif
206207
/* Initialize default event queue */
207208

src/nimble/porting/npl/freertos/include/nimble/nimble_port_freertos.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ UBaseType_t nimble_port_freertos_get_hs_hwm(void);
5555
#if CONFIG_NIMBLE_STACK_USE_MEM_POOLS
5656
void npl_freertos_funcs_init(void);
5757
void npl_freertos_funcs_deinit(void);
58-
int npl_freertos_mempool_init(void);
58+
int npl_freertos_mempool_init_ovr(void);
5959
struct npl_funcs_t * npl_freertos_funcs_get(void);
6060
#endif
6161

0 commit comments

Comments
 (0)