Commit 2ae755d9 authored by Jim Mussared's avatar Jim Mussared Committed by Damien George

extmod/modbluetooth_nimble: Make gap_scan_stop no-op if no scan ongoing.

No need for this to throw an exception if the intent (don't be scanning) is
clear, and avoids a race with the scan duration timeout.
parent d19c6d05
......@@ -659,6 +659,9 @@ int mp_bluetooth_gap_scan_start(int32_t duration_ms, int32_t interval_us, int32_
}
int mp_bluetooth_gap_scan_stop(void) {
if (!ble_gap_disc_active()) {
return 0;
}
int err = ble_gap_disc_cancel();
if (err == 0) {
mp_bluetooth_gap_on_scan_complete();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment