From e7faca81fc65d453ce5a7f748fda835a39fbec9a Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 4 Jul 2024 16:47:20 +0800 Subject: [PATCH] repeater: clear buffer after ping --- artiq/firmware/satman/repeater.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/artiq/firmware/satman/repeater.rs b/artiq/firmware/satman/repeater.rs index cd18badc2..7617e0e98 100644 --- a/artiq/firmware/satman/repeater.rs +++ b/artiq/firmware/satman/repeater.rs @@ -75,6 +75,11 @@ impl Repeater { if rep_link_rx_up(self.repno) { if let Ok(Some(drtioaux::Packet::EchoReply)) = drtioaux::recv(self.auxno) { info!("[REP#{}] remote replied after {} packets", self.repno, ping_count); + // clear the aux buffer + let max_time = clock::get_ms() + 200; + while clock::get_ms() < max_time { + let _ = drtioaux::recv(self.auxno); + } self.state = RepeaterState::Up; if let Err(e) = self.sync_tsc() { error!("[REP#{}] failed to sync TSC ({})", self.repno, e);