Merge pull request #5957 from tannewt/esp_ble_forever_scan

Fix BLE scanning forever on ESP32-S3
This commit is contained in:
Dan Halbert 2022-01-31 20:55:48 -05:00 committed by GitHub
commit 17956a0204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -229,7 +229,12 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
disc_params.filter_policy = 0; disc_params.filter_policy = 0;
disc_params.limited = 0; disc_params.limited = 0;
CHECK_NIMBLE_ERROR(ble_gap_disc(own_addr_type, timeout * 1000, &disc_params, size_t duration_ms = timeout * 1000;
if (duration_ms == 0) {
duration_ms = BLE_HS_FOREVER;
}
CHECK_NIMBLE_ERROR(ble_gap_disc(own_addr_type, duration_ms, &disc_params,
_scan_event, self->scan_results)); _scan_event, self->scan_results));
return MP_OBJ_FROM_PTR(self->scan_results); return MP_OBJ_FROM_PTR(self->scan_results);