Merge pull request #12984 from haukepetersen/opt_nimble_autoconnstartup

pkg/nimble/autoconn: add startup delay
This commit is contained in:
Hauke Petersen 2019-12-18 17:04:52 +01:00 committed by GitHub
commit dd8eb4b7cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,8 +284,11 @@ void nimble_autoconn_enable(void)
{ {
DEBUG("[autoconn] ACTIVE\n"); DEBUG("[autoconn] ACTIVE\n");
if (nimble_netif_conn_count(NIMBLE_NETIF_UNUSED) > 0) { if (nimble_netif_conn_count(NIMBLE_NETIF_UNUSED) > 0) {
/* insert a random delay */
ble_npl_time_t delay = (ble_npl_time_t)random_uint32_range(0,
(uint32_t)_period_jitter);
_state = STATE_ADV; _state = STATE_ADV;
_on_state_change(NULL); ble_npl_callout_reset(&_state_evt, delay);
} }
} }