From 0172cb4b394949e89ebe1d79b4a9787b481d890c Mon Sep 17 00:00:00 2001 From: h2zero Date: Mon, 14 Apr 2025 08:52:32 -0600 Subject: [PATCH] Only ignore scan discovery events when scan is stopped. --- src/NimBLEScan.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/NimBLEScan.cpp b/src/NimBLEScan.cpp index bae4b4f..20808ba 100644 --- a/src/NimBLEScan.cpp +++ b/src/NimBLEScan.cpp @@ -54,14 +54,14 @@ int NimBLEScan::handleGapEvent(ble_gap_event* event, void* arg) { (void)arg; NimBLEScan* pScan = NimBLEDevice::getScan(); - if (!pScan->isScanning()) { - NIMBLE_LOGI(LOG_TAG, "Scan stopped, ignoring event"); - return 0; - } - switch (event->type) { case BLE_GAP_EVENT_EXT_DISC: case BLE_GAP_EVENT_DISC: { + if (!pScan->isScanning()) { + NIMBLE_LOGI(LOG_TAG, "Scan stopped, ignoring event"); + return 0; + } + # if CONFIG_BT_NIMBLE_EXT_ADV const auto& disc = event->ext_disc; const bool isLegacyAdv = disc.props & BLE_HCI_ADV_LEGACY_MASK; @@ -488,11 +488,11 @@ void NimBLEScan::clearResults() { * @brief Dump the scan results to the log. */ void NimBLEScanResults::dump() const { -#if CONFIG_NIMBLE_CPP_LOG_LEVEL >=3 +# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3 for (const auto& dev : m_deviceVec) { NIMBLE_LOGI(LOG_TAG, "- %s", dev->toString().c_str()); } -#endif +# endif } // dump /**