From: c vw <dl1ycf@darc.de>
Date: Mon, 21 Sep 2020 15:56:46 +0000 (+0200)
Subject: Don't release PTT automatically in keyer if it had been engaged before.
X-Git-Url: https://git.rkrishnan.org/simplejson/htmlfontify-example.html?a=commitdiff_plain;h=871fdf1a26b4efad7fd98405adcb0061c720af2e;p=pihpsdr.git

Don't release PTT automatically in keyer if it had been engaged before.
---

diff --git a/iambic.c b/iambic.c
index e3aa4f5..f60444d 100644
--- a/iambic.c
+++ b/iambic.c
@@ -335,6 +335,7 @@ static void* keyer_thread(void *arg) {
     int kdelay;
     int old_volume;
     int txmode;
+    int moxbefore;
 
     fprintf(stderr,"keyer_thread  state running= %d\n", running);
     while(running) {
@@ -359,6 +360,10 @@ static void* keyer_thread(void *arg) {
 
 	// check mode: to not induce RX/TX transition if not in CW mode
         txmode=get_tx_mode();
+        moxbefore=mox;
+        // Trigger VOX if CAT CW was active and we have interrupted it by hitting a key
+        if (enforce_cw_vox) moxbefore=0;
+
         if (cw_breakin && (txmode == modeCWU || txmode == modeCWL)) {
           //
           // Possibly we are still in a TX/RX transition from the end of the last
@@ -374,8 +379,6 @@ static void* keyer_thread(void *arg) {
           while ((!mox || cw_not_ready) && i-- > 0) usleep(1000L);
           cwvox=(int) cw_keyer_hang_time;
 	}
-	// Trigger VOX if CAT CW was active and we have interrupted it by hitting a key
-	if (enforce_cw_vox) cwvox=(int) cw_keyer_hang_time;
 
         key_state = CHECK;
 
@@ -397,7 +400,7 @@ static void* keyer_thread(void *arg) {
 		// If CW-vox still hanging, continue "busy-spinning"
                 if (cwvox == 0) {
 		    // we have just reduced cwvox from 1 to 0.
-		    g_idle_add(ext_mox_update,(gpointer)(long) 0);
+		    if (!moxbefore) g_idle_add(ext_mox_update,(gpointer)(long) 0);
 		} else {
 		    key_state=CHECK;
 		}