From 5367a4fe2e9be9737c51bcea727ca4b6bd5ad5ad Mon Sep 17 00:00:00 2001 From: Henri Chataing Date: Fri, 21 Jun 2024 16:15:59 -0700 Subject: [PATCH] Do not generate ranging measurements for out of range devices The change caf8a03114162afebe18fc8fd5a951beadf856b3 was incomplete. --- src/lib.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f8260b1..cf2c480 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -445,14 +445,18 @@ impl Pica { .app_config .device_mac_address .unwrap(); - let local = self + let Some(local) = self .ranging_estimator .estimate(&device.handle, &peer_device.handle) - .unwrap_or(Default::default()); - let remote = self + else { + continue; + }; + let Some(remote) = self .ranging_estimator .estimate(&peer_device.handle, &device.handle) - .unwrap_or(Default::default()); + else { + continue; + }; measurements.push(make_measurement(&peer_mac_address, local, remote)); }