Skip to content

Commit b76d3f3

Browse files
olivier-le-sagecarlescufi
authored andcommitted
bluetooth: services: Set RTT estimate to NAN if negative
With the new MLT 2.1 metal fix we've observed that changes in internal delays have caused us to produce negative TOF in some cases. It's not possible for users to make sense of such results. To avoid confusion we should set these as bad. Signed-off-by: Olivier Lesage <[email protected]> (cherry picked from commit 4e15fed)
1 parent c4bf2c7 commit b76d3f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/bluetooth/cs_de/cs_de.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ static void calculate_dist_rtt(cs_de_report_t *p_report)
272272
float rtt_distance_m = tof_ns * (SPEED_OF_LIGHT_M_PER_S / 1e9f);
273273

274274
for (uint8_t ap = 0; ap < p_report->n_ap; ap++) {
275-
p_report->distance_estimates[ap].rtt = rtt_distance_m;
275+
if (rtt_distance_m >= 0.0f) {
276+
p_report->distance_estimates[ap].rtt = rtt_distance_m;
277+
}
276278
}
277279
}
278280
}

0 commit comments

Comments
 (0)