From 2eca714a36af8e5334649ed75cba85cee7919f88 Mon Sep 17 00:00:00 2001
From: John Melton G0ORX <john.d.melton@googlemail.com>
Date: Thu, 26 Mar 2020 09:12:56 +0000
Subject: [PATCH] fixed references to transmitter when using bandstack with an
 RTLSDR

---
 vfo.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/vfo.c b/vfo.c
index f7823ca..88ddf3b 100644
--- a/vfo.c
+++ b/vfo.c
@@ -347,7 +347,9 @@ void vfo_bandstack_changed(int b) {
       receiver_vfo_changed(receiver[id]);
       BAND *band=band_get_band(vfo[id].band);
       set_alex_rx_antenna(band->alexRxAntenna);
-      set_alex_tx_antenna(band->alexTxAntenna);
+      if(can_transmit) {
+        set_alex_tx_antenna(band->alexTxAntenna);
+      }
       set_alex_attenuation(band->alexAttenuation);
       receiver_vfo_changed(receiver[0]);
       break;
@@ -360,14 +362,14 @@ void vfo_bandstack_changed(int b) {
 
   if(can_transmit) {
     tx_set_mode(transmitter,get_tx_mode());
-  }
-  //
-  // I do not think the band can change within this function.
-  // But out of paranoia, I consider this possiblity here
-  //
-  calcDriveLevel();  // sends HighPrio packet if in new protocol
-  if (protocol == NEW_PROTOCOL) {
-    schedule_general();		// for PA disable
+    //
+    // I do not think the band can change within this function.
+    // But out of paranoia, I consider this possiblity here
+    //
+    calcDriveLevel();  // sends HighPrio packet if in new protocol
+    if (protocol == NEW_PROTOCOL) {
+      schedule_general();		// for PA disable
+    }
   }
   g_idle_add(ext_vfo_update,NULL);
 
-- 
2.45.2