From 38d999465f4cd2be978fb144af9efd3936d1a8a9 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Mon, 6 Jan 2020 10:49:38 +0100
Subject: [PATCH] clear IQ buffer upon restart

---
 old_protocol.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/old_protocol.c b/old_protocol.c
index a536b0e..f138735 100644
--- a/old_protocol.c
+++ b/old_protocol.c
@@ -1672,6 +1672,12 @@ static void metis_restart() {
   // reset current rx
   current_rx=0;
 
+  //
+  // When restarting, clear the IQ and audio samples
+  //
+  for(i=8;i<OZY_BUFFER_SIZE;i++) {
+    output_buffer[i]=0;
+  }
   // 
   // Some (older) HPSDR apps on the RedPitaya have very small
   // buffers that over-run if too much data is sent
@@ -1684,7 +1690,7 @@ static void metis_restart() {
     ozy_send_buffer();
   }
 
-  sleep(1);
+  usleep(250000L);
 
   // start the data flowing
   metis_start_stop(1);
-- 
2.45.2