From b807321d1b9ab8d825f7b4c773d77cde1032d1ba Mon Sep 17 00:00:00 2001 From: h2zero Date: Tue, 12 Jan 2021 13:59:49 -0700 Subject: [PATCH] NimBLEDevice::onSync should call taskYIELD() before returning. This change is needed to allow any tasks that were stopped during a host reset to finish before resuming from the re-sync. This would occasionally result in a LoadStoreError exception if not done. --- src/NimBLEDevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/NimBLEDevice.cpp b/src/NimBLEDevice.cpp index 4ea8020..4598313 100644 --- a/src/NimBLEDevice.cpp +++ b/src/NimBLEDevice.cpp @@ -446,6 +446,10 @@ void NimBLEDevice::stopAdvertising() { int rc = ble_hs_util_ensure_addr(0); assert(rc == 0); + // Yield for houskeeping before returning to operations. + // Occasionally triggers exception without. + taskYIELD(); + m_synced = true; if(initialized) {