From 72b814f7fde8e9ab95891425fb2355ebeeaab62b Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 4 Jul 2024 16:59:35 +0800 Subject: [PATCH] repeater: clear buffer after ping --- src/satman/src/repeater.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/satman/src/repeater.rs b/src/satman/src/repeater.rs index 8c00e586..9ebc9b7a 100644 --- a/src/satman/src/repeater.rs +++ b/src/satman/src/repeater.rs @@ -87,6 +87,10 @@ 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); + let max_time = timer.get_time() + Milliseconds(200); + while timer.get_time() < max_time { + let _ = drtioaux::recv(self.auxno); + } self.state = RepeaterState::Up; if let Err(e) = self.sync_tsc(timer) { error!("[REP#{}] failed to sync TSC ({:?})", self.repno, e);