From 77c578171c9ceb8c4b331bfad1f1bc22e0657e51 Mon Sep 17 00:00:00 2001 From: Rahix Date: Sat, 25 Apr 2026 16:07:45 +0200 Subject: [PATCH 1/2] fdl: active: Fix GAP polling when NS==TS Ensure the active station does not poll itself when the next_station is also the active station itself (= it is alone on the bus). Fixes: 05150b926295 ("fdl: active: Ensure GAP never scans own address") --- src/fdl/active.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fdl/active.rs b/src/fdl/active.rs index 674b5bc..5eb2434 100644 --- a/src/fdl/active.rs +++ b/src/fdl/active.rs @@ -666,6 +666,9 @@ impl FdlActiveStation { if next_address >= next_station && next_station > self.p.address { // We have reached the end of the GAP, enter waiting state. GapState::Waiting { rotation_count: 0 } + } else if next_address == next_station && next_station == self.p.address { + // We have reached the end of the GAP, enter waiting state (NS==TS case). + GapState::Waiting { rotation_count: 0 } } else if next_address >= next_station && next_station < self.p.address && next_address < self.p.address From dcd13333224014e1ad1fc1fd6eb4bee6497d13ae Mon Sep 17 00:00:00 2001 From: Rahix Date: Sat, 25 Apr 2026 16:10:04 +0200 Subject: [PATCH 2/2] fdl: tests: Add test for single active station GAP polling Catch any self-polling issues when an active station is alone on the bus and polls the full address space itself. --- src/fdl/test_active.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/fdl/test_active.rs b/src/fdl/test_active.rs index 2102f11..2c16988 100644 --- a/src/fdl/test_active.rs +++ b/src/fdl/test_active.rs @@ -535,6 +535,25 @@ fn two_rotations_before_ready() { fdl_ut.wait_for_matching(|t| t == fdl::Telegram::Token(fdl::TokenTelegram { da: 15, sa: 7 })); } +/// Test that an active station polls all its GAP fine +#[test] +fn active_station_full_gap_scanned() { + crate::test_utils::prepare_test_logger(); + let mut fdl_ut = FdlActiveUnderTest::new(7); + + for addr in [8, 3, 6, 8, 11] { + fdl_ut.wait_for_matching(|t| { + if let fdl::Telegram::Data(data_telegram) = t { + data_telegram.is_fdl_status_request().is_some() + && data_telegram.h.da == addr + && data_telegram.h.sa == 7 + } else { + false + } + }); + } +} + /// Test that an active station discovers another active neighbor station. #[test] fn active_station_discovers_neighbor() {