From: c vw Date: Tue, 31 Mar 2020 09:54:08 +0000 (+0200) Subject: SOAPY fixes. X-Git-Url: https://git.rkrishnan.org/pf/content/reliability?a=commitdiff_plain;h=d871a0ba6a9a4e03a3a244e68c6d91b5862c065a;p=pihpsdr.git SOAPY fixes. --- diff --git a/ant_menu.c b/ant_menu.c index be686d7..9713995 100644 --- a/ant_menu.c +++ b/ant_menu.c @@ -77,7 +77,7 @@ static void adc0_antenna_cb(GtkComboBox *widget,gpointer data) { if(radio->protocol==NEW_PROTOCOL) { schedule_high_priority(); #ifdef SOAPYSDR - } else if(radio->device==SOAPYSDR_USB_DEVICE) { + } else if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { soapy_protocol_set_rx_antenna(receiver[0],adc[0].antenna); #endif } @@ -89,7 +89,7 @@ static void dac0_antenna_cb(GtkComboBox *widget,gpointer data) { if(radio->protocol==NEW_PROTOCOL) { schedule_high_priority(); #ifdef SOAPYSDR - } else if(radio->device==SOAPYSDR_USB_DEVICE) { + } else if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { soapy_protocol_set_tx_antenna(transmitter,dac->antenna); #endif } @@ -331,7 +331,7 @@ void ant_menu(GtkWidget *parent) { gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1); #ifdef SOAPYSDR - if(radio->device!=SOAPYSDR_USB_DEVICE) { + if(radio->protocol != SOAPYSDR_PROTOCOL || radio->device!=SOAPYSDR_USB_DEVICE) { #endif GtkWidget *hf_rb=gtk_radio_button_new_with_label(NULL,"HF"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hf_rb),TRUE); @@ -432,7 +432,7 @@ void ant_menu(GtkWidget *parent) { } #ifdef SOAPYSDR - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { int i; g_print("rx_antennas=%ld\n",radio->info.soapy.rx_antennas); diff --git a/discovery.c b/discovery.c index 64973ec..d46ec19 100644 --- a/discovery.c +++ b/discovery.c @@ -490,7 +490,7 @@ fprintf(stderr,"%p Protocol=%d name=%s\n",d,d->protocol,d->name); } #ifdef SOAPYSDR - if(d->device!=SOAPYSDR_USB_DEVICE) { + if(d->protocol != SOAPYSDR_PROTOCOL || d->device!=SOAPYSDR_USB_DEVICE) { #endif // if not on the same subnet then cannot start it if((d->info.network.interface_address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr) != (d->info.network.address.sin_addr.s_addr&d->info.network.interface_netmask.sin_addr.s_addr)) { diff --git a/radio.c b/radio.c index 19f6698..8e97e4c 100644 --- a/radio.c +++ b/radio.c @@ -857,7 +857,7 @@ void start_radio() { iqswap=0; #ifdef SOAPYSDR - if(device==SOAPYSDR_USB_DEVICE) { + if(protocol == SOAPYSDR_PROTOCOL && device==SOAPYSDR_USB_DEVICE) { iqswap=1; receivers=1; } @@ -880,17 +880,19 @@ void start_radio() { adc[0].preamp=FALSE; adc[0].attenuation=0; #ifdef SOAPYSDR - adc[0].antenna=0; - if(device==SOAPYSDR_USB_DEVICE) { - adc[0].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint)); - for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) { - adc[0].rx_gain[i]=0; - } - adc[0].agc=FALSE; - dac[0].antenna=1; - dac[0].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint)); - for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) { - dac[0].tx_gain[i]=0; + if (protocol == SOAPYSDR_PROTOCOL) { + adc[0].antenna=0; + if(device==SOAPYSDR_USB_DEVICE) { + adc[0].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint)); + for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) { + adc[0].rx_gain[i]=0; + } + adc[0].agc=FALSE; + dac[0].antenna=1; + dac[0].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint)); + for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) { + dac[0].tx_gain[i]=0; + } } } #endif @@ -904,21 +906,23 @@ void start_radio() { adc[1].preamp=FALSE; adc[1].attenuation=0; #ifdef SOAPYSDR - adc[1].antenna=0; - if(device==SOAPYSDR_USB_DEVICE) { - adc[1].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint)); - for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) { - adc[1].rx_gain[i]=0; - } - adc[1].agc=FALSE; + if (protocol == SOAPYSDR_PROTOCOL) { + adc[1].antenna=0; + if(device==SOAPYSDR_USB_DEVICE) { + adc[1].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint)); + for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) { + adc[1].rx_gain[i]=0; + } + adc[1].agc=FALSE; - dac[1].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint)); - for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) { - dac[1].tx_gain[i]=0; + dac[1].tx_gain=malloc(radio->info.soapy.tx_gains*sizeof(gint)); + for (size_t i = 0; i < radio->info.soapy.tx_gains; i++) { + dac[1].tx_gain[i]=0; + } } - } - radio_sample_rate=radio->info.soapy.sample_rate; + radio_sample_rate=radio->info.soapy.sample_rate; + } #endif //g_print("meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration); @@ -2013,7 +2017,7 @@ g_print("radioRestoreState: %s\n",property_path); if(value) mute_rx_while_transmitting=atoi(value); #ifdef SOAPYSDR - if(device==SOAPYSDR_USB_DEVICE) { + if(protocol == SOAPYSDR_PROTOCOL && device==SOAPYSDR_USB_DEVICE) { char name[128]; for(int i=0;iinfo.soapy.rx_gains;i++) { sprintf(name,"radio.adc[0].rx_gain.%s",radio->info.soapy.rx_gain[i]) ; @@ -2237,7 +2241,7 @@ g_print("radioSaveState: %s\n",property_path); setProperty("rx_gain_calibration",value); #ifdef SOAPYSDR - if(device==SOAPYSDR_USB_DEVICE) { + if(protocol == SOAPYSDR_PROTOCOL && device==SOAPYSDR_USB_DEVICE) { char name[128]; for(int i=0;iinfo.soapy.rx_gains;i++) { sprintf(name,"radio.adc[0].rx_gain.%s",radio->info.soapy.rx_gain[i]); diff --git a/radio_menu.c b/radio_menu.c index db99059..7db3620 100644 --- a/radio_menu.c +++ b/radio_menu.c @@ -80,7 +80,7 @@ static void rf_gain_value_changed_cb(GtkWidget *widget, gpointer data) { ADC *adc=(ADC *)data; active_receiver->rf_gain=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget)); - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { soapy_protocol_set_gain(receiver[0],active_receiver->rf_gain); } @@ -96,7 +96,7 @@ static void rf_gain_value_changed_cb(GtkWidget *widget, gpointer data) { static void rx_gain_value_changed_cb(GtkWidget *widget, gpointer data) { ADC *adc=(ADC *)data; int gain; - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { gain=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); soapy_protocol_set_gain_element(receiver[0],(char *)gtk_widget_get_name(widget),gain); @@ -114,7 +114,7 @@ static void rx_gain_value_changed_cb(GtkWidget *widget, gpointer data) { static void drive_gain_value_changed_cb(GtkWidget *widget, gpointer data) { DAC *dac=(DAC *)data; - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { transmitter->drive=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); soapy_protocol_set_tx_gain(transmitter,(double)transmitter->drive); /* @@ -129,7 +129,7 @@ static void drive_gain_value_changed_cb(GtkWidget *widget, gpointer data) { static void tx_gain_value_changed_cb(GtkWidget *widget, gpointer data) { DAC *dac=(DAC *)data; int gain; - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { gain=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); soapy_protocol_set_tx_gain_element(transmitter,(char *)gtk_widget_get_name(widget),gain); /* @@ -154,7 +154,7 @@ static void agc_changed_cb(GtkWidget *widget, gpointer data) { static void dac0_gain_value_changed_cb(GtkWidget *widget, gpointer data) { DAC *dac=(DAC *)data; int gain; - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { gain=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); soapy_protocol_set_tx_gain_element(radio->transmitter,(char *)gtk_widget_get_name(widget),gain); for(int i=0;idiscovered->info.soapy.tx_gains;i++) { @@ -778,7 +778,7 @@ void radio_menu(GtkWidget *parent) { #ifdef SOAPYSDR col=0; - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { int i; /* if(radio->info.soapy.rx_gains>0) { diff --git a/receiver.c b/receiver.c index 8ae57f2..1ff8c4b 100644 --- a/receiver.c +++ b/receiver.c @@ -916,7 +916,7 @@ fprintf(stderr,"create_receiver: id=%d buffer_size=%d fft_size=%d pixels=%d fps= } fprintf(stderr,"create_receiver: id=%d default adc=%d\n",rx->id, rx->adc); #ifdef SOAPYSDR - if(radio->device==SOAPYSDR_USB_DEVICE) { + if(radio->protocol == SOAPYSDR_PROTOCOL && radio->device==SOAPYSDR_USB_DEVICE) { rx->sample_rate=radio->info.soapy.sample_rate; rx->resampler=NULL; rx->resample_buffer=NULL; diff --git a/rigctl.c b/rigctl.c index 2152914..e55d226 100644 --- a/rigctl.c +++ b/rigctl.c @@ -1165,10 +1165,9 @@ void parse_cmd ( char * cmd_input,int len,int client_sock) { fprintf(stderr,"RIGCTL: BD - current band=%d\n",cur_band); #endif if(cur_band == 0) { + cur_band = band6; #ifdef SOAPYSDR - cur_band = band472; - #else - cur_band = band6; + if (radio->protocol == SOAPYSDR_PROTOCOL) cur_band = band472; #endif } else { --cur_band;