]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Possibly switch antennas if changing the receiver or changing the split state.
authorc vw <dl1ycf@darc.de>
Wed, 13 May 2020 14:52:31 +0000 (16:52 +0200)
committerc vw <dl1ycf@darc.de>
Wed, 13 May 2020 14:52:31 +0000 (16:52 +0200)
ext.c
receiver.c

diff --git a/ext.c b/ext.c
index 29a0c779d091ad2b311326c562b79decdf13ad48..f45dc35fe569e2cd3f1212c16260e0cfb1430111 100644 (file)
--- a/ext.c
+++ b/ext.c
@@ -551,9 +551,18 @@ int ext_agc_update(void *data) {
 }
 
 int ext_split_toggle(void *data) {
+  BAND *band;
   if(can_transmit) {
     split=split==1?0:1;
     tx_set_mode(transmitter,get_tx_mode());
+    //
+    // Since the TX band possibly changed, we have to 
+    // adjust the TX antenna
+    //
+    band=band_get_band(vfo[get_tx_vfo()].band);
+    set_alex_tx_antenna(band->alexTxAntenna);
+    g_print("transmitter TxAnt=%d\n", band->alexTxAntenna);
+
     g_idle_add(ext_vfo_update, NULL);
   }
   return 0;
index 1ff8c4b869941eb33d4d5c70c0d701ad0c6a6634..6829d9d1e3850276780e596cb2bc2504b08f07a6 100644 (file)
@@ -87,6 +87,8 @@ gboolean receiver_button_press_event(GtkWidget *widget, GdkEventButton *event, g
 
 gboolean receiver_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) {
   RECEIVER *rx=(RECEIVER *)data;
+  BAND *band;
+  int  id;
   if(making_active) {
     active_receiver=rx;
     making_active=FALSE;
@@ -101,6 +103,17 @@ gboolean receiver_button_release_event(GtkWidget *widget, GdkEventButton *event,
     // setup the transmitter mode and filter
     tx_set_mode(transmitter,get_tx_mode());
 
+    // set RX antenna
+    id=active_receiver->id;
+    band=band_get_band(vfo[id].band);
+    set_alex_rx_antenna(band->alexRxAntenna);
+    g_print("receiver: %d RxAnt=%d\n", id, band->alexRxAntenna);
+
+    // set TX antenna
+    band=band_get_band(vfo[get_tx_vfo()].band);
+    set_alex_tx_antenna(band->alexTxAntenna);
+    g_print("transmitter TxAnt=%d\n", band->alexTxAntenna);
+
     //g_print("receiver: %d adc=%d attenuation=%d rx_gain_calibration=%d\n",rx->id,rx->adc,adc_attenuation[rx->adc],rx_gain_calibration);
   } else {
     if(pressed) {