File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -889,17 +889,19 @@ int mp_bluetooth_gap_disconnect(uint16_t conn_handle) {
889
889
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
890
890
STATIC btstack_timer_source_t scan_duration_timeout ;
891
891
892
- STATIC void hci_initialization_timeout_handler (btstack_timer_source_t * ds ) {
892
+ STATIC void scan_duration_timeout_handler (btstack_timer_source_t * ds ) {
893
893
(void )ds ;
894
894
mp_bluetooth_gap_scan_stop ();
895
895
}
896
896
897
897
int mp_bluetooth_gap_scan_start (int32_t duration_ms , int32_t interval_us , int32_t window_us ) {
898
898
DEBUG_EVENT_printf ("mp_bluetooth_gap_scan_start\n" );
899
899
900
- btstack_run_loop_set_timer (& scan_duration_timeout , duration_ms );
901
- btstack_run_loop_set_timer_handler (& scan_duration_timeout , hci_initialization_timeout_handler );
902
- btstack_run_loop_add_timer (& scan_duration_timeout );
900
+ if (duration_ms > 0 ) {
901
+ btstack_run_loop_set_timer (& scan_duration_timeout , duration_ms );
902
+ btstack_run_loop_set_timer_handler (& scan_duration_timeout , scan_duration_timeout_handler );
903
+ btstack_run_loop_add_timer (& scan_duration_timeout );
904
+ }
903
905
904
906
// 0 = passive scan (we don't handle scan response).
905
907
gap_set_scan_parameters (0 , interval_us / 625 , window_us / 625 );
You can’t perform that action at this time.
0 commit comments