Bluetooth: Controller: Fix CTE req periodically after req is disabled

There is an error in the condition that checks if new CTE_REQ should
be started after end of connection event. The condition verifies if
counter req_expire is set to zero. Then new CTE_REQ is started
irrespectively to CTE_REQ being disabled.

req_interval is used to store information if the CTE_REQ is:
- periodic, then value doesn't equal zero,
- single shot or disabled, then value equals zero.

The condition should verify if the req_interval is not zero and
req_expire is not zero. The second part of the if condition is
required to avoid starting next CTE_REQ until last one has been
completed.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2022-04-01 14:30:06 +02:00 committed by Maureen Helm
commit 1004c30507

View file

@ -1652,12 +1652,18 @@ void ull_conn_done(struct node_rx_event_done *done)
#endif /* CONFIG_BT_CTLR_LE_PING */
#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_REQ)
if (conn->llcp.cte_req.req_expire != 0U) {
/* Check if the CTE_REQ procedure is periodic and counter has been started.
* req_expire is set when: new CTE_REQ is started, after completion of last periodic run.
*/
if (conn->llcp.cte_req.req_interval != 0U && conn->llcp.cte_req.req_expire != 0U) {
if (conn->llcp.cte_req.req_expire > elapsed_event) {
conn->llcp.cte_req.req_expire -= elapsed_event;
} else {
uint8_t err;
/* Set req_expire to zero to mark that new periodic CTE_REQ was started.
* The counter is re-started after completion of this run.
*/
conn->llcp.cte_req.req_expire = 0U;
err = ull_cp_cte_req(conn, conn->llcp.cte_req.min_cte_len,