From: pa3gsb Date: Sun, 27 May 2018 12:25:19 +0000 (+0200) Subject: merged X-Git-Url: https://git.rkrishnan.org/listings/...?a=commitdiff_plain;h=f7b9110a44f59e57417f0012be396a51999dfe47;p=pihpsdr.git merged --- f7b9110a44f59e57417f0012be396a51999dfe47 diff --cc Makefile index cc96230,30d6b1b..a27c99e --- a/Makefile +++ b/Makefile @@@ -80,12 -80,24 +80,13 @@@ endi # uncomment the line below for LimeSDR (uncomment line below) #LIMESDR_INCLUDE=LIMESDR - # uncomment the line below when Radioberry radio cape is plugged in (for now use emulator and old protocol) - RADIOBERRY_INCLUDE=RADIOBERRY + # uncomment the line below when Radioberry radio cape is plugged in + #RADIOBERRY_INCLUDE=RADIOBERRY + ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY) RADIOBERRY_OPTIONS=-D RADIOBERRY -RADIOBERRYLIBS=-lpigpio -RADIOBERRY_SOURCES= \ -radioberry_discovery.c \ -radioberry.c -RADIOBERRY_HEADERS= \ -radioberry_discovery.h \ -radioberry.h -RADIOBERRY_OBJS= \ -radioberry_discovery.o \ -radioberry.o endif - ifeq ($(LIMESDR_INCLUDE),LIMESDR) LIMESDR_OPTIONS=-D LIMESDR SOAPYSDRLIBS=-lSoapySDR diff --cc Makefile.orig index a43e6b9,a43e6b9..6e35039 --- a/Makefile.orig +++ b/Makefile.orig @@@ -4,7 -4,7 +4,7 @@@ GIT_DATE := $(firstword $(shell git --n GIT_VERSION := $(shell git describe --abbrev=0 --tags) # uncomment the line below to include GPIO --GPIO_INCLUDE=GPIO ++#GPIO_INCLUDE=GPIO # uncomment the line below to include MCP23017 I2C #I2C_INCLUDE=I2C @@@ -16,10 -16,10 +16,7 @@@ #PSK_INCLUDE=PSK # uncomment the line to below include support for FreeDV codec2 --FREEDV_INCLUDE=FREEDV -- --# uncomment the line below to include Pure Signal support --#PURESIGNAL_INCLUDE=PURESIGNAL ++#FREEDV_INCLUDE=FREEDV # uncomment the line below to include Pure Signal support #PURESIGNAL_INCLUDE=PURESIGNAL @@@ -28,11 -28,11 +25,18 @@@ #SX1509_INCLUDE=sx1509 # uncomment the line to below include support local CW keyer --LOCALCW_INCLUDE=LOCALCW ++#LOCALCW_INCLUDE=LOCALCW # uncomment the line below to include support for STEMlab discovery #STEMLAB_DISCOVERY=STEMLAB_DISCOVERY ++#uncomment the line below for the platform being compiled on ++UNAME_N=raspberrypi ++#UNAME_N=odroid ++#UNAME_N=up ++#UNAME_N=pine64 ++#UNAME_N=jetsen ++ CC=gcc LINK=gcc @@@ -76,24 -76,24 +80,12 @@@ endi # uncomment the line below for LimeSDR (uncomment line below) #LIMESDR_INCLUDE=LIMESDR --# uncomment the line below when Radioberry radio cape is plugged in ++# uncomment the line below when Radioberry radio cape is plugged in (for now use emulator and old protocol) RADIOBERRY_INCLUDE=RADIOBERRY -- ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY) RADIOBERRY_OPTIONS=-D RADIOBERRY --RADIOBERRYLIBS=-lpigpio --RADIOBERRY_SOURCES= \ --radioberry_discovery.c \ --radioberry.c --RADIOBERRY_HEADERS= \ --radioberry_discovery.h \ --radioberry.h --RADIOBERRY_OBJS= \ --radioberry_discovery.o \ --radioberry.o endif -- ifeq ($(LIMESDR_INCLUDE),LIMESDR) LIMESDR_OPTIONS=-D LIMESDR SOAPYSDRLIBS=-lSoapySDR @@@ -141,8 -141,8 +133,10 @@@ endi ifeq ($(LOCALCW_INCLUDE),LOCALCW) LOCALCW_OPTIONS=-D LOCALCW LOCALCW_SOURCES= \ ++beep.c \ iambic.c LOCALCW_HEADERS= \ ++beep.h \ iambic.h LOCALCW_OBJS= \ iambic.o @@@ -150,11 -150,11 +144,7 @@@ endi ifeq ($(GPIO_INCLUDE),GPIO) GPIO_OPTIONS=-D GPIO --<<<<<<< HEAD -- GPIO_LIBS=-lwiringPi -lpigpio --======= -- GPIO_LIBS=-lwiringPi -->>>>>>> upstream/master ++ GPIO_LIBS=-lwiringPi -lpigpio GPIO_SOURCES= \ gpio.c \ encoder_menu.c @@@ -189,13 -189,13 +179,9 @@@ GTKLIBS=`pkg-config --libs gtk+-3.0 AUDIO_LIBS=-lasound #AUDIO_LIBS=-lsoundio --OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(RADIOBERRY_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3 ++OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(RADIOBERRY_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3 --<<<<<<< HEAD --LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(RADIOBERRYLIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) --======= LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) -->>>>>>> upstream/master INCLUDES=$(GTKINCLUDES) COMPILE=$(CC) $(OPTIONS) $(INCLUDES) @@@ -413,10 -413,10 +399,15 @@@ led.o ext.o \ error_handler.o ++<<<<<<< HEAD ++$(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) ++ $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(LIBS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) ++======= $(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(RADIOBERRY_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) -- $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(LIBS) $(RADIOBERRY_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) ++ $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(RADIOBERRY_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) $(LIBS) ++>>>>>>> upstream/master --all: prebuild $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(RADIOBERRY_HEADERS) $(USBOZY_HEADERS) $(LIMESDR_HEADERS) $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) $(PURESIGNAL_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) $(USBOZY_SOURCES) $(LIMESDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) $(PSK_SOURCES) $(RADIOBERRY_SOURCES) $(PURESIGNAL_SOURCES) $(STEMLAB_SOURCES) ++all: prebuild $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(USBOZY_HEADERS) $(LIMESDR_HEADERS) $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) $(PURESIGNAL_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) $(USBOZY_SOURCES) $(LIMESDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(STEMLAB_SOURCES) prebuild: rm -f version.o diff --cc rx_menu.c index f07574f,95c8723..704de48 --- a/rx_menu.c +++ b/rx_menu.c @@@ -220,36 -233,55 +230,52 @@@ void rx_menu(GtkWidget *parent) #endif } - switch(protocol) { - case ORIGINAL_PROTOCOL: - case NEW_PROTOCOL: - { - GtkWidget *dither_b=gtk_check_button_new_with_label("Dither"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dither_b), active_receiver->dither); - gtk_grid_attach(GTK_GRID(grid),dither_b,x,2,1,1); - g_signal_connect(dither_b,"toggled",G_CALLBACK(dither_cb),NULL); - - GtkWidget *random_b=gtk_check_button_new_with_label("Random"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (random_b), active_receiver->random); - gtk_grid_attach(GTK_GRID(grid),random_b,x,3,1,1); - g_signal_connect(random_b,"toggled",G_CALLBACK(random_cb),NULL); - - if((protocol==ORIGINAL_PROTOCOL && device==DEVICE_METIS) || + // The CHARLY25 board (with RedPitaya) has no support for dither or random, + // so those are left out. PreAmps and Alex Attenuator are controlled via sliders. + if (filter_board != CHARLY25) { + switch(protocol) { -#ifdef RADIOBERRY - case RADIOBERRY_PROTOCOL: -#endif + case ORIGINAL_PROTOCOL: + case NEW_PROTOCOL: + { + GtkWidget *dither_b=gtk_check_button_new_with_label("Dither"); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dither_b), active_receiver->dither); + gtk_grid_attach(GTK_GRID(grid),dither_b,x,2,1,1); + g_signal_connect(dither_b,"toggled",G_CALLBACK(dither_cb),NULL); + + GtkWidget *random_b=gtk_check_button_new_with_label("Random"); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (random_b), active_receiver->random); + gtk_grid_attach(GTK_GRID(grid),random_b,x,3,1,1); + g_signal_connect(random_b,"toggled",G_CALLBACK(random_cb),NULL); + + if((protocol==ORIGINAL_PROTOCOL && device==DEVICE_METIS) || #ifdef USBOZY - (protocol==ORIGINAL_PROTOCOL && device==DEVICE_OZY) || + (protocol==ORIGINAL_PROTOCOL && device==DEVICE_OZY) || #endif - (protocol==NEW_PROTOCOL && device==NEW_DEVICE_ATLAS)) { - - GtkWidget *preamp_b=gtk_check_button_new_with_label("Preamp"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preamp_b), active_receiver->preamp); - gtk_grid_attach(GTK_GRID(grid),preamp_b,x,4,1,1); - g_signal_connect(preamp_b,"toggled",G_CALLBACK(preamp_cb),NULL); - } - } - x++; - break; - default: - break; + (protocol==NEW_PROTOCOL && device==NEW_DEVICE_ATLAS)) { + + GtkWidget *preamp_b=gtk_check_button_new_with_label("Preamp"); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preamp_b), active_receiver->preamp); + gtk_grid_attach(GTK_GRID(grid),preamp_b,x,4,1,1); + g_signal_connect(preamp_b,"toggled",G_CALLBACK(preamp_cb),NULL); + } + GtkWidget *alex_att_label=gtk_label_new("Alex Attenuator"); + gtk_grid_attach(GTK_GRID(grid), alex_att_label, x, 5, 1, 1); + GtkWidget *last_alex_att_b = NULL; + for (int i = 0; i <= 3; i++) { + gchar button_text[] = "xx dB"; + sprintf(button_text, "%d dB", i*10); + GtkWidget *alex_att_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(last_alex_att_b), button_text); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alex_att_b), active_receiver->alex_attenuation == i); + gtk_grid_attach(GTK_GRID(grid), alex_att_b, x, 6 + i, 1, 1); + g_signal_connect(alex_att_b, "toggled", G_CALLBACK(alex_att_cb), (gpointer) (long) i); + last_alex_att_b = alex_att_b; + } + } + x++; + break; + default: + break; + } } int n_adc=1; diff --cc rx_menu.c.orig index 0000000,0000000..4606dd6 new file mode 100644 --- /dev/null +++ b/rx_menu.c.orig @@@ -1,0 -1,0 +1,415 @@@ ++/* Copyright (C) ++* 2015 - John Melton, G0ORX/N6LYT ++* ++* This program is free software; you can redistribute it and/or ++* modify it under the terms of the GNU General Public License ++* as published by the Free Software Foundation; either version 2 ++* of the License, or (at your option) any later version. ++* ++* This program is distributed in the hope that it will be useful, ++* but WITHOUT ANY WARRANTY; without even the implied warranty of ++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++* GNU General Public License for more details. ++* ++* You should have received a copy of the GNU General Public License ++* along with this program; if not, write to the Free Software ++* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++* ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "audio.h" ++#include "new_menu.h" ++#include "rx_menu.h" ++#include "band.h" ++#include "discovered.h" ++#include "filter.h" ++#include "radio.h" ++#include "receiver.h" ++#include "sliders.h" ++ ++static GtkWidget *parent_window=NULL; ++ ++static GtkWidget *menu_b=NULL; ++ ++static GtkWidget *dialog=NULL; ++ ++static void cleanup() { ++ if(dialog!=NULL) { ++ gtk_widget_destroy(dialog); ++ dialog=NULL; ++ sub_menu=NULL; ++ } ++} ++ ++static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { ++ cleanup(); ++ return TRUE; ++} ++ ++static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { ++ cleanup(); ++ return FALSE; ++} ++ ++static void dither_cb(GtkWidget *widget, gpointer data) { ++ active_receiver->dither=active_receiver->dither==1?0:1; ++ update_att_preamp(); ++} ++ ++static void random_cb(GtkWidget *widget, gpointer data) { ++ active_receiver->random=active_receiver->random==1?0:1; ++} ++ ++static void preamp_cb(GtkWidget *widget, gpointer data) { ++ active_receiver->preamp=active_receiver->preamp==1?0:1; ++ update_att_preamp(); ++} ++ ++static void alex_att_cb(GtkWidget *widget, gpointer data) { ++ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { ++ set_alex_attenuation((intptr_t) data); ++ update_att_preamp(); ++ } ++} ++ ++static void sample_rate_cb(GtkWidget *widget, gpointer data) { ++ receiver_change_sample_rate(active_receiver,(uintptr_t)data); ++} ++ ++static void adc_cb(GtkWidget *widget, gpointer data) { ++ receiver_change_adc(active_receiver,(uintptr_t)data); ++} ++ ++static void local_audio_cb(GtkWidget *widget, gpointer data) { ++fprintf(stderr,"local_audio_cb: rx=%d\n",active_receiver->id); ++ if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { ++ if(audio_open_output(active_receiver)==0) { ++ active_receiver->local_audio=1; ++ } else { ++fprintf(stderr,"local_audio_cb: audio_open_output failed\n"); ++ active_receiver->local_audio=0; ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); ++ } ++ } else { ++ if(active_receiver->local_audio) { ++ active_receiver->local_audio=0; ++ audio_close_output(active_receiver); ++ } ++ } ++fprintf(stderr,"local_audio_cb: local_audio=%d\n",active_receiver->local_audio); ++} ++ ++static void mute_audio_cb(GtkWidget *widget, gpointer data) { ++ active_receiver->mute_when_not_active=gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); ++} ++ ++static void mute_radio_cb(GtkWidget *widget, gpointer data) { ++ active_receiver->mute_radio=gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); ++} ++ ++static void local_output_changed_cb(GtkWidget *widget, gpointer data) { ++ active_receiver->audio_device=(int)(long)data; ++fprintf(stderr,"local_output_changed rx=%d to %d\n",active_receiver->id,active_receiver->audio_device); ++ if(active_receiver->local_audio) { ++ audio_close_output(active_receiver); ++ if(audio_open_output(active_receiver)==0) { ++ active_receiver->local_audio=1; ++ } else { ++ active_receiver->local_audio=0; ++ } ++fprintf(stderr,"local_output_changed rx=%d local_audio=%d\n",active_receiver->id,active_receiver->local_audio); ++ } ++} ++ ++static void audio_channel_cb(GtkWidget *widget, gpointer data) { ++ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { ++ active_receiver->audio_channel=(uintptr_t)data; ++ } ++} ++ ++void rx_menu(GtkWidget *parent) { ++ char label[32]; ++ GtkWidget *adc_b; ++ int i; ++ parent_window=parent; ++ ++ dialog=gtk_dialog_new(); ++ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window)); ++ //gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE); ++ char title[64]; ++ sprintf(title,"piHPSDR - Receive (RX %d VFO %s)",active_receiver->id,active_receiver->id==0?"A":"B"); ++ gtk_window_set_title(GTK_WINDOW(dialog),title); ++ g_signal_connect (dialog, "delete_event", G_CALLBACK (delete_event), NULL); ++ ++ GdkRGBA color; ++ color.red = 1.0; ++ color.green = 1.0; ++ color.blue = 1.0; ++ color.alpha = 1.0; ++ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color); ++ ++ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog)); ++ ++ GtkWidget *grid=gtk_grid_new(); ++ gtk_grid_set_column_spacing (GTK_GRID(grid),10); ++ //gtk_grid_set_row_spacing (GTK_GRID(grid),10); ++ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE); ++ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); ++ ++ GtkWidget *close_b=gtk_button_new_with_label("Close"); ++ g_signal_connect (close_b, "button_press_event", G_CALLBACK(close_cb), NULL); ++ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1); ++ ++ int x=0; ++ ++ switch(protocol) { ++ case NEW_PROTOCOL: ++ { ++ GtkWidget *sample_rate_label=gtk_label_new("Sample Rate"); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_label,x,1,1,1); ++ ++ GtkWidget *sample_rate_48=gtk_radio_button_new_with_label(NULL,"48000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_48), active_receiver->sample_rate==48000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_48,x,2,1,1); ++ g_signal_connect(sample_rate_48,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)48000); ++ ++ GtkWidget *sample_rate_96=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_48),"96000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_96), active_receiver->sample_rate==96000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_96,x,3,1,1); ++ g_signal_connect(sample_rate_96,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)96000); ++ ++ GtkWidget *sample_rate_192=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_96),"192000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_192), active_receiver->sample_rate==192000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_192,x,4,1,1); ++ g_signal_connect(sample_rate_192,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)192000); ++ ++ GtkWidget *sample_rate_384=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_192),"384000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_384), active_receiver->sample_rate==384000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_384,x,5,1,1); ++ g_signal_connect(sample_rate_384,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)384000); ++ ++#ifndef raspberrypi ++ GtkWidget *sample_rate_768=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_384),"768000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_768), active_receiver->sample_rate==768000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_768,x,6,1,1); ++ g_signal_connect(sample_rate_768,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)768000); ++ ++ GtkWidget *sample_rate_1536=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_768),"1536000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_1536), active_receiver->sample_rate==1536000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_1536,x,7,1,1); ++ g_signal_connect(sample_rate_1536,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)1536000); ++#endif ++ } ++ x++; ++ break; ++ ++#ifdef LIMESDR ++ case LIMESDR_PROTOCOL: ++ { ++ GtkWidget *sample_rate_label=gtk_label_new("Sample Rate"); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_label,x,1,1,1); ++ ++ GtkWidget *sample_rate_1M=gtk_radio_button_new_with_label(NULL,"1000000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_1M), active_receiver->sample_rate==1000000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_1M,x,2,1,1); ++ g_signal_connect(sample_rate_1M,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)1000000); ++ ++ GtkWidget *sample_rate_2M=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sample_rate_1M),"2000000"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_2M), active_receiver->sample_rate==2000000); ++ gtk_grid_attach(GTK_GRID(grid),sample_rate_2M,x,3,1,1); ++ g_signal_connect(sample_rate_2M,"pressed",G_CALLBACK(sample_rate_cb),(gpointer *)2000000); ++ } ++ x++; ++ break; ++#endif ++ } ++ ++<<<<<<< HEAD ++ switch(protocol) { ++ case ORIGINAL_PROTOCOL: ++ case NEW_PROTOCOL: ++ { ++ GtkWidget *dither_b=gtk_check_button_new_with_label("Dither"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dither_b), active_receiver->dither); ++ gtk_grid_attach(GTK_GRID(grid),dither_b,x,2,1,1); ++ g_signal_connect(dither_b,"toggled",G_CALLBACK(dither_cb),NULL); ++ ++ GtkWidget *random_b=gtk_check_button_new_with_label("Random"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (random_b), active_receiver->random); ++ gtk_grid_attach(GTK_GRID(grid),random_b,x,3,1,1); ++ g_signal_connect(random_b,"toggled",G_CALLBACK(random_cb),NULL); ++ ++ if((protocol==ORIGINAL_PROTOCOL && device==DEVICE_METIS) || ++======= ++ // The CHARLY25 board (with RedPitaya) has no support for dither or random, ++ // so those are left out. PreAmps and Alex Attenuator are controlled via sliders. ++ if (filter_board != CHARLY25) { ++ switch(protocol) { ++#ifdef RADIOBERRY ++ case RADIOBERRY_PROTOCOL: ++#endif ++ case ORIGINAL_PROTOCOL: ++ case NEW_PROTOCOL: ++ { ++ GtkWidget *dither_b=gtk_check_button_new_with_label("Dither"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dither_b), active_receiver->dither); ++ gtk_grid_attach(GTK_GRID(grid),dither_b,x,2,1,1); ++ g_signal_connect(dither_b,"toggled",G_CALLBACK(dither_cb),NULL); ++ ++ GtkWidget *random_b=gtk_check_button_new_with_label("Random"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (random_b), active_receiver->random); ++ gtk_grid_attach(GTK_GRID(grid),random_b,x,3,1,1); ++ g_signal_connect(random_b,"toggled",G_CALLBACK(random_cb),NULL); ++ ++ if((protocol==ORIGINAL_PROTOCOL && device==DEVICE_METIS) || ++>>>>>>> upstream/master ++#ifdef USBOZY ++ (protocol==ORIGINAL_PROTOCOL && device==DEVICE_OZY) || ++#endif ++ (protocol==NEW_PROTOCOL && device==NEW_DEVICE_ATLAS)) { ++ ++ GtkWidget *preamp_b=gtk_check_button_new_with_label("Preamp"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preamp_b), active_receiver->preamp); ++ gtk_grid_attach(GTK_GRID(grid),preamp_b,x,4,1,1); ++ g_signal_connect(preamp_b,"toggled",G_CALLBACK(preamp_cb),NULL); ++ } ++ GtkWidget *alex_att_label=gtk_label_new("Alex Attenuator"); ++ gtk_grid_attach(GTK_GRID(grid), alex_att_label, x, 5, 1, 1); ++ GtkWidget *last_alex_att_b = NULL; ++ for (int i = 0; i <= 3; i++) { ++ gchar button_text[] = "xx dB"; ++ sprintf(button_text, "%d dB", i*10); ++ GtkWidget *alex_att_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(last_alex_att_b), button_text); ++ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alex_att_b), active_receiver->alex_attenuation == i); ++ gtk_grid_attach(GTK_GRID(grid), alex_att_b, x, 6 + i, 1, 1); ++ g_signal_connect(alex_att_b, "toggled", G_CALLBACK(alex_att_cb), (gpointer) (long) i); ++ last_alex_att_b = alex_att_b; ++ } ++ } ++ x++; ++ break; ++ default: ++ break; ++ } ++ } ++ ++ int n_adc=1; ++ switch(protocol) { ++ case ORIGINAL_PROTOCOL: ++ switch(device) { ++ case DEVICE_METIS: ++ n_adc=1; // FIX for multiple Mercury cards ++ break; ++ case DEVICE_HERMES: ++ case DEVICE_HERMES_LITE: ++ n_adc=1; ++ break; ++ default: ++ n_adc=2; ++ break; ++ } ++ break; ++ case NEW_PROTOCOL: ++ switch(device) { ++ case NEW_DEVICE_ATLAS: ++ n_adc=1; // FIX for multiple Mercury cards ++ break; ++ case NEW_DEVICE_HERMES: ++ case NEW_DEVICE_HERMES2: ++ case NEW_DEVICE_HERMES_LITE: ++ n_adc=1; ++ break; ++ default: ++ n_adc=2; ++ break; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ if(n_adc>1) { ++ for(i=0;iadc==i); ++ gtk_grid_attach(GTK_GRID(grid),adc_b,x,2+i,1,1); ++ g_signal_connect(adc_b,"pressed",G_CALLBACK(adc_cb),(gpointer)(long)i); ++ } ++ x++; ++ } ++ ++ ++ int row=0; ++ if(n_output_devices>0) { ++ GtkWidget *local_audio_b=gtk_check_button_new_with_label("Local Audio Output"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (local_audio_b), active_receiver->local_audio); ++ gtk_widget_show(local_audio_b); ++ gtk_grid_attach(GTK_GRID(grid),local_audio_b,x,++row,1,1); ++ g_signal_connect(local_audio_b,"toggled",G_CALLBACK(local_audio_cb),NULL); ++ ++ if(active_receiver->audio_device==-1) active_receiver->audio_device=0; ++ ++ GtkWidget *output=NULL; ++ for(i=0;iaudio_device==i); ++ gtk_widget_show(output); ++ gtk_grid_attach(GTK_GRID(grid),output,x,++row,1,1); ++ g_signal_connect(output,"pressed",G_CALLBACK(local_output_changed_cb),(gpointer)(long)i); ++ } ++ ++ row=0; ++ x++; ++ ++ GtkWidget *stereo_b=gtk_radio_button_new_with_label(NULL,"Stereo"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (stereo_b), active_receiver->audio_channel==STEREO); ++ gtk_widget_show(stereo_b); ++ gtk_grid_attach(GTK_GRID(grid),stereo_b,x,++row,1,1); ++ g_signal_connect(stereo_b,"toggled",G_CALLBACK(audio_channel_cb),(gpointer)STEREO); ++ ++ GtkWidget *left_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(stereo_b),"Left"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (left_b), active_receiver->audio_channel==LEFT); ++ gtk_widget_show(left_b); ++ gtk_grid_attach(GTK_GRID(grid),left_b,x,++row,1,1); ++ g_signal_connect(left_b,"toggled",G_CALLBACK(audio_channel_cb),(gpointer)LEFT); ++ ++ GtkWidget *right_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(left_b),"Right"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (right_b), active_receiver->audio_channel==RIGHT); ++ gtk_widget_show(right_b); ++ gtk_grid_attach(GTK_GRID(grid),right_b,x,++row,1,1); ++ g_signal_connect(right_b,"toggled",G_CALLBACK(audio_channel_cb),(gpointer)RIGHT); ++ } ++ ++ GtkWidget *mute_audio_b=gtk_check_button_new_with_label("Mute when not active"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mute_audio_b), active_receiver->mute_when_not_active); ++ gtk_widget_show(mute_audio_b); ++ gtk_grid_attach(GTK_GRID(grid),mute_audio_b,x,++row,1,1); ++ g_signal_connect(mute_audio_b,"toggled",G_CALLBACK(mute_audio_cb),NULL); ++ ++ row++; ++ ++ GtkWidget *mute_radio_b=gtk_check_button_new_with_label("Mute audio to radio"); ++ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mute_radio_b), active_receiver->mute_radio); ++ gtk_widget_show(mute_radio_b); ++ gtk_grid_attach(GTK_GRID(grid),mute_radio_b,x,++row,1,1); ++ g_signal_connect(mute_radio_b,"toggled",G_CALLBACK(mute_radio_cb),NULL); ++ ++ gtk_container_add(GTK_CONTAINER(content),grid); ++ ++ sub_menu=dialog; ++ ++ gtk_widget_show_all(dialog); ++ ++} ++