From 55f4ee4bac11d1c4041e90717532f75bbde67c73 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Tue, 22 Feb 2022 15:06:25 +0100
Subject: [PATCH] Handle case where CW key-down arrives before RX/TX transition
 is complete.

---
 transmitter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/transmitter.c b/transmitter.c
index 719439c..d148fff 100644
--- a/transmitter.c
+++ b/transmitter.c
@@ -1497,7 +1497,7 @@ void add_mic_sample(TRANSMITTER *tx,float mic_sample) {
 //
 	cw_not_ready=1;
 	cw_key_up=0;
-	cw_key_down=0;
+	if (cw_key_down > 0) cw_key_down--;  // in case it occured before the RX/TX transition
 	cw_shape=0;
         // insert "silence" in CW audio and TX IQ buffers
   	cw_shape_buffer48[tx->samples]=0.0;
-- 
2.45.2