From 686a2af49652a8f60eec4793d8a272373e4321dc Mon Sep 17 00:00:00 2001 From: John Melton G0ORX Date: Wed, 16 Oct 2019 18:24:04 +0100 Subject: [PATCH] Fixed SOAPYSDR references when not defined --- Makefile | 4 ++-- audio.c | 2 ++ discovered.h | 2 ++ radio.c | 2 +- receiver.c | 4 ++++ rx_panadapter.c | 2 +- soapy_discovery.c | 2 ++ vfo.c | 5 +++-- 8 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9884a92..f7f7a39 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ PURESIGNAL_INCLUDE=PURESIGNAL #PI_SDR_INCLUDE=PI_SDR # uncomment the line below to include MIDI support -#MIDI_INCLUDE=MIDI +MIDI_INCLUDE=MIDI #uncomment the line below for the platform being compiled on (actually not used) UNAME_N=raspberrypi @@ -109,7 +109,7 @@ RADIOBERRY_OPTIONS=-D RADIOBERRY endif # uncomment the line below for SoapySDR -SOAPYSDR_INCLUDE=SOAPYSDR +#SOAPYSDR_INCLUDE=SOAPYSDR ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR) SOAPYSDR_OPTIONS=-D SOAPYSDR diff --git a/audio.c b/audio.c index 2028e32..c54facb 100644 --- a/audio.c +++ b/audio.c @@ -200,9 +200,11 @@ fprintf(stderr,"audio_open_input: %d\n",transmitter->input_device); case NEW_PROTOCOL: mic_buffer_size = 64; break; +#ifdef SOAPYSDR case SOAPYSDR_PROTOCOL: mic_buffer_size = 720; break; +#endif default: break; } diff --git a/discovered.h b/discovered.h index fcff683..617164d 100644 --- a/discovered.h +++ b/discovered.h @@ -109,6 +109,8 @@ struct _DISCOVERED { #ifdef SOAPYSDR struct soapy { char version[128]; + char hardware_key[64]; + char driver_key[64]; int rtlsdr_count; int sample_rate; size_t rx_channels; diff --git a/radio.c b/radio.c index 43fd88a..8e0ad6f 100644 --- a/radio.c +++ b/radio.c @@ -387,11 +387,11 @@ void start_radio() { #ifdef SOAPYSDR case SOAPYSDR_PROTOCOL: can_transmit=(radio->info.soapy.tx_channels!=0); + g_print("start_radio: can_transmit=%d tx_channels=%d\n",can_transmit,radio->info.soapy.tx_channels); break; #endif } - g_print("start_radio: can_transmit=%d tx_channels=%d\n",can_transmit,radio->info.soapy.tx_channels); #ifdef MIDI MIDIstartup(); diff --git a/receiver.c b/receiver.c index 524ff11..411e385 100644 --- a/receiver.c +++ b/receiver.c @@ -1011,7 +1011,11 @@ fprintf(stderr,"create_receiver: id=%d default adc=%d\n",rx->id, rx->adc); receiver_restore_state(rx); +#ifdef SOAPYSDR rx->resample_step=radio->info.soapy.sample_rate/rx->sample_rate; +#else + rx->resample_step=1; +#endif fprintf(stderr,"create_receiver (after restore): rx=%p id=%d local_audio=%d\n",rx,rx->id,rx->local_audio); int scale=rx->sample_rate/48000; diff --git a/rx_panadapter.c b/rx_panadapter.c index ad36311..58c942b 100644 --- a/rx_panadapter.c +++ b/rx_panadapter.c @@ -223,7 +223,7 @@ void rx_panadapter_update(RECEIVER *rx) { // filter - cairo_set_source_rgba (cr, 0.75, 0.75, 0.00, 0.75); + cairo_set_source_rgba (cr, 0.50, 0.50, 0.50, 0.75); filter_left =-cwshift+(double)display_width/2.0+(((double)rx->filter_low+vfo[rx->id].offset)/rx->hz_per_pixel); filter_right=-cwshift+(double)display_width/2.0+(((double)rx->filter_high+vfo[rx->id].offset)/rx->hz_per_pixel); cairo_rectangle(cr, filter_left, 0.0, filter_right-filter_left, (double)display_height); diff --git a/soapy_discovery.c b/soapy_discovery.c index 7c46202..4280a7e 100644 --- a/soapy_discovery.c +++ b/soapy_discovery.c @@ -196,6 +196,8 @@ static void get_info(char *driver) { discovered[devices].software_version=software_version; discovered[devices].frequency_min=ranges[0].minimum; discovered[devices].frequency_max=ranges[0].maximum; + strcpy(discovered[devices].info.soapy.driver_key,driverkey); + strcpy(discovered[devices].info.soapy.hardware_key,hardwarekey); discovered[devices].info.soapy.sample_rate=sample_rate; if(strcmp(driver,"rtlsdr")==0) { discovered[devices].info.soapy.rtlsdr_count=rtlsdr_val; diff --git a/vfo.c b/vfo.c index 38555da..006c4e4 100644 --- a/vfo.c +++ b/vfo.c @@ -200,11 +200,12 @@ void vfo_restore_state() { vfo[i].band=band20; vfo[i].bandstack=0; + vfo[i].frequency=14010000; +#ifdef SOAPYSDR if(radio->protocol==SOAPYSDR_PROTOCOL) { vfo[i].frequency=144010000; - } else { - vfo[i].frequency=14010000; } +#endif vfo[i].mode=modeCWU; vfo[i].filter=6; vfo[i].lo=0; -- 2.45.2