@@ -339,6 +339,7 @@ uint8_t ll_adv_params_set(uint16_t interval, uint8_t adv_type,
339339 is_new_set = !adv -> is_created ;
340340 adv -> is_created = 1 ;
341341 adv -> is_ad_data_cmplt = 1U ;
342+ adv -> max_skip = skip ;
342343#endif /* CONFIG_BT_CTLR_ADV_EXT */
343344
344345 /* remember parameters so that set adv/scan data and adv enable
@@ -1391,6 +1392,7 @@ uint8_t ll_adv_enable(uint8_t enable)
13911392 struct lll_adv_aux * lll_aux = lll -> aux ;
13921393 uint32_t ticks_slot_overhead_aux ;
13931394 uint32_t ticks_anchor_aux ;
1395+ uint64_t interval_us ;
13941396
13951397 aux = HDR_LLL2ULL (lll_aux );
13961398
@@ -1487,20 +1489,29 @@ uint8_t ll_adv_enable(uint8_t enable)
14871489 }
14881490#endif /* CONFIG_BT_CTLR_ADV_PERIODIC */
14891491
1490- /* Keep aux interval equal or higher than primary PDU
1491- * interval.
1492+ /* Keep aux interval equal or lower than primary PDU
1493+ * interval * (max_skip + 1) .
14921494 * Use periodic interval units to represent the
14931495 * periodic behavior of scheduling of AUX_ADV_IND PDUs
14941496 * so that it is grouped with similar interval units
14951497 * used for ACL Connections, Periodic Advertising and
14961498 * BIG radio events.
14971499 */
1498- aux -> interval =
1499- DIV_ROUND_UP (((uint64_t )adv -> interval *
1500- ADV_INT_UNIT_US ) +
1501- HAL_TICKER_TICKS_TO_US (
1502- ULL_ADV_RANDOM_DELAY ),
1503- PERIODIC_INT_UNIT_US );
1500+ interval_us = (uint64_t )adv -> interval * ADV_INT_UNIT_US ;
1501+
1502+ if (adv -> max_skip == 0U ) {
1503+ /* Special case to keep behaviour unchanged from
1504+ * before max_skip was implemented; In this case
1505+ * add ULL_ADV_RANDOM_DELAY and round up for a
1506+ * aux interval equal or higher instead
1507+ */
1508+ aux -> interval = DIV_ROUND_UP (interval_us +
1509+ HAL_TICKER_TICKS_TO_US (ULL_ADV_RANDOM_DELAY ),
1510+ PERIODIC_INT_UNIT_US );
1511+ } else {
1512+ aux -> interval = (interval_us * (adv -> max_skip + 1 ))
1513+ / PERIODIC_INT_UNIT_US ;
1514+ }
15041515
15051516 ret = ull_adv_aux_start (aux , ticks_anchor_aux ,
15061517 ticks_slot_overhead_aux );
0 commit comments