From 622678051611317af500cfe5a673c3f6cf9cfbfd Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Fri, 2 Aug 2024 15:29:51 +0530 Subject: [PATCH] fix(nimble): Fixed assert issue in proximity_sensor example --- .../proximity_sensor_prph/main/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c index 835d636213c..f66f74f18bf 100644 --- a/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c +++ b/examples/bluetooth/nimble/ble_proximity_sensor/proximity_sensor_prph/main/main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -183,12 +183,14 @@ ble_prox_prph_gap_event(struct ble_gap_event *event, void *arg) event->connect.status == 0 ? "established" : "failed", event->connect.status); - /* resume advertising */ + if (event->connect.status != 0) { + /* Connection failed, resume advertising */ #if CONFIG_EXAMPLE_EXTENDED_ADV - ext_ble_prox_prph_advertise(); + ext_ble_prox_prph_advertise(); #else - ble_prox_prph_advertise(); + ble_prox_prph_advertise(); #endif + } break; case BLE_GAP_EVENT_DISCONNECT: