From 9fae15eb260bec57f94627f0e2c4ceb33b0f4d58 Mon Sep 17 00:00:00 2001 From: Anthony Doud Date: Fri, 7 Aug 2026 22:24:07 -0500 Subject: [PATCH 1/2] Initialize semaphore with braces in NimBLEUtils Fixes a connect crash in the client --- src/NimBLEUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NimBLEUtils.cpp b/src/NimBLEUtils.cpp index ec9767af..02f5b0a9 100644 --- a/src/NimBLEUtils.cpp +++ b/src/NimBLEUtils.cpp @@ -95,7 +95,7 @@ bool NimBLEUtils::taskWait(const TaskData& taskData, uint32_t timeout) { } if (taskData.m_pSem == nullptr) { - auto* sem = new ble_npl_sem; + auto* sem = new ble_npl_sem{}; if (ble_npl_sem_init(sem, 0) != BLE_NPL_OK) { NIMBLE_LOGE(LOG_TAG, "Failed to initialize semaphore for taskWait"); delete sem; From c1345be04f2e618f77807b6266a2a4d5e257f752 Mon Sep 17 00:00:00 2001 From: Anthony Doud Date: Fri, 21 Aug 2026 17:51:01 -0500 Subject: [PATCH 2/2] fix: handle nimble_port_init return value for ESP_PLATFORM --- src/NimBLEDevice.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index e125aeb9..ba64f6cb 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -983,7 +983,15 @@ bool NimBLEDevice::init(const std::string& deviceName) { # endif # endif # endif +# ifdef ESP_PLATFORM + esp_err_t rc = nimble_port_init(); + NIMBLE_LOGE(LOG_TAG, "nimble_port_init rc=%d, npl_funcs=%p", rc, npl_funcs); + if (rc != ESP_OK) { + return false; + } +# else nimble_port_init(); +# endif // Setup callbacks for host events ble_hs_cfg.reset_cb = NimBLEDevice::onReset;