From 5f2b9d4406d53a0ce5ba83ae4bdb3150b93e0e36 Mon Sep 17 00:00:00 2001 From: c vw Date: Wed, 13 May 2020 16:52:31 +0200 Subject: [PATCH] Possibly switch antennas if changing the receiver or changing the split state. --- ext.c | 9 +++++++++ receiver.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ext.c b/ext.c index 29a0c77..f45dc35 100644 --- 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; diff --git a/receiver.c b/receiver.c index 1ff8c4b..6829d9d 100644 --- a/receiver.c +++ b/receiver.c @@ -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) { -- 2.45.2