Removed PSK and FREEDV code.
Single binary for the RPi - select controller (on none) from discovery.
Added code to pa_menu.c to select max power output and to Calibrate Watt Meter.
Removed reference to RADIOBERRY.
Cleanup of Makefile and Makefile.mac
Remove all the *-beta.tar files.
Fixed code to allow for HermesLite power detect transformer polarity swap.
Addec code to support HermesLite Attenuation/Gain settings.
Several code cleanup changes.
# uncomment the line below to include GPIO (For original piHPSDR Controller and Controller2)
GPIO_INCLUDE=GPIO
-# uncomment the line below to include MCP23017 I2C (required for Controller2)
-#I2C_INCLUDE=I2C
-
-# uncomment the line below to include CONTROLLER2_V1 (single encoders) (Also uncomment GPIO and I2C)
-#CONTROLLER2_V1_INCLUDE=CONTROLLER2_V1
-
-# uncomment the line below to include CONTROLLER2_V2 (dual encoders) (Also uncomment GPIO and I2C)
-#CONTROLLER2_V2_INCLUDE=CONTROLLER2_V2
-
# uncomment the line below to include USB Ozy support
# USBOZY_INCLUDE=USBOZY
#LOCALCW_INCLUDE=LOCALCW
# uncomment the line below for SoapySDR
-#SOAPYSDR_INCLUDE=SOAPYSDR
-
-# uncomment the line below to include support for psk31
-#PSK_INCLUDE=PSK
-
-# uncomment the line to below include support for FreeDV codec2
-#FREEDV_INCLUDE=FREEDV
+SOAPYSDR_INCLUDE=SOAPYSDR
# uncomment the line to below include support for sx1509 i2c expander
#SX1509_INCLUDE=sx1509
# uncomment the line below to include MIDI support
MIDI_INCLUDE=MIDI
-# 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 for various debug facilities
#DEBUG_OPTION=-D DEBUG
CC=gcc
LINK=gcc
-ifeq ($(CONTROLLER2_V2_INCLUDE),CONTROLLER2_V2)
-CONTROLLER2_OPTIONS=-D CONTROLLER2_V2
-endif
-ifeq ($(CONTROLLER2_V1_INCLUDE),CONTROLLER2_V1)
-CONTROLLER2_OPTIONS=-D CONTROLLER2_V1
-endif
-
ifeq ($(MIDI_INCLUDE),MIDI)
MIDI_OPTIONS=-D MIDI
MIDI_SOURCES= alsa_midi.c midi2.c midi3.c
endif
-ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY)
-RADIOBERRY_OPTIONS=-D RADIOBERRY
-endif
-
ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR)
SOAPYSDR_OPTIONS=-D SOAPYSDR
SOAPYSDRLIBS=-lSoapySDR
endif
-ifeq ($(PSK_INCLUDE),PSK)
-PSK_OPTIONS=-D PSK
-PSKLIBS=-lpsk
-PSK_SOURCES= \
-psk.c \
-psk_waterfall.c
-PSK_HEADERS= \
-psk.h \
-psk_waterfall.h
-PSK_OBJS= \
-psk.o \
-psk_waterfall.o
-endif
-
-
-ifeq ($(FREEDV_INCLUDE),FREEDV)
-FREEDV_OPTIONS=-D FREEDV
-FREEDVLIBS=-lcodec2
-FREEDV_SOURCES= \
-freedv.c \
-freedv_menu.c
-FREEDV_HEADERS= \
-freedv.h \
-freedv_menu.h
-FREEDV_OBJS= \
-freedv.o \
-freedv_menu.o
-endif
-
ifeq ($(LOCALCW_INCLUDE),LOCALCW)
LOCALCW_OPTIONS=-D LOCALCW
LOCALCW_SOURCES= iambic.c
ifeq ($(GPIO_INCLUDE),GPIO)
GPIO_OPTIONS=-D GPIO
- GPIO_LIBS=-lwiringPi
+ GPIO_LIBS=-lwiringPi -li2c
GPIO_SOURCES= \
+ i2c.c \
+ gpio_menu.c \
gpio.c \
encoder_menu.c \
switch_menu.c
GPIO_HEADERS= \
+ i2c.h \
+ gpio_menu.h \
gpio.h \
encoder_menu.h \
switch_menu.h
GPIO_OBJS= \
+ i2c.o \
+ gpio_menu.o\
gpio.o \
encoder_menu.o \
switch_menu.o
endif
-ifeq ($(I2C_INCLUDE),I2C)
- I2C_OPTIONS=-D I2C
- I2C_LIBS=-li2c
- I2C_SOURCES=i2c.c
- I2C_HEADERS=i2c.h
- I2C_OBJS=i2c.o
-endif
-
#
# We have two versions of STEMLAB_DISCOVERY here,
# the second one has to be used
CFLAGS= -g -Wno-deprecated-declarations -O3
OPTIONS=$(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) \
- $(I2C_OPTIONS) $(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(RADIOBERRY_OPTIONS) \
- $(PSK_OPTIONS) $(STEMLAB_OPTIONS) $(CONTROLLER2_OPTIONS) \
+ $(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) $(LOCALCW_OPTIONS) \
+ $(STEMLAB_OPTIONS) $(CONTROLLER2_OPTIONS) \
-D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION)
-LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(I2C_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
+LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
INCLUDES=$(GTKINCLUDES)
COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
SOURCES= \
audio.c \
-audio_waterfall.c \
band.c \
-configure.c \
-frequency.c \
discovered.c \
discovery.c \
filter.c \
HEADERS= \
audio.h \
-audio_waterfall.h \
agc.h \
alex.h \
band.h \
-configure.h \
-frequency.h \
bandstack.h \
channel.h \
discovered.h \
OBJS= \
audio.o \
-audio_waterfall.o \
band.o \
-configure.o \
-frequency.o \
discovered.o \
discovery.o \
filter.o \
error_handler.o \
cwramp.o
-$(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) $(FREEDV_OBJS) \
- $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) \
+$(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
+ $(LOCALCW_OBJS) $(GPIO_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS)
- $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) \
- $(SOAPYSDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) \
+ $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(GPIO_OBJS) \
+ $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(LIBS)
.PHONY: all
all: prebuild $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(USBOZY_HEADERS) $(SOAPYSDR_HEADERS) \
- $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) \
+ $(LOCALCW_HEADERS) $(GPIO_HEADERS) \
$(PURESIGNAL_HEADERS) $(MIDI_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) \
- $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) \
- $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
+ $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(GPIO_SOURCES) \
+ $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
.PHONY: prebuild
prebuild:
.PHONY: cppcheck
cppcheck:
cppcheck $(CPPOPTIONS) $(OPTIONS) $(CPPINCLUDES) $(SOURCES) $(REMOTE_SOURCES) \
- $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) \
- $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
+ $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(GPIO_SOURCES) \
+ $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
.PHONY: clean
clean:
hpsdrsim: hpsdrsim.o newhpsdrsim.o
$(LINK) -o hpsdrsim hpsdrsim.o newhpsdrsim.o -lasound -lm -lpthread
+
+
+debian:
+ cp $(PROGRAM) pkg/pihpsdr/usr/local/bin
+ cp /usr/local/lib/libwdsp.so pkg/pihpsdr/usr/local/lib
+ cp release/pihpsdr/hpsdr.png pkg/pihpsdr/usr/share/pihpsdr
+ cp release/pihpsdr/hpsdr_icon.png pkg/pihpsdr/usr/share/pihpsdr
+ cp release/pihpsdr/pihpsdr.desktop pkg/pihpsdr/usr/share/applications
+ cd pkg; dpkg-deb --build pihpsdr
+
# uncomment the line below to include GPIO (For original piHPSDR Controller and Controller2)
#GPIO_INCLUDE=GPIO
-# uncomment the line below to include MCP23017 I2C (required for Controller2)
-#I2C_INCLUDE=I2C
-
-# uncomment the line below to include CONTROLLER2_V1 (single encoders) (Also uncomment GPIO and I2C)
-#CONTROLLER2_V1_INCLUDE=CONTROLLER2_V1
-
-# uncomment the line below to include CONTROLLER2_V2 (dual encoders) (Also uncomment GPIO and I2C)
-#CONTROLLER2_V2_INCLUDE=CONTROLLER2_V2
-
# uncomment the line below to include USB Ozy support
# USBOZY_INCLUDE=USBOZY
# uncomment the line below for SoapySDR
#SOAPYSDR_INCLUDE=SOAPYSDR
-# uncomment the line below to include support for psk31
-#PSK_INCLUDE=PSK
-
-# uncomment the line to below include support for FreeDV codec2
-#FREEDV_INCLUDE=FREEDV
-
# uncomment the line to below include support for sx1509 i2c expander
#SX1509_INCLUDE=sx1509
# uncomment the line below to include MIDI support
MIDI_INCLUDE=MIDI
-# 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 for various debug facilities
#DEBUG_OPTION=-D DEBUG
ozyio.o
endif
-
-ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY)
-RADIOBERRY_OPTIONS=-D RADIOBERRY
-endif
-
ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR)
SOAPYSDR_OPTIONS=-D SOAPYSDR
SOAPYSDRLIBS=-lSoapySDR
soapy_protocol.o
endif
-
-ifeq ($(PSK_INCLUDE),PSK)
-PSK_OPTIONS=-D PSK
-PSKLIBS=-lpsk
-PSK_SOURCES= \
-psk.c \
-psk_waterfall.c
-PSK_HEADERS= \
-psk.h \
-psk_waterfall.h
-PSK_OBJS= \
-psk.o \
-psk_waterfall.o
-endif
-
-
-ifeq ($(FREEDV_INCLUDE),FREEDV)
-FREEDV_OPTIONS=-D FREEDV
-FREEDVLIBS=-lcodec2
-FREEDV_SOURCES= \
-freedv.c \
-freedv_menu.c
-FREEDV_HEADERS= \
-freedv.h \
-freedv_menu.h
-FREEDV_OBJS= \
-freedv.o \
-freedv_menu.o
-endif
-
ifeq ($(LOCALCW_INCLUDE),LOCALCW)
LOCALCW_OPTIONS=-D LOCALCW
LOCALCW_SOURCES= iambic.c
switch_menu.o
endif
-ifeq ($(I2C_INCLUDE),I2C)
- I2C_OPTIONS=-D I2C
- I2C_SOURCES=i2c.c
- I2C_HEADERS=i2c.h
- I2C_OBJS=i2c.o
-endif
-
#
# We have two versions of STEMLAB_DISCOVERY here,
# the second one has to be used
CFLAGS= -g -Wno-deprecated-declarations
OPTIONS=$(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) \
- $(I2C_OPTIONS) $(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(RADIOBERRY_OPTIONS) \
- $(PSK_OPTIONS) $(STEMLAB_OPTIONS) \
+ $(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) $(LOCALCW_OPTIONS) \
+ $(STEMLAB_OPTIONS) \
$(CONTROLLER2_OPTIONS) $(AUDIO_OPTIONS) \
-D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION)
-LIBS= -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
+LIBS= -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
INCLUDES=$(GTKINCLUDES)
COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
SOURCES= \
audio.c \
-audio_waterfall.c \
band.c \
configure.c \
-frequency.c \
discovered.c \
discovery.c \
filter.c \
HEADERS= \
audio.h \
-audio_waterfall.h \
agc.h \
alex.h \
band.h \
configure.h \
-frequency.h \
bandstack.h \
channel.h \
discovered.h \
OBJS= \
audio.o \
portaudio.o \
-audio_waterfall.o \
band.o \
configure.o \
-frequency.o \
discovered.o \
discovery.o \
filter.o \
error_handler.o \
cwramp.o
-$(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) $(FREEDV_OBJS) \
- $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) \
+$(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
+ $(LOCALCW_OBJS) $(GPIO_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS)
- $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) \
- $(SOAPYSDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) \
+ $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(GPIO_OBJS) \
+ $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(LIBS)
all: prebuild $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(USBOZY_HEADERS) $(SOAPYSDR_HEADERS) \
- $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) \
+ $(LOCALCW_HEADERS) $(GPIO_HEADERS) \
$(PURESIGNAL_HEADERS) $(MIDI_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) \
- $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) \
- $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
+ $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(GPIO_SOURCES) \
+ $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
prebuild:
rm -f version.o
.PHONY: cppcheck
cppcheck:
cppcheck $(CPPOPTIONS) $(OPTIONS) $(CPPINCLUDES) $(SOURCES) $(REMOTE_SOURCES) \
- $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) \
- $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
+ $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(GPIO_SOURCES) \
+ $(PURESIGNAL_SOURCES) $(MIDI_SOURCES)$(STEMLAB_SOURCES)
clean:
-rm -f *.o
# are stored.
#
#############################################################################
-app: $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) \
- $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) \
+app: $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) \
+ $(LOCALCW_OBJS) $(GPIO_OBJS) \
$(PURESIGNAL_OBJS) $(MIDI_OBJS) $(STEMLAB_OBJS)
$(LINK) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) \
- $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) \
- $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) \
+ $(USBOZY_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) \
+ $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(LIBS)
@rm -rf pihpsdr.app
@mkdir -p pihpsdr.app/Contents/MacOS
break;
}
-#ifdef FREEDV
- strcat(text,"\n\nIncludes: FREEDV");
-#endif
-
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,4,1);
static void show_hf() {
int i;
- for(i=0;i<BANDS;i++) {
+ int bands=BANDS;
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch(device) {
+ case DEVICE_HERMES_LITE:
+ case DEVICE_HERMES_LITE2:
+ bands=band10+1;
+ break;
+ default:
+ bands=band6+1;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch(device) {
+ case NEW_DEVICE_HERMES_LITE:
+ case NEW_DEVICE_HERMES_LITE2:
+ bands=band10+1;
+ break;
+ default:
+ bands=band6+1;
+ break;
+ }
+ break;
+ }
+ for(i=0;i<bands;i++) {
BAND *band=band_get_band(i);
if(strlen(band->title)>0) {
- GtkWidget *band_label=gtk_label_new(band->title);
+ GtkWidget *band_label=gtk_label_new(NULL);
//gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_label_set_markup(GTK_LABEL(band_label), band->title);
gtk_widget_show(band_label);
gtk_grid_attach(GTK_GRID(grid),band_label,0,i+2,1,1);
for(i=0;i<XVTRS;i++) {
BAND *band=band_get_band(BANDS+i);
if(strlen(band->title)>0) {
- GtkWidget *band_label=gtk_label_new(band->title);
+ GtkWidget *band_label=gtk_label_new(NULL);
//gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_label_set_markup(GTK_LABEL(band_label), band->title);
gtk_widget_show(band_label);
gtk_grid_attach(GTK_GRID(grid),band_label,0,i+2,1,1);
if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
- GtkWidget *rx_ant_label=gtk_label_new("Receive");
+ GtkWidget *rx_ant_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rx_ant_label), "<b>Receive</b>");
//gtk_widget_override_font(rx_ant_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(rx_ant_label);
gtk_grid_attach(GTK_GRID(grid),rx_ant_label,0,1,1,1);
- GtkWidget *rx1_label=gtk_label_new("1");
+ GtkWidget *rx1_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rx1_label), "<b>1</b>");
//gtk_widget_override_font(rx1_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(rx1_label);
gtk_grid_attach(GTK_GRID(grid),rx1_label,1,1,1,1);
- GtkWidget *rx2_label=gtk_label_new("2");
+ GtkWidget *rx2_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rx2_label), "<b>2</b>");
//gtk_widget_override_font(rx2_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(rx2_label);
gtk_grid_attach(GTK_GRID(grid),rx2_label,2,1,1,1);
- GtkWidget *rx3_label=gtk_label_new("3");
+ GtkWidget *rx3_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rx3_label), "<b>3</b>");
//gtk_widget_override_font(rx3_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(rx3_label);
gtk_grid_attach(GTK_GRID(grid),rx3_label,3,1,1,1);
- GtkWidget *ext1_label=gtk_label_new("EXT1");
+ GtkWidget *ext1_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(ext1_label), "<b>EXT1</b>");
//gtk_widget_override_font(ext1_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(ext1_label);
gtk_grid_attach(GTK_GRID(grid),ext1_label,4,1,1,1);
- GtkWidget *ext2_label=gtk_label_new("EXT2");
+ GtkWidget *ext2_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(ext2_label), "<b>EXT2</b>");
//gtk_widget_override_font(ext2_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(ext2_label);
gtk_grid_attach(GTK_GRID(grid),ext2_label,5,1,1,1);
- GtkWidget *xvtr_label=gtk_label_new("XVTR");
+ GtkWidget *xvtr_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(xvtr_label), "<b>XVTR</b>");
//gtk_widget_override_font(xvtr_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(xvtr_label);
gtk_grid_attach(GTK_GRID(grid),xvtr_label,6,1,1,1);
- GtkWidget *tx_ant_label=gtk_label_new("Transmit");
+ GtkWidget *tx_ant_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tx_ant_label), "<b>Transmit</b>");
//gtk_widget_override_font(tx_ant_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(tx_ant_label);
gtk_grid_attach(GTK_GRID(grid),tx_ant_label,7,1,1,1);
- GtkWidget *tx1_label=gtk_label_new("1");
+ GtkWidget *tx1_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tx1_label), "<b>1</b>");
//gtk_widget_override_font(tx1_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(tx1_label);
gtk_grid_attach(GTK_GRID(grid),tx1_label,8,1,1,1);
- GtkWidget *tx2_label=gtk_label_new("2");
+ GtkWidget *tx2_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tx2_label), "<b>2</b>");
//gtk_widget_override_font(tx2_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(tx2_label);
gtk_grid_attach(GTK_GRID(grid),tx2_label,9,1,1,1);
- GtkWidget *tx3_label=gtk_label_new("3");
+ GtkWidget *tx3_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tx3_label), "<b>3</b>");
//gtk_widget_override_font(tx3_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(tx3_label);
gtk_grid_attach(GTK_GRID(grid),tx3_label,10,1,1,1);
g_print("rx_antennas=%ld\n",radio->info.soapy.rx_antennas);
if(radio->info.soapy.rx_antennas>0) {
- GtkWidget *antenna_label=gtk_label_new("RX Antenna:");
+ GtkWidget *antenna_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(antenna_label), "<b>RX Antenna:</b>");
gtk_grid_attach(GTK_GRID(grid),antenna_label,0,1,1,1);
adc0_antenna_combo_box=gtk_combo_box_text_new();
if(can_transmit) {
g_print("tx_antennas=%ld\n",radio->info.soapy.tx_antennas);
if(radio->info.soapy.tx_antennas>0) {
- GtkWidget *antenna_label=gtk_label_new("TX Antenna:");
+ GtkWidget *antenna_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(antenna_label), "<b>TX Antenna:</b>");
gtk_grid_attach(GTK_GRID(grid),antenna_label,0,2,1,1);
dac0_antenna_combo_box=gtk_combo_box_text_new();
switch(protocol) {
case ORIGINAL_PROTOCOL:
case NEW_PROTOCOL:
+#ifdef SOAPYSDR
+ case SOAPYSDR_PROTOCOL:
+#endif
//
// put sample into ring buffer
//
}
}
break;
-#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- // Note that this call ends up deeply in the TX engine
- soapy_protocol_process_local_mic(sample);
- break;
-#endif
default:
break;
}
+++ /dev/null
-/* Copyright (C)
-* 2017 - 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 <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <math.h>
-#include <unistd.h>
-#include <semaphore.h>
-#include <string.h>
-
-#include <wdsp.h>
-
-#include "channel.h"
-#include "filter.h"
-#include "radio.h"
-#include "vfo.h"
-#include "audio_waterfall.h"
-#include "receiver.h"
-
-#define min(x,y) (x<y?x:y)
-
-
-static GtkWidget *waterfall;
-static GdkPixbuf *pixbuf = NULL;
-
-float *audio_samples=NULL;
-int audio_samples_index=0;
-
-static int colorLowR=0; // black
-static int colorLowG=0;
-static int colorLowB=0;
-
-static int colorMidR=255; // red
-static int colorMidG=0;
-static int colorMidB=0;
-
-static int colorHighR=255; // yellow
-static int colorHighG=255;
-static int colorHighB=0;
-
-static int sample_rate;
-static gfloat hz_per_pixel;
-static int cursor_frequency=0;
-static int cursor_x=0;
-static int header=20;
-
-// fixed for freedv waterfall?
-static int audio_waterfall_low=30;
-static int audio_waterfall_high=90;
-
-static int display_width;
-static int waterfall_height;
-
-/* Create a new surface of the appropriate size to store our scribbles */
-static gboolean
-waterfall_configure_event_cb (GtkWidget *widget,
- GdkEventConfigure *event,
- gpointer data)
-{
- int width=gtk_widget_get_allocated_width (widget);
- int height=gtk_widget_get_allocated_height (widget);
-fprintf(stderr,"audio: waterfall_configure_event: width=%d height=%d\n",width,height);
- pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- unsigned char *pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- memset(pixels, 0, width*height*3);
-
- if(cursor_frequency!=0) {
- hz_per_pixel=(double)(sample_rate/2)/(double)display_width;
- cursor_x=(int)((double)cursor_frequency/hz_per_pixel);
-fprintf(stderr,"audio: waterfall_configure_event: cursor_x=%d hz_per_pizel=%f\n",cursor_x,hz_per_pixel);
- }
-
- return TRUE;
-}
-
-/* Redraw the screen from the surface. Note that the ::draw
- * signal receives a ready-to-be-used cairo_t that is already
- * clipped to only draw the exposed areas of the widget
- */
-static gboolean
-waterfall_draw_cb (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
- cairo_text_extents_t extents;
- char text[16];
-
-//fprintf(stderr,"waterfall_draw_cb\n");
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_paint (cr);
-
- // draw the sursor
- if(cursor_x!=0) {
- cairo_set_source_rgb (cr, 1, 0, 0);
- sprintf(text,"%d Hz",cursor_frequency);
- cairo_select_font_face(cr, "FreeMono",
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_BOLD);
- cairo_set_font_size(cr, 12);
- cairo_text_extents(cr, text, &extents);
- cairo_move_to(cr, (double)cursor_x-(extents.width/2.0), 18.0);
- cairo_show_text(cr,text);
- cairo_set_line_width(cr, 1.0);
- cairo_move_to(cr, cursor_x, header);
- cairo_line_to(cr, cursor_x, waterfall_height);
- cairo_stroke(cr);
- }
-
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_rectangle(cr, 0.0, 0.0, (double)(display_width-1), (double)(waterfall_height-1));
- cairo_stroke(cr);
- return TRUE;
-}
-
-void audio_waterfall_update() {
-
- int i;
-
- if(pixbuf) {
- unsigned char *pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- int width=gdk_pixbuf_get_width(pixbuf);
- int height=gdk_pixbuf_get_height(pixbuf);
- int rowstride=gdk_pixbuf_get_rowstride(pixbuf);
- int channels=gdk_pixbuf_get_n_channels(pixbuf); // used in debug code
-
-//fprintf(stderr,"audio_waterfall_update: width=%d height=%d rowsstride=%d channels=%d\n",width,height,rowstride,channels);
-
- memmove(&pixels[rowstride*(header+1)],&pixels[rowstride*header],(height-(header+1))*rowstride);
-
- float sample;
- unsigned char *p;
- int average=0;
- p=&pixels[rowstride*header];
- for(i=0;i<width;i++) {
- sample=audio_samples[i];
- if(sample<(float)audio_waterfall_low) {
- *p++=colorLowR;
- *p++=colorLowG;
- *p++=colorLowB;
- } else if(sample>(float)audio_waterfall_high) {
- *p++=colorHighR;
- *p++=colorHighG;
- *p++=colorHighB;
- } else {
- float range=(float)audio_waterfall_high-(float)audio_waterfall_low;
- float offset=sample-(float)audio_waterfall_low;
- float percent=offset/range;
- if(percent<(2.0f/9.0f)) {
- float local_percent = percent / (2.0f/9.0f);
- *p++ = (int)((1.0f-local_percent)*colorLowR);
- *p++ = (int)((1.0f-local_percent)*colorLowG);
- *p++ = (int)(colorLowB + local_percent*(255-colorLowB));
- } else if(percent<(3.0f/9.0f)) {
- float local_percent = (percent - 2.0f/9.0f) / (1.0f/9.0f);
- *p++ = 0;
- *p++ = (int)(local_percent*255);
- *p++ = 255;
- } else if(percent<(4.0f/9.0f)) {
- float local_percent = (percent - 3.0f/9.0f) / (1.0f/9.0f);
- *p++ = 0;
- *p++ = 255;
- *p++ = (int)((1.0f-local_percent)*255);
- } else if(percent<(5.0f/9.0f)) {
- float local_percent = (percent - 4.0f/9.0f) / (1.0f/9.0f);
- *p++ = (int)(local_percent*255);
- *p++ = 255;
- *p++ = 0;
- } else if(percent<(7.0f/9.0f)) {
- float local_percent = (percent - 5.0f/9.0f) / (2.0f/9.0f);
- *p++ = 255;
- *p++ = (int)((1.0f-local_percent)*255);
- *p++ = 0;
- } else if(percent<(8.0f/9.0f)) {
- float local_percent = (percent - 7.0f/9.0f) / (1.0f/9.0f);
- *p++ = 255;
- *p++ = 0;
- *p++ = (int)(local_percent*255);
- } else {
- float local_percent = (percent - 8.0f/9.0f) / (1.0f/9.0f);
- *p++ = (int)((0.75f + 0.25f*(1.0f-local_percent))*255.0f);
- *p++ = (int)(local_percent*255.0f*0.5f);
- *p++ = 255;
- }
- }
- average+=(int)sample;
- audio_waterfall_low=(average/width)+10;
- audio_waterfall_high=audio_waterfall_low+50;
- }
- gtk_widget_queue_draw (waterfall);
- }
-}
-
-void audio_waterfall_setup(int rate,int cursor) {
- sample_rate=rate;
- cursor_frequency=cursor;
- hz_per_pixel=(double)(sample_rate/2)/(double)display_width;
- cursor_x=(int)((double)cursor/hz_per_pixel);
-fprintf(stderr,"audio_waterfall_setup: sample_rate=%d cursor=%d width=%d hz_per_pixel=%f\n",sample_rate,cursor,display_width,hz_per_pixel);
-}
-
-
-static void initAnalyzer(RECEIVER *rx,int channel, int buffer_size, int pixels) {
- int flp[] = {0};
- double keep_time = 0.1;
- int n_pixout=1;
- int spur_elimination_ffts = 1;
- int data_type = 0;
- int fft_size = 1024;
- int window_type = 4;
- double kaiser_pi = 14.0;
- int overlap = 0;
- int clip = 0;
- int span_clip_l = 0;
- int span_clip_h = 0;
- int stitches = 1;
- int calibration_data_set = 0;
- double span_min_freq = 0.0;
- double span_max_freq = 0.0;
-
- int max_w = fft_size + (int) min(keep_time * (double) rx->fps, keep_time * (double) fft_size * (double) rx->fps);
-
- SetAnalyzer(channel,
- n_pixout,
- spur_elimination_ffts, //number of LO frequencies = number of ffts used in elimination
- data_type, //0 for real input data (I only); 1 for complex input data (I & Q)
- flp, //vector with one elt for each LO frequency, 1 if high-side LO, 0 otherwise
- fft_size, //size of the fft, i.e., number of input samples
- buffer_size, //number of samples transferred for each OpenBuffer()/CloseBuffer()
- window_type, //integer specifying which window function to use
- kaiser_pi, //PiAlpha parameter for Kaiser window
- overlap, //number of samples each fft (other than the first) is to re-use from the previous
- clip, //number of fft output bins to be clipped from EACH side of each sub-span
- span_clip_l, //number of bins to clip from low end of entire span
- span_clip_h, //number of bins to clip from high end of entire span
- pixels, //number of pixel values to return. may be either <= or > number of bins
- stitches, //number of sub-spans to concatenate to form a complete span
- calibration_data_set, //identifier of which set of calibration data to use
- span_min_freq, //frequency at first pixel value8192
- span_max_freq, //frequency at last pixel value
- max_w //max samples to hold in input ring buffers
- );
-
-}
-
-GtkWidget* audio_waterfall_init(int width,int height) {
- int success;
-
-fprintf(stderr,"audio_waterfall_init: width=%d height=%d\n",width,height);
- display_width=width;
- waterfall_height=height;
-
- audio_samples=(float *)malloc(sizeof(float)*width);
-
- //waterfall_frame = gtk_frame_new (NULL);
- waterfall = gtk_drawing_area_new ();
- gtk_widget_set_size_request (waterfall, width, height);
-
- /* Signals used to handle the backing surface */
- g_signal_connect (waterfall, "draw",
- G_CALLBACK (waterfall_draw_cb), NULL);
- g_signal_connect (waterfall,"configure-event",
- G_CALLBACK (waterfall_configure_event_cb), NULL);
-
- XCreateAnalyzer(CHANNEL_AUDIO, &success, 262144, 1, 1, "");
- if (success != 0) {
- fprintf(stderr, "XCreateAnalyzer CHANNEL_AUDIO failed: %d\n" ,success);
- }
- initAnalyzer(active_receiver,CHANNEL_AUDIO,AUDIO_WATERFALL_SAMPLES,width);
-
- return waterfall;
-}
+++ /dev/null
-/* Copyright (C)
-* 2017 - 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.
-*
-*/
-
-#ifndef _FREEDV_WATERFALL_H
-#define _FREEDV_WATERFALL_H
-
-#define AUDIO_WATERFALL_SAMPLES 256
-
-extern float *audio_samples;
-extern int audio_samples_index;
-
-extern void audio_waterfall_update();
-extern GtkWidget* audio_waterfall_init(int width,int height);
-extern void audio_waterfall_setup(int sample_rate,int cursor);
-
-#endif
-
#include "mode.h"
#include "alex.h"
#include "property.h"
+#include "radio.h"
+#include "vfo.h"
#define LINESDR
int band=band20;
int xvtr_band=BANDS;
+char* outOfBand="Out of band";
+int info_band;
+
/* --------------------------------------------------------------------------*/
/**
* @brief bandstack
BAND bands[BANDS+XVTRS] =
- {{"160",&bandstack160,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,1800000LL,2000000LL,0LL,0LL,0},
+ {{"136kHz",&bandstack136,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,135700LL,137800LL,0LL,0LL,0},
+ {"472kHz",&bandstack472,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,472000LL,479000LL,0LL,0LL,0},
+ {"160",&bandstack160,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,1800000LL,2000000LL,0LL,0LL,0},
{"80",&bandstack80,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,3500000LL,4000000LL,0LL,0LL,0},
{"60",&bandstack60,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,5330500LL,5403500LL,0LL,0LL,0},
{"40",&bandstack40,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,7000000LL,7300000LL,0LL,0LL,0},
#endif
{"GEN",&bandstackGEN,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
{"WWV",&bandstackWWV,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"136kHz",&bandstack136,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,135700LL,137800LL,0LL,0LL,0},
- {"472kHz",&bandstack472,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,472000LL,479000LL,0LL,0LL,0},
// XVTRS
{"",&bandstack_xvtr_0,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
{"",&bandstack_xvtr_1,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
g_print("get_band_from_frequency: %lld id %d\n",f,found);
return found;
}
+
+char* getFrequencyInfo(long long frequency,int filter_low,int filter_high) {
+ char* result=outOfBand;
+ int i;
+
+ long long flow=frequency+(long long)filter_low;
+ long long fhigh=frequency+(long long)filter_high;
+
+
+ int b;
+
+ info_band=BANDS+XVTRS;
+ for(b=0;b<BANDS+XVTRS;b++) {
+ BAND *band=band_get_band(b);
+ if(strlen(band->title)>0) {
+
+ if(flow>=band->frequencyMin && fhigh<=band->frequencyMax) {
+ if(b==band60) {
+ for(i=0;i<channel_entries;i++) {
+ long long low_freq=band_channels_60m[i].frequency-(band_channels_60m[i].width/(long long)2);
+ long long hi_freq=band_channels_60m[i].frequency+(band_channels_60m[i].width/(long long)2);
+ if(flow>=low_freq && fhigh<=hi_freq) {
+ info_band=b;
+ result=band->title;
+ break;
+ }
+ }
+ } else {
+ info_band=b;
+ result=band->title;
+ break;
+ }
+ }
+ }
+ }
+
+g_print("getFrequencyInfo %lld is %s\n",frequency,result);
+
+ return result;
+}
+
+int canTransmit() {
+ int result;
+ long long txfreq, flow, fhigh;
+ int txb, txvfo, txmode;
+ BAND *txband;
+ int i;
+
+ //
+ // If there is no transmitter, we cannot transmit
+ //
+ if (!can_transmit) return 0;
+
+ //
+ // In the code canTransmit() is always ORed with tx_out_of_band,
+ // but this should be done in ONE PLACE (here)
+ //
+ if (tx_out_of_band) return 1;
+
+ txvfo=get_tx_vfo();
+ txb=vfo[txvfo].band;
+
+ //
+ // See if we have a band
+ //
+if(info_band!=bandGen
+ && info_band!=bandWWV
+#ifdef SOAPYSDR
+ && info_band!=bandAIR
+#endif
+ ) {
+ result=TRUE;
+ }
+
+ if (txb == bandGen
+ || txb ==bandWWV
+#ifdef SOAPYSDR
+ || txb ==bandAIR
+#endif
+ ) return 0;
+
+ //
+ // Determine the edges of our band
+ // and the edges of our TX signal
+ //
+ txband=band_get_band(vfo[txvfo].band);
+ txfreq=get_tx_freq();
+ txmode=get_tx_mode();
+ switch (txmode) {
+ case modeCWU:
+ flow = fhigh = cw_is_on_vfo_freq ? txfreq : txfreq + cw_keyer_sidetone_frequency;
+ break;
+ case modeCWL:
+ flow = fhigh = cw_is_on_vfo_freq ? txfreq : txfreq - cw_keyer_sidetone_frequency;
+ break;
+ default:
+ flow = txfreq + transmitter->filter_low;
+ fhigh= txfreq + transmitter->filter_high;
+ break;
+ }
+
+ if (txb == band60) {
+ //
+ // For 60m band, ensure signal is within one of the "channels"
+ //
+ result=0;
+ for(i=0;i<channel_entries;i++) {
+ long long low_freq=band_channels_60m[i].frequency-(band_channels_60m[i].width/(long long)2);
+ long long hi_freq=band_channels_60m[i].frequency+(band_channels_60m[i].width/(long long)2);
+//fprintf(stderr,"TRY CHANNEL: low=%lld high=%lld SIGNAL: low=%lld high=%lld\n", low_freq, hi_freq, flow, fhigh);
+ if(flow>=low_freq && fhigh<=hi_freq) {
+//fprintf(stderr,"60m channel OK: chan=%d flow=%lld fhigh=%lld\n", i, flow, fhigh);
+ result = 1;
+ break;
+ }
+ }
+//fprintf(stderr,"60m channel NOT FOUND: flow=%lld fhigh=%lld\n", flow, fhigh);
+ } else {
+ //
+ // For other bands, return true if signal within band
+ //
+ result = flow >= txband->frequencyMin && fhigh <= txband->frequencyMax;
+ }
+//fprintf(stderr,"CANTRANSMIT: low=%lld high=%lld transmit=%d\n", flow, fhigh, result);
+ return result;
+}
+
+
+/*
+int canTransmit() {
+ int result=FALSE;
+ if (tx_out_of_band) return TRUE;
+ if(info_band!=bandGen
+ && info_band!=bandWWV
+#ifdef SOAPYSDR
+ && info_band!=bandAIR
+#endif
+ ) {
+ result=TRUE;
+ }
+ return result;
+}
+*/
#include <gtk/gtk.h>
#include "bandstack.h"
-#define band160 0
-#define band80 1
-#define band60 2
-#define band40 3
-#define band30 4
-#define band20 5
-#define band17 6
-#define band15 7
-#define band12 8
-#define band10 9
-#define band6 10
+enum {
+ band136=0,
+ band472,
+ band160,
+ band80,
+ band60,
+ band40,
+ band30,
+ band20,
+ band17,
+ band15,
+ band12,
+ band10,
+ band6,
#ifdef SOAPYSDR
-#define band70 11
-#define band220 13
-#define band430 14
-#define band902 15
-#define band1240 16
-#define band2300 17
-#define band3400 18
-#define bandAIR 19
-#define bandGen 20
-#define bandWWV 21
-#define band136 22
-#define band472 23
-#define BANDS 24
-#else
-#define bandGen 11
-#define bandWWV 12
-#define band136 13
-#define band472 14
-#define BANDS 15
+ band70,
+ band144,
+ band220,
+ band430,
+ band902,
+ band1240,
+ band2300,
+ band3400,
+ bandAIR,
#endif
+ bandWWV,
+ bandGen,
+ BANDS
+};
#define XVTRS 8
extern void bandSaveState();
extern void bandRestoreState();
+char* getFrequencyInfo(long long frequency,int filter_low,int filter_high);
+int canTransmit();
+
#endif
#define CHANNEL_BS 9
#define CHANNEL_SUBRX 10
#define CHANNEL_AUDIO 11
-#ifdef PSK
-#define CHANNEL_PSK 12
-#endif
#endif
#include "stemlab_discovery.h"
#endif
#include "ext.h"
+#include "gpio.h"
#include "configure.h"
static GtkWidget *discovery_dialog;
static char ipaddr_tcp_buf[IPADDR_LEN] = "10.10.10.10";
char *ipaddr_tcp = &ipaddr_tcp_buf[0];
+static gboolean delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) {
+ _exit(0);
+}
+
static gboolean start_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
radio=(DISCOVERED *)data;
#ifdef STEMLAB_DISCOVERY
#endif
#ifdef GPIO
+/*
static gboolean gpio_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
configure_gpio(discovery_dialog);
return TRUE;
}
+*/
+
+static void gpio_changed_cb(GtkWidget *widget, gpointer data) {
+ controller=gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+ gpio_set_defaults(controller);
+ gpio_save_state();
+}
#endif
static gboolean discover_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
//gtk_window_set_decorated(GTK_WINDOW(discovery_dialog),FALSE);
//gtk_widget_override_font(discovery_dialog, pango_font_description_from_string("FreeMono 16"));
+ g_signal_connect(discovery_dialog, "delete_event", G_CALLBACK(delete_event_cb), NULL);
GdkRGBA color;
color.red = 1.0;
//gtk_window_set_decorated(GTK_WINDOW(discovery_dialog),FALSE);
//gtk_widget_override_font(discovery_dialog, pango_font_description_from_string("FreeMono 16"));
+ g_signal_connect(discovery_dialog, "delete_event", G_CALLBACK(delete_event_cb), NULL);
GdkRGBA color;
color.red = 1.0;
}
#ifdef GPIO
+/*
GtkWidget *gpio_b=gtk_button_new_with_label("Config GPIO");
g_signal_connect (gpio_b, "button-press-event", G_CALLBACK(gpio_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),gpio_b,0,i,1,1);
+*/
+
+ controller=CONTROLLER2_V2;
+ gpio_set_defaults(controller);
+ gpio_restore_state();
+
+ GtkWidget *gpio=gtk_combo_box_text_new();
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(gpio),NULL,"No Controller");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(gpio),NULL,"Controller1");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(gpio),NULL,"Controller2 V1");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(gpio),NULL,"Controller2 V2");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(gpio),NULL,"Custom");
+ gtk_grid_attach(GTK_GRID(grid),gpio,0,i,1,1);
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(gpio),controller);
+ g_signal_connect(gpio,"changed",G_CALLBACK(gpio_changed_cb),NULL);
#endif
GtkWidget *discover_b=gtk_button_new_with_label("Discover");
row++;
col=0;
- GtkWidget *frames_per_second_label=gtk_label_new("Frames Per Second: ");
+ GtkWidget *frames_per_second_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(frames_per_second_label), "<b>Frames Per Second:</b>");
//gtk_widget_override_font(frames_per_second_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(frames_per_second_label);
gtk_grid_attach(GTK_GRID(grid),frames_per_second_label,col,row,1,1);
row++;
col=0;
- GtkWidget *panadapter_high_label=gtk_label_new("Panadapter High: ");
+ GtkWidget *panadapter_high_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(panadapter_high_label), "<b>Panadapter High: </b>");
//gtk_widget_override_font(panadapter_high_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(panadapter_high_label);
gtk_grid_attach(GTK_GRID(grid),panadapter_high_label,col,row,1,1);
row++;
col=0;
- GtkWidget *panadapter_low_label=gtk_label_new("Panadapter Low: ");
+ GtkWidget *panadapter_low_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(panadapter_low_label), "<b>Panadapter Low: </b>");
//gtk_widget_override_font(panadapter_low_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(panadapter_low_label);
gtk_grid_attach(GTK_GRID(grid),panadapter_low_label,col,row,1,1);
row++;
col=0;
- GtkWidget *panadapter_step_label=gtk_label_new("Panadapter Step: ");
+ GtkWidget *panadapter_step_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(panadapter_step_label), "<b>Panadapter Step: </b>");
//gtk_widget_override_font(panadapter_step_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(panadapter_step_label);
gtk_grid_attach(GTK_GRID(grid),panadapter_step_label,col,row,1,1);
row++;
col=0;
- GtkWidget *waterfall_automatic_label=gtk_label_new("Waterfall Automatic: ");
+ GtkWidget *waterfall_automatic_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(waterfall_automatic_label), "<b>Waterfall Automatic: </b>");
//gtk_widget_override_font(waterfall_automatic_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(waterfall_automatic_label);
gtk_grid_attach(GTK_GRID(grid),waterfall_automatic_label,col,row,1,1);
row++;
col=0;
- GtkWidget *waterfall_high_label=gtk_label_new("Waterfall High: ");
+ GtkWidget *waterfall_high_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(waterfall_high_label), "<b>Waterfall High: </b>");
//gtk_widget_override_font(waterfall_high_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(waterfall_high_label);
gtk_grid_attach(GTK_GRID(grid),waterfall_high_label,col,row,1,1);
row++;
col=0;
- GtkWidget *waterfall_low_label=gtk_label_new("Waterfall Low: ");
+ GtkWidget *waterfall_low_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(waterfall_low_label), "<b>Waterfall Low: </b>");
//gtk_widget_override_font(waterfall_low_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(waterfall_low_label);
gtk_grid_attach(GTK_GRID(grid),waterfall_low_label,col,row,1,1);
col=2;
row=1;
- GtkWidget *detector_mode_label=gtk_label_new("Detector: ");
+ GtkWidget *detector_mode_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(detector_mode_label), "<b>Detector:</b>");
//gtk_widget_override_font(detector_mode_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(detector_mode_label);
gtk_grid_attach(GTK_GRID(grid),detector_mode_label,col,row,1,1);
row=1;
GtkWidget *average_mode_label=gtk_label_new("Averaging: ");
+ gtk_label_set_markup(GTK_LABEL(average_mode_label), "<b>Averaging:</b>");
//gtk_widget_override_font(average_mode_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(average_mode_label);
gtk_grid_attach(GTK_GRID(grid),average_mode_label,col,row,1,1);
gtk_grid_attach(GTK_GRID(grid),gain_label,0,1,1,1);
gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0,+12.0,0.1);
+ gtk_range_set_increments (GTK_RANGE(gain_scale),1.0,1.0);
gtk_widget_set_size_request (gain_scale, 300, 25);
gtk_range_set_value(GTK_RANGE(gain_scale),div_gain);
gtk_widget_show(gain_scale);
gtk_grid_attach(GTK_GRID(grid),phase_label,0,2,1,1);
phase_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0,360.0,1.0);
+ gtk_range_set_increments (GTK_RANGE(phase_scale),1.0,1.0);
gtk_widget_set_size_request (phase_scale, 300, 25);
gtk_range_set_value(GTK_RANGE(phase_scale),div_phase);
gtk_widget_show(phase_scale);
g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
- GtkWidget *agc_hang_threshold_label=gtk_label_new("AGC Hang Threshold:");
+ GtkWidget *agc_hang_threshold_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(agc_hang_threshold_label), "<b>AGC Hang Threshold</b>");
gtk_widget_show(agc_hang_threshold_label);
gtk_grid_attach(GTK_GRID(grid),agc_hang_threshold_label,0,1,1,1);
GtkWidget *agc_hang_threshold_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0.0, 100.0, 1.0);
+ gtk_range_set_increments (GTK_RANGE(agc_hang_threshold_scale),1.0,1.0);
gtk_range_set_value (GTK_RANGE(agc_hang_threshold_scale),active_receiver->agc_hang_threshold);
gtk_widget_show(agc_hang_threshold_scale);
gtk_grid_attach(GTK_GRID(grid),agc_hang_threshold_scale,1,1,2,1);
g_signal_connect(G_OBJECT(agc_hang_threshold_scale),"value_changed",G_CALLBACK(agc_hang_threshold_value_changed_cb),NULL);
- GtkWidget *pre_post_agc_label=gtk_label_new("NR/NR2/ANF");
+ GtkWidget *pre_post_agc_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(pre_post_agc_label), "<b>NR/NR2/ANF</b>");
//gtk_widget_override_font(pre_post_agc_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(pre_post_agc_label);
gtk_grid_attach(GTK_GRID(grid),pre_post_agc_label,0,2,1,1);
gtk_grid_attach(GTK_GRID(grid),post_agc_b,2,2,1,1);
g_signal_connect(post_agc_b,"toggled",G_CALLBACK(pre_post_agc_cb),(gpointer *)1);
- GtkWidget *nr2_gain_label=gtk_label_new("NR2 Gain Method");
+ GtkWidget *nr2_gain_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(nr2_gain_label), "<b>NR Gain Method</b>");
//gtk_widget_override_font(nr2_gain_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(nr2_gain_label);
gtk_grid_attach(GTK_GRID(grid),nr2_gain_label,0,3,1,1);
g_signal_connect(gamma_b,"toggled",G_CALLBACK(nr2_gain_cb),(gpointer *)2);
GtkWidget *nr2_npe_method_label=gtk_label_new("NR2 NPE Method");
+ gtk_label_set_markup(GTK_LABEL(nr2_npe_method_label), "<b>NR2 NPE Method</b>");
//gtk_widget_override_font(nr2_npe_method_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(nr2_npe_method_label);
gtk_grid_attach(GTK_GRID(grid),nr2_npe_method_label,0,4,1,1);
#include "vfo.h"
#include "button_text.h"
#include "gpio.h"
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER_V1)
#include "i2c.h"
-#endif
static GtkWidget *parent_window=NULL;
static GtkWidget *b_squelch;
static GtkWidget *b_compression;
-#ifdef CONTROLLER2_V2
static GtkWidget *b_top_af_gain_rx1;
static GtkWidget *b_top_af_gain_rx2;
static GtkWidget *b_top_agc_gain_rx1;
static GtkWidget *b_top_panadapter_low;
static GtkWidget *b_top_squelch;
static GtkWidget *b_top_compression;
-#endif
enum {
ENC2,
-#ifdef CONTROLLER2_V2
ENC2_TOP,
-#endif
ENC2_SW,
ENC3,
-#ifdef CONTROLLER2_V2
ENC3_TOP,
-#endif
ENC3_SW,
ENC4,
-#ifdef CONTROLLER2_V2
ENC4_TOP,
-#endif
ENC4_SW,
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
ENC5,
-#if defined (CONTROLLER2_V2)
ENC5_TOP,
-#endif
ENC5_SW,
-#endif
};
typedef struct _choice {
case ENC2:
e2_encoder_action=choice->action;
break;
-#ifdef CONTROLLER2_V2
case ENC2_TOP:
e2_top_encoder_action=choice->action;
break;
-#endif
case ENC3:
e3_encoder_action=choice->action;
break;
-#ifdef CONTROLLER2_V2
case ENC3_TOP:
e3_top_encoder_action=choice->action;
break;
-#endif
case ENC4:
e4_encoder_action=choice->action;
break;
-#ifdef CONTROLLER2_V2
case ENC4_TOP:
e4_top_encoder_action=choice->action;
break;
-#endif
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
case ENC5:
e5_encoder_action=choice->action;
break;
-#endif
-#if defined (CONTROLLER2_V2)
case ENC5_TOP:
e5_top_encoder_action=choice->action;
break;
-#endif
}
gtk_button_set_label(GTK_BUTTON(choice->button),encoder_string[choice->action]);
}
case ENC4_SW:
e4_sw_action=choice->action;
break;
-#ifdef CONTROLLER2_V2
case ENC5_SW:
e5_sw_action=choice->action;
break;
-#endif
}
gtk_button_set_label(GTK_BUTTON(choice->button),sw_string[choice->action]);
}
case ENCODER_DRIVE:
button=b_drive;
break;
-/*
case ENCODER_TUNE_DRIVE:
button=b_tune_drive;
break;
-*/
case ENCODER_RIT_RX1:
button=b_rit_rx1;
break;
return button;
}
-#ifdef CONTROLLER2_V2
GtkWidget* getTopRadioButton(int action) {
GtkWidget* button;
switch(action) {
}
return button;
}
-#endif
-
static gboolean select_cb (GtkWidget *widget, gpointer data) {
GtkWidget *button;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
}
-#ifdef CONTROLLER2_V2
static gboolean top_select_cb (GtkWidget *widget, gpointer data) {
GtkWidget *button;
int action;
button=getTopRadioButton(action);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
}
-#endif
void encoder_select(int pos) {
int action;
}
-#ifdef CONTROLLER2_V2
void top_encoder_select(int pos) {
int action;
GtkWidget *button;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
}
-#endif
static gboolean action_select_cb (GtkWidget *widget, gpointer data) {
int action=(int)data;
}
}
-#ifdef CONTROLLER2_V2
static gboolean top_action_select_cb (GtkWidget *widget, gpointer data) {
int action=(int)data;
switch(encoder) {
break;
}
}
-#endif
static gboolean enc2_cb(GtkWidget *widget, gpointer data) {
int i=gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
return TRUE;
}
-#ifdef CONTROLLER2_V2
static gboolean enc2_top_cb(GtkWidget *widget, gpointer data) {
int i=gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
e2_top_encoder_action=i;
e5_top_encoder_action=i;
return TRUE;
}
-#endif
void encoder_menu(GtkWidget *parent) {
int row=0;
gtk_grid_attach(GTK_GRID(grid),close_b,col,row,1,1);
row++;
- col=1;
-#ifdef CONTROLLER2_V2
-#ifdef CONTROLLER2_V1
- GtkWidget *label_encoder=gtk_label_new("Encoder");
- gtk_grid_attach(GTK_GRID(grid),label_encoder,col,row,1,1);
- col++;
-#else
- GtkWidget *label_bottom=gtk_label_new("Bottom");
- gtk_grid_attach(GTK_GRID(grid),label_bottom,col,row,1,1);
- col++;
- GtkWidget *label_top=gtk_label_new("Top");
- gtk_grid_attach(GTK_GRID(grid),label_top,col,row,1,1);
- col++;
-#endif
-#else
- GtkWidget *label_encoder=gtk_label_new("Encoder");
+ col=0;
+ GtkWidget *label_encoder=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_encoder), "<b>Encoder</b>");
gtk_grid_attach(GTK_GRID(grid),label_encoder,col,row,1,1);
col++;
-#endif
- GtkWidget *label_switch=gtk_label_new("Switch");
+ if(controller==CONTROLLER2_V2) {
+ GtkWidget *label_bottom=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_bottom), "<b>Bottom</b>");
+ gtk_grid_attach(GTK_GRID(grid),label_bottom,col,row,1,1);
+ col++;
+ GtkWidget *label_top=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_top), "<b>Top</b>");
+ gtk_grid_attach(GTK_GRID(grid),label_top,col,row,1,1);
+ col++;
+ } else {
+ GtkWidget *label_bottom=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_bottom), "<b>Encoder</b>");
+ gtk_grid_attach(GTK_GRID(grid),label_bottom,col,row,1,1);
+ col++;
+ }
+ GtkWidget *label_switch=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label_switch), "<b>Switch</b>");
gtk_grid_attach(GTK_GRID(grid),label_switch,col,row,1,1);
col++;
row++;
col=0;
- GtkWidget *enc2_title=gtk_label_new("ENC2: ");
+ GtkWidget *enc2_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(enc2_title), "<b>ENC2: </b>");
gtk_grid_attach(GTK_GRID(grid),enc2_title,col,row,1,1);
col++;
g_signal_connect(enc2,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC2));
col++;
-#ifdef CONTROLLER2_V2
- GtkWidget *enc2_top=gtk_button_new_with_label(encoder_string[e2_top_encoder_action]);
- gtk_grid_attach(GTK_GRID(grid),enc2_top,col,row,1,1);
- g_signal_connect(enc2_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC2_TOP));
- col++;
-#endif
+ if(controller==CONTROLLER2_V2) {
+ GtkWidget *enc2_top=gtk_button_new_with_label(encoder_string[e2_top_encoder_action]);
+ gtk_grid_attach(GTK_GRID(grid),enc2_top,col,row,1,1);
+ g_signal_connect(enc2_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC2_TOP));
+ col++;
+ }
GtkWidget *enc2_sw=gtk_button_new_with_label(sw_string[e2_sw_action]);
gtk_grid_attach(GTK_GRID(grid),enc2_sw,col,row,1,1);
row++;
col=0;
- GtkWidget *enc3_title=gtk_label_new("ENC3: ");
+ GtkWidget *enc3_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(enc3_title), "<b>ENC3: </b>");
gtk_grid_attach(GTK_GRID(grid),enc3_title,col,row,1,1);
col++;
g_signal_connect(enc3,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC3));
col++;
-#ifdef CONTROLLER2_V2
- GtkWidget *enc3_top=gtk_button_new_with_label(encoder_string[e3_top_encoder_action]);
- gtk_grid_attach(GTK_GRID(grid),enc3_top,col,row,1,1);
- g_signal_connect(enc3_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC3_TOP));
- col++;
-#endif
+ if(controller==CONTROLLER2_V2) {
+ GtkWidget *enc3_top=gtk_button_new_with_label(encoder_string[e3_top_encoder_action]);
+ gtk_grid_attach(GTK_GRID(grid),enc3_top,col,row,1,1);
+ g_signal_connect(enc3_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC3_TOP));
+ col++;
+ }
GtkWidget *enc3_sw=gtk_button_new_with_label(sw_string[e3_sw_action]);
gtk_grid_attach(GTK_GRID(grid),enc3_sw,col,row,1,1);
row++;
col=0;
- GtkWidget *enc4_title=gtk_label_new("ENC4: ");
+ GtkWidget *enc4_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(enc4_title), "<b>ENC4: </b>");
gtk_grid_attach(GTK_GRID(grid),enc4_title,col,row,1,1);
col++;
g_signal_connect(enc4,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC4));
col++;
-#ifdef CONTROLLER2_V2
- GtkWidget *enc4_top=gtk_button_new_with_label(encoder_string[e4_top_encoder_action]);
- gtk_grid_attach(GTK_GRID(grid),enc4_top,col,row,1,1);
- g_signal_connect(enc4_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC4_TOP));
- col++;
-#endif
+ if(controller==CONTROLLER2_V2) {
+ GtkWidget *enc4_top=gtk_button_new_with_label(encoder_string[e4_top_encoder_action]);
+ gtk_grid_attach(GTK_GRID(grid),enc4_top,col,row,1,1);
+ g_signal_connect(enc4_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC4_TOP));
+ col++;
+ }
GtkWidget *enc4_sw=gtk_button_new_with_label(sw_string[e4_sw_action]);
gtk_grid_attach(GTK_GRID(grid),enc4_sw,col,row,1,1);
row++;
col=0;
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- GtkWidget *enc5_title=gtk_label_new("ENC5: ");
- gtk_grid_attach(GTK_GRID(grid),enc5_title,col,row,1,1);
- col++;
+ if(controller==CONTROLLER2_V1 || controller==CONTROLLER2_V2) {
+ GtkWidget *enc5_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(enc5_title), "<b>ENC5: </b>");
+ gtk_grid_attach(GTK_GRID(grid),enc5_title,col,row,1,1);
+ col++;
- GtkWidget *enc5=gtk_button_new_with_label(encoder_string[e5_encoder_action]);
- gtk_grid_attach(GTK_GRID(grid),enc5,col,row,1,1);
- g_signal_connect(enc5,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC5));
- col++;
+ GtkWidget *enc5=gtk_button_new_with_label(encoder_string[e5_encoder_action]);
+ gtk_grid_attach(GTK_GRID(grid),enc5,col,row,1,1);
+ g_signal_connect(enc5,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC5));
+ col++;
-#if defined (CONTROLLER2_V2)
- GtkWidget *enc5_top=gtk_button_new_with_label(encoder_string[e5_top_encoder_action]);
- gtk_grid_attach(GTK_GRID(grid),enc5_top,col,row,1,1);
- g_signal_connect(enc5_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC5_TOP));
- col++;
-#endif
+ if(controller==CONTROLLER2_V2) {
+ GtkWidget *enc5_top=gtk_button_new_with_label(encoder_string[e5_top_encoder_action]);
+ gtk_grid_attach(GTK_GRID(grid),enc5_top,col,row,1,1);
+ g_signal_connect(enc5_top,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC5_TOP));
+ col++;
+ }
- GtkWidget *enc5_sw=gtk_button_new_with_label(sw_string[e5_sw_action]);
- gtk_grid_attach(GTK_GRID(grid),enc5_sw,col,row,1,1);
- g_signal_connect(enc5_sw,"button_press_event",G_CALLBACK(sw_cb),GINT_TO_POINTER(ENC5_SW));
-#endif
+ GtkWidget *enc5_sw=gtk_button_new_with_label(sw_string[e5_sw_action]);
+ gtk_grid_attach(GTK_GRID(grid),enc5_sw,col,row,1,1);
+ g_signal_connect(enc5_sw,"button_press_event",G_CALLBACK(sw_cb),GINT_TO_POINTER(ENC5_SW));
+ }
gtk_container_add(GTK_CONTAINER(content),grid);
gtk_grid_attach(GTK_GRID(grid),enable_b,0,1,1,1);
- GtkWidget *label=gtk_label_new("Preamp");
+ GtkWidget *label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Preamp</b>");
gtk_grid_attach(GTK_GRID(grid),label,0,2,1,2);
- label=gtk_label_new("Low");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Low</b>");
gtk_grid_attach(GTK_GRID(grid),label,0,4,1,2);
- label=gtk_label_new("Mid");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Mid</b>");
gtk_grid_attach(GTK_GRID(grid),label,0,6,1,2);
- label=gtk_label_new("High");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>High</b>");
gtk_grid_attach(GTK_GRID(grid),label,0,8,1,2);
preamp_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0,15.0,1.0);
+ gtk_range_set_increments (GTK_RANGE(preamp_scale),1.0,1.0);
if(can_transmit) {
gtk_range_set_value(GTK_RANGE(preamp_scale),(double)tx_equalizer[0]);
} else {
gtk_scale_add_mark(GTK_SCALE(preamp_scale),15.0,GTK_POS_LEFT,"15dB");
low_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0,15.0,1.0);
+ gtk_range_set_increments (GTK_RANGE(low_scale),1.0,1.0);
if(can_transmit) {
gtk_range_set_value(GTK_RANGE(low_scale),(double)tx_equalizer[1]);
} else {
gtk_scale_add_mark(GTK_SCALE(low_scale),15.0,GTK_POS_LEFT,"15dB");
mid_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0,15.0,1.0);
+ gtk_range_set_increments (GTK_RANGE(mid_scale),1.0,1.0);
if(can_transmit) {
gtk_range_set_value(GTK_RANGE(mid_scale),(double)tx_equalizer[2]);
} else {
gtk_scale_add_mark(GTK_SCALE(mid_scale),15.0,GTK_POS_LEFT,"15dB");
high_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0,15.0,1.0);
+ gtk_range_set_increments (GTK_RANGE(high_scale),1.0,1.0);
if(can_transmit) {
gtk_range_set_value(GTK_RANGE(high_scale),(double)tx_equalizer[3]);
} else {
int row=0;
int col=0;
- GtkWidget *close_b=gtk_button_new_with_label("Close");
+ GtkWidget *close_b=gtk_button_new_with_label("Cancel");
g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),close_b,col,row,1,1);
}
int ext_update_squelch(void *data) {
- set_squelch();
+ set_squelch(active_receiver);
return 0;
}
return 0;
}
+#ifdef PURESIGNAL
+int ext_start_ps(void *data) {
+ start_ps();
+ return 0;
+}
+#endif
+
int ext_sat_update(void *data) {
switch(sat_mode) {
case SAT_NONE:
int ext_set_duplex(void *data);
int ext_update_noise(void *data);
+#ifdef PURESIGNAL
+int ext_start_ps(void *data);
+#endif
int row=1;
int col=0;
- GtkWidget *filter_type_label=gtk_label_new("Filter Type: ");
+ GtkWidget *filter_type_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(filter_type_label), "<b>Filter Type</b>");
gtk_grid_attach(GTK_GRID(grid),filter_type_label,col,row,1,1);
row++;
{-3300,3300,"Var2"}
};
-#ifdef PSK
-FILTER filterPSK[FILTERS]={
- {150,5150,"5.0k"},
- {150,4550,"4.4k"},
- {150,3950,"3.8k"},
- {150,3150,"3k"},
- {150,3050,"2.9k"},
- {150,2850,"2.7k"},
- {150,2550,"2.4k"},
- {150,2250,"2.1k"},
- {150,1950,"1.8k"},
- {150,1150,"1.0k"},
- {150,2850,"Var1"},
- {150,2850,"Var2"}
- };
-#endif
-
-
FILTER *filters[]={
filterLSB
,filterUSB
,filterDIGL
,filterSAM
,filterDRM
-#ifdef PSK
- ,filterPSK
-#endif
-
};
+gint filter_step=5;
+
void filterSaveState() {
char value[128];
fprintf(stderr,"filter_width_changed: rx=%d mode=%d filter=%d increment=%d\n",rx,vfo[id].mode,vfo[id].filter,increment);
if(vfo[id].filter==filterVar1 || vfo[id].filter==filterVar2) {
- filter->high=filter->high+increment;
-fprintf(stderr,"filter->low=%d filter->high=%d\n",filter->low,filter->high);
- if(vfo[id].mode==modeCWL || vfo[id].mode==modeCWU) {
- filter->low=filter->high;
+
+ switch(vfo[id].mode) {
+ case modeCWL:
+ case modeLSB:
+ case modeDIGL:
+ filter->low=filter->low-(increment*filter_step);
+ break;
+ case modeCWU:
+ case modeUSB:
+ case modeDIGU:
+ filter->high=filter->high+(increment*filter_step);
+ break;
+ default:
+ filter->low=filter->low-(increment*filter_step);
+ filter->high=filter->high+(increment*filter_step);
+ break;
}
vfo_filter_changed(vfo[id].filter);
- int width=filter->high-filter->low;
- if(vfo[id].mode==modeCWL || vfo[id].mode==modeCWU) {
- width=filter->high;
- } else {
- if(width<0) width=filter->low-filter->high;
+ set_filter_width(id,filter->high-filter->low);
+ }
+}
+
+void filter_shift_changed(int rx,int increment) {
+ int id=receiver[rx]->id;
+ FILTER *mode_filters=filters[vfo[id].mode];
+ FILTER *filter=&mode_filters[vfo[id].filter];
+
+fprintf(stderr,"filter_shift_changed: rx=%d mode=%d filter=%d increment=%d\n",rx,vfo[id].mode,vfo[id].filter,increment);
+
+ if(vfo[id].filter==filterVar1 || vfo[id].filter==filterVar2) {
+ switch(vfo[id].mode) {
+ case modeCWL:
+ case modeLSB:
+ case modeDIGL:
+ filter->low=filter->low+(increment*filter_step);
+ filter->high=filter->high+(increment*filter_step);
+ set_filter_shift(id,filter->high);
+ break;
+ case modeCWU:
+ case modeUSB:
+ case modeDIGU:
+ filter->low=filter->low+(increment*filter_step);
+ filter->high=filter->high+(increment*filter_step);
+ set_filter_shift(id,filter->low);
+ break;
+
+ default:
+ // not for AM, FM, DSB
+ break;
}
- set_filter_width(id,width);
+ vfo_filter_changed(vfo[id].filter);
}
+
}
#define filterVar1 10
#define filterVar2 11
-int filter;
+extern int filter;
-int filterLow;
-int filterHigh;
+extern int filterLow;
+extern int filterHigh;
-int txFilterLowCut;
-int txFilterHighCut;
+extern int txFilterLowCut;
+extern int txFilterHighCut;
-FILTER *filters[MODES];
+extern FILTER *filters[MODES];
-void filterSaveState();
-void filterRestoreState();
-void filter_width_changed(int rx,int increment);
+extern gint filter_step;
+
+extern void filterSaveState();
+extern void filterRestoreState();
+extern void filter_width_changed(int rx,int increment);
+extern void filter_shift_changed(int rx,int increment);
#endif
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <codec2/freedv_api.h>
-#include <wdsp.h>
-
-#include "freedv.h"
-#include "audio_waterfall.h"
-#include "channel.h"
-#include "property.h"
-#include "radio.h"
-#include "receiver.h"
-#include "transmitter.h"
-
-#define min(x,y) (x<y?x:y)
-
-static struct freedv* modem;
-
-int n_speech_samples;
-int n_max_modem_samples;
-int n_nom_modem_samples;
-short *speech_out;
-short *demod_in;
-short *speech_in;
-short *mod_out;
-int rx_samples_in;
-int tx_samples_in;
-int samples_out;
-int nin;
-
-int freedv_sync;
-float freedv_snr;
-
-int freedv_rate;
-int freedv_resample;
-
-int freedv_mode=FREEDV_MODE_1600;
-
-int freedv_sq_enable=1;
-double freedv_snr_sq_threshold=0.0;
-
-double freedv_audio_gain=0.2;
-
-static int initialized=0;
-
-static char *mode_string[]={
-"1600",
-"700",
-"700B",
-"2400A",
-"2400B",
-"800XA",
-"700C"};
-
-char* freedv_get_mode_string() {
- return mode_string[freedv_mode];
-}
-
-void freedv_save_state() {
- char name[128];
- char value[128];
-
- sprintf(name,"freedv_mode");
- sprintf(value,"%d",freedv_mode);
- setProperty(name,value);
- sprintf(name,"freedv_audio_gain");
- sprintf(value,"%f",freedv_audio_gain);
- setProperty(name,value);
-}
-
-void freedv_restore_state() {
- char name[128];
- char *value;
-
- sprintf(name,"freedv_mode");
- value=getProperty(name);
- if(value) freedv_mode=atoi(value);
- sprintf(name,"freedv_audio_gain");
- value=getProperty(name);
- if(value) freedv_audio_gain=atof(value);
-}
-
-void freedv_set_mode(RECEIVER *rx,int m) {
- if(initialized) {
- g_mutex_lock(&rx->freedv_mutex);
- close_freedv(rx);
- freedv_mode=m;
- init_freedv(rx);
- g_mutex_unlock(&rx->freedv_mutex);
- } else {
- freedv_mode=m;
- }
-}
-
-static void text_data(char c) {
- int i;
- if(c==0x0D) {
- c='|';
- }
- for(i=0;i<62;i++) {
- active_receiver->freedv_text_data[i]=active_receiver->freedv_text_data[i+1];
- }
- active_receiver->freedv_text_data[62]=c;
-}
-
-static void my_put_next_rx_char(void *callback_state, char c) {
- //fprintf(stderr, "freedv: my_put_next_rx_char: %c sync=%d\n", c, freedv_sync);
- if(freedv_sync) {
- text_data(c);
- }
-}
-
-
-static char my_get_next_tx_char(void *callback_state){
- char c=transmitter->freedv_text_data[transmitter->freedv_text_index++];
- if(c==0) {
- c=0x0D;
- transmitter->freedv_text_index=0;
- }
-//fprintf(stderr,"freedv: my_get_next_tx_char=%c\n",c);
- //text_data(c);
- return c;
-}
-
-static void initAnalyzer(RECEIVER *rx,int channel, int buffer_size, int pixels) {
- int flp[] = {0};
- double keep_time = 0.1;
- int n_pixout=1;
- int spur_elimination_ffts = 1;
- int data_type = 0;
- int fft_size = 1024;
- int window_type = 4;
- double kaiser_pi = 14.0;
- int overlap = 0;
- int clip = 0;
- int span_clip_l = 0;
- int span_clip_h = 0;
- int stitches = 1;
- int calibration_data_set = 0;
- double span_min_freq = 0.0;
- double span_max_freq = 0.0;
-
- int max_w = fft_size + (int) min(keep_time * (double) rx->fps, keep_time * (double) fft_size * (double) rx->fps);
-
- SetAnalyzer(channel,
- n_pixout,
- spur_elimination_ffts, //number of LO frequencies = number of ffts used in elimination
- data_type, //0 for real input data (I only); 1 for complex input data (I & Q)
- flp, //vector with one elt for each LO frequency, 1 if high-side LO, 0 otherwise
- fft_size, //size of the fft, i.e., number of input samples
- buffer_size, //number of samples transferred for each OpenBuffer()/CloseBuffer()
- window_type, //integer specifying which window function to use
- kaiser_pi, //PiAlpha parameter for Kaiser window
- overlap, //number of samples each fft (other than the first) is to re-use from the previous
- clip, //number of fft output bins to be clipped from EACH side of each sub-span
- span_clip_l, //number of bins to clip from low end of entire span
- span_clip_h, //number of bins to clip from high end of entire span
- pixels, //number of pixel values to return. may be either <= or > number of bins
- stitches, //number of sub-spans to concatenate to form a complete span
- calibration_data_set, //identifier of which set of calibration data to use
- span_min_freq, //frequency at first pixel value8192
- span_max_freq, //frequency at last pixel value
- max_w //max samples to hold in input ring buffers
- );
-
-}
-
-void init_freedv(RECEIVER *rx) {
- int i, success;
-fprintf(stderr,"init_freedv\n");
-
- modem=freedv_open(freedv_mode);
- if(modem==NULL) {
- fprintf(stderr,"freedv_open: modem is null\n");
- return;
- }
-
- freedv_set_snr_squelch_thresh(modem, (float)freedv_snr_sq_threshold);
- freedv_set_squelch_en(modem, freedv_sq_enable);
-
- n_speech_samples = freedv_get_n_speech_samples(modem);
- n_max_modem_samples = freedv_get_n_max_modem_samples(modem);
- n_nom_modem_samples = freedv_get_n_nom_modem_samples(modem);
-fprintf(stderr,"n_speech_samples=%d n_max_modem_samples=%d n_nom_modem_samples=%d\n",n_speech_samples, n_max_modem_samples,n_nom_modem_samples);
- speech_out = (short*)malloc(sizeof(short)*n_speech_samples);
- demod_in = (short*)malloc(sizeof(short)*n_max_modem_samples);
- speech_in = (short*)malloc(sizeof(short)*n_speech_samples);
- mod_out = (short*)malloc(sizeof(short)*n_nom_modem_samples);
- //spectrum = (float*)malloc(sizeof(float)*n_nom_modem_samples);
-
- for(i=0;i<63;i++) {
- rx->freedv_text_data[i]=' ';
- }
- rx->freedv_text_data[63]=0;
-
- nin = freedv_nin(modem);
- rx_samples_in=0;
- tx_samples_in=0;
- freedv_set_callback_txt(modem, &my_put_next_rx_char, &my_get_next_tx_char, NULL);
- //freedv_set_callback_protocol(modem, &my_put_next_rx_proto, NULL, NULL);
- //freedv_set_callback_data(modem, my_datarx, my_datatx, NULL);
-
- freedv_rate=freedv_get_modem_sample_rate(modem);
- freedv_resample=48000/freedv_rate;
-fprintf(stderr,"freedv modem sample nin=%d rate=%d resample=%d\n",nin, freedv_rate, freedv_resample);
-
- SetRXAPanelGain1 (rx->id, freedv_audio_gain);
-/*
- XCreateAnalyzer(CHANNEL_AUDIO, &success, 262144, 1, 1, "");
- if (success != 0) {
- fprintf(stderr, "XCreateAnalyzer CHANNEL_AUDIO failed: %d\n" ,success);
- }
- initAnalyzer(rx,CHANNEL_AUDIO,n_nom_modem_samples,200);
-
- audio_waterfall_setup(freedv_rate,1500);
-*/
-
- initialized=1;
-}
-
-void close_freedv(RECEIVER *rx) {
-fprintf(stderr,"freedv_close rx=%p\n",rx);
- initialized=0;
- if(modem!=NULL) {
- freedv_close(modem);
- } else {
- fprintf(stderr,"freedv_close: modem is null\n");
- }
- modem=NULL;
-/*
- DestroyAnalyzer(CHANNEL_AUDIO);
-*/
- SetRXAPanelGain1 (rx->id, rx->volume);
-}
-
-int demod_sample_freedv(short sample) {
- int nout=0;
- if(initialized) {
- demod_in[rx_samples_in]=sample;
- rx_samples_in++;
- if(rx_samples_in==nin) {
- nout=freedv_rx(modem,speech_out,demod_in);
- nin=freedv_nin(modem);
- rx_samples_in=0;
- freedv_get_modem_stats(modem, &freedv_sync, &freedv_snr);
- }
-#ifdef AUDIO_WATERFALL
- if(audio_samples!=NULL) {
- audio_samples[audio_samples_index]=(float)sample;
- audio_samples_index++;
- if(audio_samples_index>=AUDIO_WATERFALL_SAMPLES) {
- Spectrum(CHANNEL_AUDIO,0,0,audio_samples,audio_samples);
- audio_samples_index=0;
- }
- }
-#endif
- }
- return nout;
-}
-
-int mod_sample_freedv(short sample) {
- int i;
- int nout=0;
- if(initialized) {
- speech_in[tx_samples_in]=sample;
- tx_samples_in++;
- if(tx_samples_in==n_speech_samples) {
- freedv_tx(modem,mod_out,speech_in);
- tx_samples_in=0;
- nout=n_nom_modem_samples;
-#ifdef AUDIO_WATERFALL
- for(i=0;i<n_nom_modem_samples;i++) {
- audio_samples[audio_samples_index]=(float)mod_out[i];
- audio_samples_index++;
- if(audio_samples_index>=AUDIO_WATERFALL_SAMPLES) {
- Spectrum(CHANNEL_AUDIO,0,0,audio_samples,audio_samples);
- audio_samples_index=0;
- }
- }
-#endif
- }
- }
- return nout;
-}
-
-void freedv_reset_tx_text_index() {
- transmitter->freedv_text_index=0;
-}
-
-void freedv_set_sq_enable(int state) {
-fprintf(stderr,"freedv_set_sq_enable: state=%d modem=%p\n", state,modem);
- freedv_sq_enable=state;
- if(modem!=NULL) {
- freedv_set_squelch_en(modem, freedv_sq_enable);
- }
-}
-
-void freedv_set_sq_threshold(double threshold) {
- freedv_snr_sq_threshold=threshold;
- if(modem!=NULL) {
- freedv_set_snr_squelch_thresh(modem, freedv_snr_sq_threshold);
- }
-}
-
-void freedv_set_audio_gain(double gain) {
- freedv_audio_gain=gain;
- if(modem!=NULL) {
- SetRXAPanelGain1 (active_receiver->id, freedv_audio_gain);
- }
-}
+++ /dev/null
-/* Copyright (C)
-* 2016 - 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.
-*
-*/
-
-#ifndef _FREEDV_H
-#define _FREEDV_H
-
-#include "receiver.h"
-
-extern int n_speech_samples;
-extern int n_max_modem_samples;
-extern short *demod_in;
-extern short *speech_out;
-extern short *speech_in;
-extern short *mod_out;
-
-extern int freedv_sync;
-extern float freedv_snr;
-
-extern int freedv_rate;
-extern int freedv_resample;
-
-extern int freedv_mode;
-
-extern char freedv_text_data[64];
-
-extern int freedv_sq_enable;
-extern double freedv_snr_sq_threshold;
-
-extern double freedv_audio_gain;
-
-extern float *freedv_samples;
-
-extern void freedv_save_state();
-extern void freedv_restore_state();
-extern void init_freedv(RECEIVER *rx);
-extern void close_freedv(RECEIVER *rx);
-extern int demod_sample_freedv(short sample);
-extern int mod_sample_freedv(short sample);
-extern void freedv_reset_tx_text_index();
-extern void freedv_set_mode(RECEIVER *rx,int m);
-extern void init_freedv(RECEIVER *rx);
-extern void close_freedv(RECEIVER *rx);
-extern int demod_sample_freedv(short sample);
-extern int mod_sample_freedv(short sample);
-extern void freedv_reset_tx_text_index();
-extern void freedv_set_mode(RECEIVER *rx,int m);
-extern void freedv_set_sq_enable(int state);
-extern void freedv_set_sq_threshold(double threshold);
-extern void freedv_set_audio_gain(double gain);
-extern char* freedv_get_mode_string();
-
-#endif
+++ /dev/null
-/*
-* 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 <gtk/gtk.h>
-#include <semaphore.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <codec2/freedv_api.h>
-#include <wdsp.h>
-
-#include "new_menu.h"
-#include "freedv_menu.h"
-#include "freedv.h"
-#include "radio.h"
-#include "receiver.h"
-#include "vfo.h"
-#include "ext.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 freedv_text_changed_cb(GtkWidget *widget, gpointer data) {
- strcpy(transmitter->freedv_text_data,gtk_entry_get_text(GTK_ENTRY(widget)));
-}
-
-static void enable_cb(GtkWidget *widget, gpointer data) {
- set_freedv(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
-}
-
-static void sq_enable_cb(GtkWidget *widget, gpointer data) {
- freedv_set_sq_enable(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
-}
-
-static void sq_spin_cb (GtkWidget *widget, gpointer data) {
- freedv_set_sq_threshold(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget)));
-}
-
-static void audio_spin_cb (GtkWidget *widget, gpointer data) {
- freedv_set_audio_gain(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget)));
-}
-
-static void mode_cb(GtkWidget *widget, gpointer data) {
- int mode=GPOINTER_TO_INT(data);
- freedv_set_mode(active_receiver,mode);
-}
-
-void freedv_menu(GtkWidget *parent) {
- int i,j;
-
- 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);
- gtk_window_set_title(GTK_WINDOW(dialog),"piHPSDR - FreeDV");
- 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, "pressed", G_CALLBACK(close_cb), NULL);
- gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
-
- GtkWidget *freedv_text_label=gtk_label_new("Tx Message: ");
- gtk_grid_attach(GTK_GRID(grid),freedv_text_label,0,1,1,1);
-
- GtkWidget *freedv_text=gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(freedv_text),transmitter->freedv_text_data);
- gtk_grid_attach(GTK_GRID(grid),freedv_text,1,1,3,1);
- g_signal_connect(freedv_text,"changed",G_CALLBACK(freedv_text_changed_cb),NULL);
-
-
- GtkWidget *enable=gtk_check_button_new_with_label("Enable FreeDV");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable), active_receiver->freedv);
- gtk_grid_attach(GTK_GRID(grid),enable,0,2,1,1);
- g_signal_connect(enable,"toggled",G_CALLBACK(enable_cb),NULL);
-
- GtkWidget *sq_enable=gtk_check_button_new_with_label("SNR Squelch Enable (dB)");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sq_enable), freedv_sq_enable);
- gtk_grid_attach(GTK_GRID(grid),sq_enable,1,2,1,1);
- g_signal_connect(sq_enable,"toggled",G_CALLBACK(sq_enable_cb),NULL);
-
- GtkWidget *sq_spin=gtk_spin_button_new_with_range(-5.0,15.0,0.5);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(sq_spin),freedv_snr_sq_threshold);
- gtk_grid_attach(GTK_GRID(grid),sq_spin,2,2,1,1);
- g_signal_connect(sq_spin,"value-changed",G_CALLBACK(sq_spin_cb),NULL);
-
- GtkWidget *mode_1600=gtk_radio_button_new_with_label(NULL,"1600");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_1600), freedv_mode==FREEDV_MODE_1600);
- gtk_widget_show(mode_1600);
- gtk_grid_attach(GTK_GRID(grid),mode_1600,0,4,1,1);
- g_signal_connect(mode_1600,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_1600);
-
- GtkWidget *mode_700=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mode_1600),"700");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_700), freedv_mode==FREEDV_MODE_700);
- gtk_widget_show(mode_700);
- gtk_grid_attach(GTK_GRID(grid),mode_700,1,4,1,1);
- g_signal_connect(mode_700,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_700);
-
- GtkWidget *mode_700B=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mode_700),"700B");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_700B), freedv_mode==FREEDV_MODE_700B);
- gtk_widget_show(mode_700B);
- gtk_grid_attach(GTK_GRID(grid),mode_700B,2,4,1,1);
- g_signal_connect(mode_700B,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_700B);
-
- GtkWidget *mode_2400A=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mode_700B),"2400A");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_2400A), freedv_mode==FREEDV_MODE_2400A);
- gtk_widget_show(mode_2400A);
- gtk_grid_attach(GTK_GRID(grid),mode_2400A,0,5,1,1);
- g_signal_connect(mode_2400A,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_2400A);
-
- GtkWidget *mode_2400B=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mode_2400A),"2400B");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_2400B), freedv_mode==FREEDV_MODE_2400B);
- gtk_widget_show(mode_2400B);
- gtk_grid_attach(GTK_GRID(grid),mode_2400B,1,5,1,1);
- g_signal_connect(mode_2400B,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_2400B);
-
- GtkWidget *mode_800XA=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mode_2400B),"800XA");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_800XA), freedv_mode==FREEDV_MODE_800XA);
- gtk_widget_show(mode_800XA);
- gtk_grid_attach(GTK_GRID(grid),mode_800XA,2,5,1,1);
- g_signal_connect(mode_800XA,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_800XA);
-
- GtkWidget *mode_700C=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(mode_800XA),"700C");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mode_700C), freedv_mode==FREEDV_MODE_700C);
- gtk_widget_show(mode_700C);
- gtk_grid_attach(GTK_GRID(grid),mode_700C,3,5,1,1);
- g_signal_connect(mode_700C,"pressed",G_CALLBACK(mode_cb),(gpointer *)FREEDV_MODE_700C);
-
- GtkWidget *freedv_audio_label=gtk_label_new("Audio Gain: ");
- gtk_grid_attach(GTK_GRID(grid),freedv_audio_label,0,6,1,1);
-
- GtkWidget *audio_spin=gtk_spin_button_new_with_range(0.0,1.0,0.1);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(audio_spin),freedv_audio_gain);
- gtk_grid_attach(GTK_GRID(grid),audio_spin,1,6,1,1);
- g_signal_connect(audio_spin,"value-changed",G_CALLBACK(audio_spin_cb),NULL);
-
- gtk_container_add(GTK_CONTAINER(content),grid);
-
- sub_menu=dialog;
-
- gtk_widget_show_all(dialog);
-
-}
-
+++ /dev/null
-/* 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.
-*
-*/
-
-extern void freedv_menu(GtkWidget *parent);
#include "property.h"
#include "vfo.h"
#include "wdsp.h"
-#ifdef PSK
-#include "psk.h"
-#endif
#include "new_menu.h"
#include "encoder_menu.h"
#include "diversity_menu.h"
#include "gpio.h"
-#if defined (CONTROLLER2_V2) || defined(CONTROLLER2_V1)
#include "i2c.h"
-#endif
#include "ext.h"
#include "sliders.h"
#include "new_protocol.h"
int settle_time=DEFAULT_SETTLE_TIME;
static gint release_timer=-1;
-#if defined (CONTROLLER2_V1)
-// uses wiringpi pin numbers
-int ENABLE_VFO_ENCODER=1;
-int ENABLE_VFO_PULLUP=1;
-int VFO_ENCODER_A=1;
-int VFO_ENCODER_B=0;
-int ENABLE_E2_ENCODER=1;
-int ENABLE_E2_PULLUP=1;
-int E2_ENCODER_A=28;
-int E2_ENCODER_B=25;
-int E2_FUNCTION=3;
-int ENABLE_E3_ENCODER=1;
-int ENABLE_E3_PULLUP=1;
-int E3_ENCODER_A=7;
-int E3_ENCODER_B=29;
-int E3_FUNCTION=2;
-int ENABLE_E4_ENCODER=1;
-int ENABLE_E4_PULLUP=1;
-int E4_ENCODER_A=27;
-int E4_ENCODER_B=24;
-int E4_FUNCTION=4;
-int ENABLE_E5_ENCODER=1;
-int ENABLE_E5_PULLUP=1;
-int E5_ENCODER_A=6;
-int E5_ENCODER_B=10;
-int E5_FUNCTION=5;
-
-int ENABLE_E2_BUTTON=1;
-int ENABLE_E3_BUTTON=1;
-int ENABLE_E4_BUTTON=1;
-int ENABLE_E5_BUTTON=1;
+int controller;
int I2C_INTERRUPT=16;
-#endif
-#if defined (CONTROLLER2_V2)
-// uses wiringpi pin numbers
-int ENABLE_VFO_ENCODER=1;
-int ENABLE_VFO_PULLUP=0;
-int VFO_ENCODER_A=1;
-int VFO_ENCODER_B=0;
-int ENABLE_E2_ENCODER=1;
-int ENABLE_E2_PULLUP=1;
-int E2_ENCODER_A=21;
-int E2_ENCODER_B=22;
-int E2_TOP_ENCODER_A=25;
-int E2_TOP_ENCODER_B=28;
-int E2_FUNCTION=3;
-int ENABLE_E3_ENCODER=1;
-int ENABLE_E3_PULLUP=1;
-int E3_ENCODER_A=13;
-int E3_ENCODER_B=11;
-int E3_TOP_ENCODER_A=29;
-int E3_TOP_ENCODER_B=7;
-int E3_FUNCTION=2;
-int ENABLE_E4_ENCODER=1;
-int ENABLE_E4_PULLUP=1;
-int E4_ENCODER_A=14;
-int E4_ENCODER_B=12;
-int E4_TOP_ENCODER_A=24;
-int E4_TOP_ENCODER_B=27;
-int E4_FUNCTION=4;
-int ENABLE_E5_ENCODER=1;
-int ENABLE_E5_PULLUP=1;
-int E5_ENCODER_A=23;
-int E5_ENCODER_B=26;
-int E5_TOP_ENCODER_A=10;
-int E5_TOP_ENCODER_B=6;
-int E5_FUNCTION=5;
-
-int ENABLE_E2_BUTTON=1;
-int ENABLE_E3_BUTTON=1;
-int ENABLE_E4_BUTTON=1;
-int ENABLE_E5_BUTTON=1;
-int I2C_INTERRUPT=16;
-#endif
-
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1)
// uses wiringpi pin numbers
-int ENABLE_VFO_ENCODER=1;
-int ENABLE_VFO_PULLUP=1;
-int VFO_ENCODER_A=1;
-int VFO_ENCODER_B=0;
-int ENABLE_E2_ENCODER=1;
-int ENABLE_E2_PULLUP=0;
-int E2_ENCODER_A=28;
-int E2_ENCODER_B=25;
-int E2_FUNCTION=6;
-int ENABLE_E3_ENCODER=1;
-int ENABLE_E3_PULLUP=0;
-int E3_ENCODER_A=27;
-int E3_ENCODER_B=24;
-int E3_FUNCTION=10;
-int ENABLE_E4_ENCODER=1;
-int ENABLE_E4_PULLUP=0;
-int E4_ENCODER_A=7;
-int E4_ENCODER_B=29;
-int E4_FUNCTION=11;
-int ENABLE_S1_BUTTON=1;
-int S1_BUTTON=23;
-int ENABLE_S2_BUTTON=1;
-int S2_BUTTON=26;
-int ENABLE_S3_BUTTON=1;
-int S3_BUTTON=22;
-int ENABLE_S4_BUTTON=1;
-int S4_BUTTON=21;
-int ENABLE_S5_BUTTON=1;
-int S5_BUTTON=5;
-int ENABLE_S6_BUTTON=1;
-int S6_BUTTON=4;
-int ENABLE_MOX_BUTTON=1;
-int MOX_BUTTON=2;
-int ENABLE_FUNCTION_BUTTON=1;
-int FUNCTION_BUTTON=3;
-int ENABLE_E2_BUTTON=1;
-int ENABLE_E3_BUTTON=1;
-int ENABLE_E4_BUTTON=1;
-#endif
+int ENABLE_VFO_ENCODER;
+int ENABLE_VFO_PULLUP;
+int VFO_ENCODER_A;
+int VFO_ENCODER_B;
+int ENABLE_E2_ENCODER;
+int ENABLE_E2_PULLUP;
+int E2_ENCODER_A;
+int E2_ENCODER_B;
+int ENABLE_E2_TOP_ENCODER;
+int E2_TOP_ENCODER_A;
+int E2_TOP_ENCODER_B;
+int E2_FUNCTION;
+int ENABLE_E3_ENCODER;
+int ENABLE_E3_PULLUP;
+int E3_ENCODER_A;
+int E3_ENCODER_B;
+int ENABLE_E3_TOP_ENCODER;
+int E3_TOP_ENCODER_A;
+int E3_TOP_ENCODER_B;
+int E3_FUNCTION;
+int ENABLE_E4_ENCODER;
+int ENABLE_E4_PULLUP;
+int E4_ENCODER_A;
+int E4_ENCODER_B;
+int ENABLE_E4_TOP_ENCODER;
+int E4_TOP_ENCODER_A;
+int E4_TOP_ENCODER_B;
+int E4_FUNCTION;
+int ENABLE_E5_ENCODER;
+int ENABLE_E5_PULLUP;
+int E5_ENCODER_A;
+int E5_ENCODER_B;
+int ENABLE_E5_TOP_ENCODER;
+int E5_TOP_ENCODER_A;
+int E5_TOP_ENCODER_B;
+int E5_FUNCTION;
+
+int ENABLE_E2_BUTTON;
+int ENABLE_E3_BUTTON;
+int ENABLE_E4_BUTTON;
+int ENABLE_E5_BUTTON;
+
+int ENABLE_S1_BUTTON;
+int S1_BUTTON;
+int ENABLE_S2_BUTTON;
+int S2_BUTTON;
+int ENABLE_S3_BUTTON;
+int S3_BUTTON;
+int ENABLE_S4_BUTTON;
+int S4_BUTTON;
+int ENABLE_S5_BUTTON;
+int S5_BUTTON;
+int ENABLE_S6_BUTTON;
+int S6_BUTTON;
+int ENABLE_MOX_BUTTON;
+int MOX_BUTTON;
+int ENABLE_FUNCTION_BUTTON;
+int FUNCTION_BUTTON;
+int ENABLE_E2_BUTTON;
+int ENABLE_E3_BUTTON;
+int ENABLE_E4_BUTTON;
+
#ifdef LOCALCW
int CWL_BUTTON=14;
int vfoEncoderPos;
int vfoFunction;
-#if defined (CONTROLLER2_V1)
-int e2EncoderPos;
-int e2_sw_action=MENU_BAND;
-int e2_encoder_action=ENCODER_AF_GAIN_RX1;
-int e3EncoderPos;
-int e3_sw_action=MENU_MODE;
-int e3_encoder_action=ENCODER_AGC_GAIN_RX1;
-int e4EncoderPos;
-int e4_sw_action=MENU_FILTER;
-int e4_encoder_action=ENCODER_IF_WIDTH_RX1;
-int e5EncoderPos;
-int e5_sw_action=MENU_FREQUENCY;
-int e5_encoder_action=ENCODER_DRIVE;
-#endif
-
-#if defined (CONTROLLER2_V2)
int e2EncoderPos;
-int e2_sw_action=MENU_BAND;
-int e2_encoder_action=ENCODER_AF_GAIN_RX2;
+int e2_sw_action;
+int e2_encoder_action;
int e3EncoderPos;
-int e3_sw_action=MENU_MODE;
-int e3_encoder_action=ENCODER_AGC_GAIN_RX2;
+int e3_sw_action;
+int e3_encoder_action;
int e4EncoderPos;
-int e4_sw_action=MENU_FILTER;
-int e4_encoder_action=ENCODER_IF_WIDTH_RX2;
+int e4_sw_action;
+int e4_encoder_action;
int e5EncoderPos;
-int e5_sw_action=MENU_FREQUENCY;
-int e5_encoder_action=ENCODER_DRIVE;
-#endif
+int e5_sw_action;
+int e5_encoder_action;
-#if defined (CONTROLLER2_V2)
-int e2_top_encoder_action=ENCODER_AF_GAIN_RX1;
-int e3_top_encoder_action=ENCODER_AGC_GAIN_RX1;
-int e4_top_encoder_action=ENCODER_IF_WIDTH_RX1;
-int e5_top_encoder_action=ENCODER_TUNE_DRIVE;
int e2TopEncoderPos;
+int e2_top_encoder_action;
int e3TopEncoderPos;
+int e3_top_encoder_action;
int e4TopEncoderPos;
+int e4_top_encoder_action;
int e5TopEncoderPos;
-#endif
-
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1)
-int e2EncoderPos;
-int e2_sw_action=RIT;
-int e2_encoder_action=ENCODER_AF_GAIN_RX1;
-int e3EncoderPos;
-int e3_sw_action=AGC;
-int e3_encoder_action=ENCODER_AGC_GAIN_RX1;
-int e4EncoderPos;
-int e4_sw_action=BAND_PLUS;
-int e4_encoder_action=ENCODER_DRIVE;
-#endif
+int e5_top_encoder_action;
static volatile int function_state;
static volatile int band_state;
static int running=0;
char *encoder_string[ENCODER_ACTIONS] = {
+ "NO ACTION",
+ "AF GAIN",
+ "RF GAIN",
+ "AGC GAIN",
+ "IF WIDTH",
+ "IF SHIFT",
"AF GAIN RX1",
"RF GAIN RX1",
"AF GAIN RX2",
"AGC GAIN RX2",
"IF WIDTH RX1",
"IF WIDTH RX2",
- "ATTENUATION",
+ "IF SHIFT RX1",
+ "IF SHIFT RX2",
+ "ATTENUATION/RX GAIN",
"MIC GAIN",
"DRIVE",
"TUNE DRIVE",
+ "RIT",
"RIT RX1",
"RIT RX2",
"XIT",
"CW FREQUENCY",
"PANADAPTER HIGH",
"PANADAPTER LOW",
+ "PANADAPTER STEP",
+ "WATERFALL HIGH",
+ "WATERFALL LOW",
"SQUELCH",
+ "SQUELCH RX1",
+ "SQUELCH RX2",
"COMP",
"DIVERSITY GAIN",
"DIVERSITY PHASE"};
char *sw_string[SWITCH_ACTIONS] = {
- "NO ACTION",
+ "",
"TUNE",
"MOX",
"PS",
"NB",
"SNB",
"RIT",
- "RIT Clear",
+ "RIT CL",
"XIT",
- "XIT Clear",
- "BAND PLUS",
- "BAND MINUS",
- "BANDSTACK PLUS",
- "BANDSTACK MINUS",
- "MODE PLUS",
- "MODE MINUS",
- "FILTER PLUS",
- "FILTER MINUS",
+ "XIT CL",
+ "BAND +",
+ "BAND -",
+ "BSTACK +",
+ "BSTACK -",
+ "MODE +",
+ "MODE -",
+ "FILTER +",
+ "FILTER -",
"A TO B",
"B TO A",
"A SWAP B",
"CTUN",
"AGC",
"SPLIT",
- "DIVERSITY",
+ "DIV",
"SAT",
- "BAND MENU",
- "BANDSTACK MENU",
- "MODE MENU",
- "FILTER MENU",
- "FREQUENCY MENU",
- "MEMORY MENU",
- "DIVERSITY MENU",
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1)
+ "BAND",
+ "BSTACK",
+ "MODE",
+ "FILTER",
+ "FREQUENCY",
+ "MEMORY",
+ "DIV MENU",
+ "PS MENU",
"FUNCTION",
-#endif
};
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
-int sw_action[SWITCHES] = {TUNE,MOX,PS,TWO_TONE,NR,A_TO_B,B_TO_A,MODE_MINUS,BAND_MINUS,MODE_PLUS,BAND_PLUS,XIT,NB,SNB,LOCK,CTUN};
-#endif
+int *sw_action=NULL;
static int mox_pressed(void *data) {
if(running) sim_mox_cb(NULL,NULL);
case MENU_DIVERSITY:
g_idle_add(ext_diversity_update,GINT_TO_POINTER(1));
break;
-#if !defined (CONTROLLER2_V1) && !defined (CONTROLLER2_V2)
+#ifdef PURESIGNAL
+ case MENU_PS:
+ g_idle_add(ext_start_ps,NULL);
+ break;
+#endif
case FUNCTION:
g_idle_add(ext_function_update,NULL);
break;
-#endif
}
return 0;
}
}
}
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
static unsigned long e5debounce=0;
static void e5FunctionAlert() {
if(running) g_idle_add(e_function_pressed,(gpointer)e5_sw_action);
}
}
-#endif
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1)
static int function_level=1;
static unsigned long function_debounce=0;
mox_debounce=t+settle_time;
}
}
-#endif
+
#ifdef VFO_HAS_FUNCTION
}
}
-#if defined (CONTROLLER2_V2)
static void e2TopEncoderInt() {
static int e2TopCurrentA=1;
int levelA=digitalRead(E2_TOP_ENCODER_A);
e2TopCurrentA=levelA;
}
}
-#endif
static void e3EncoderInt() {
static int e3CurrentA=1;
}
}
-#if defined (CONTROLLER2_V2)
static void e3TopEncoderInt() {
static int e3TopCurrentA=1;
int levelA=digitalRead(E3_TOP_ENCODER_A);
e3TopCurrentA=levelA;
}
}
-#endif
static void e4EncoderInt() {
static int e4CurrentA=1;
}
}
-#if defined (CONTROLLER2_V2)
static void e4TopEncoderInt() {
static int e4TopCurrentA=1;
int levelA=digitalRead(E4_TOP_ENCODER_A);
e4TopCurrentA=levelA;
}
}
-#endif
-
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
static void e5EncoderInt() {
static int e5CurrentA=1;
int levelA=digitalRead(E5_ENCODER_A);
e5CurrentA=levelA;
}
}
-#endif
-#if defined (CONTROLLER2_V2)
static void e5TopEncoderInt() {
static int e5TopCurrentA=1;
int levelA=digitalRead(E5_TOP_ENCODER_A);
e5TopCurrentA=levelA;
}
}
-#endif
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
static void pI2CInterrupt() {
int level=digitalRead(I2C_INTERRUPT);
if(level==0) {
i2c_interrupt();
}
}
-#endif
+
+void gpio_set_defaults(int ctrlr) {
+g_print("gpio_set_defaults: %d\n",ctrlr);
+ if(sw_action!=NULL) {
+ g_free(sw_action);
+ sw_action=NULL;
+ }
+ switch(ctrlr) {
+ case NO_CONTROLLER:
+ ENABLE_VFO_ENCODER=0;
+ ENABLE_E2_ENCODER=0;
+ ENABLE_E3_ENCODER=0;
+ ENABLE_E4_ENCODER=0;
+ ENABLE_S1_BUTTON=0;
+ ENABLE_S2_BUTTON=0;
+ ENABLE_S3_BUTTON=0;
+ ENABLE_S4_BUTTON=0;
+ ENABLE_S5_BUTTON=0;
+ ENABLE_S6_BUTTON=0;
+ ENABLE_MOX_BUTTON=0;
+ ENABLE_FUNCTION_BUTTON=0;
+ ENABLE_E2_BUTTON=0;
+ ENABLE_E3_BUTTON=0;
+ ENABLE_E4_BUTTON=0;
+ ENABLE_E5_BUTTON=0;
+ ENABLE_E5_ENCODER=0;
+ ENABLE_E2_TOP_ENCODER=0;
+ ENABLE_E3_TOP_ENCODER=0;
+ ENABLE_E4_TOP_ENCODER=0;
+ ENABLE_E5_TOP_ENCODER=0;
+ break;
+ case CONTROLLER1:
+ sw_action=g_new(int,CONTROLLER1_SWITCHES);
+ ENABLE_VFO_ENCODER=1;
+ ENABLE_VFO_PULLUP=1;
+ VFO_ENCODER_A=1;
+ VFO_ENCODER_B=0;
+ ENABLE_E2_ENCODER=1;
+ ENABLE_E2_PULLUP=0;
+ E2_ENCODER_A=28;
+ E2_ENCODER_B=25;
+ E2_FUNCTION=6;
+ ENABLE_E3_ENCODER=1;
+ ENABLE_E3_PULLUP=0;
+ E3_ENCODER_A=27;
+ E3_ENCODER_B=24;
+ E3_FUNCTION=10;
+ ENABLE_E4_ENCODER=1;
+ ENABLE_E4_PULLUP=0;
+ E4_ENCODER_A=7;
+ E4_ENCODER_B=29;
+ E4_FUNCTION=11;
+ ENABLE_S1_BUTTON=1;
+ S1_BUTTON=23;
+ ENABLE_S2_BUTTON=1;
+ S2_BUTTON=26;
+ ENABLE_S3_BUTTON=1;
+ S3_BUTTON=22;
+ ENABLE_S4_BUTTON=1;
+ S4_BUTTON=21;
+ ENABLE_S5_BUTTON=1;
+ S5_BUTTON=5;
+ ENABLE_S6_BUTTON=1;
+ S6_BUTTON=4;
+ ENABLE_MOX_BUTTON=1;
+ MOX_BUTTON=2;
+ ENABLE_FUNCTION_BUTTON=1;
+ FUNCTION_BUTTON=3;
+ ENABLE_E2_BUTTON=1;
+ ENABLE_E3_BUTTON=1;
+ ENABLE_E4_BUTTON=1;
+ ENABLE_E5_BUTTON=0;
+ ENABLE_E5_ENCODER=0;
+ ENABLE_E2_TOP_ENCODER=0;
+ ENABLE_E3_TOP_ENCODER=0;
+ ENABLE_E4_TOP_ENCODER=0;
+ ENABLE_E5_TOP_ENCODER=0;
+ e2_sw_action=MENU_BAND;
+ e2_encoder_action=ENCODER_AF_GAIN;
+ e3_sw_action=MENU_BANDSTACK;
+ e3_encoder_action=ENCODER_AGC_GAIN;
+ e4_sw_action=MENU_MODE;
+ e4_encoder_action=ENCODER_DRIVE;
+ e2_top_encoder_action=ENCODER_NO_ACTION;
+ e3_top_encoder_action=ENCODER_NO_ACTION;
+ e4_top_encoder_action=ENCODER_NO_ACTION;
+ e5_encoder_action=ENCODER_NO_ACTION;
+ e5_top_encoder_action=ENCODER_NO_ACTION;
+ break;
+ case CONTROLLER2_V1:
+ // uses wiringpi pin numbers
+ ENABLE_VFO_ENCODER=1;
+ ENABLE_VFO_PULLUP=1;
+ VFO_ENCODER_A=1;
+ VFO_ENCODER_B=0;
+ ENABLE_E2_ENCODER=1;
+ ENABLE_E2_PULLUP=1;
+ E2_ENCODER_A=28;
+ E2_ENCODER_B=25;
+ E2_FUNCTION=3;
+ ENABLE_E3_ENCODER=1;
+ ENABLE_E3_PULLUP=1;
+ E3_ENCODER_A=7;
+ E3_ENCODER_B=29;
+ E3_FUNCTION=2;
+ ENABLE_E4_ENCODER=1;
+ ENABLE_E4_PULLUP=1;
+ E4_ENCODER_A=27;
+ E4_ENCODER_B=24;
+ E4_FUNCTION=4;
+ ENABLE_E5_ENCODER=1;
+ ENABLE_E5_PULLUP=1;
+ E5_ENCODER_A=6;
+ E5_ENCODER_B=10;
+ E5_FUNCTION=5;
+ ENABLE_E2_BUTTON=1;
+ ENABLE_E3_BUTTON=1;
+ ENABLE_E4_BUTTON=1;
+ ENABLE_E5_BUTTON=1;
+ ENABLE_S1_BUTTON=0;
+ ENABLE_S2_BUTTON=0;
+ ENABLE_S3_BUTTON=0;
+ ENABLE_S4_BUTTON=0;
+ ENABLE_S5_BUTTON=0;
+ ENABLE_S6_BUTTON=0;
+ ENABLE_E2_TOP_ENCODER=0;
+ ENABLE_E3_TOP_ENCODER=0;
+ ENABLE_E4_TOP_ENCODER=0;
+ ENABLE_E5_TOP_ENCODER=0;
+ sw_action=g_new(int,CONTROLLER2_SWITCHES);
+ sw_action[0]=MOX;
+ sw_action[1]=TUNE;
+ sw_action[2]=PS;
+ sw_action[3]=TWO_TONE;
+ sw_action[4]=NR;
+ sw_action[5]=A_TO_B;
+ sw_action[6]=B_TO_A;
+ sw_action[7]=MODE_MINUS;
+ sw_action[8]=BAND_MINUS;
+ sw_action[9]=MODE_PLUS;
+ sw_action[10]=BAND_PLUS;
+ sw_action[11]=XIT;
+ sw_action[12]=NB;
+ sw_action[13]=SNB;
+ sw_action[14]=LOCK;
+ sw_action[15]=CTUN;
+ e2_sw_action=MENU_BAND;
+ e2_encoder_action=ENCODER_AF_GAIN;
+ e3_sw_action=MENU_BANDSTACK;
+ e3_encoder_action=ENCODER_AGC_GAIN;
+ e4_sw_action=MENU_MODE;
+ e4_encoder_action=ENCODER_IF_WIDTH;
+ e5_sw_action=MENU_FREQUENCY;
+ e5_encoder_action=ENCODER_RIT;
+ e2_top_encoder_action=ENCODER_NO_ACTION;
+ e3_top_encoder_action=ENCODER_NO_ACTION;
+ e4_top_encoder_action=ENCODER_NO_ACTION;
+ e5_top_encoder_action=ENCODER_NO_ACTION;
+ break;
+ case CONTROLLER2_V2:
+ // uses wiringpi pin numbers
+ ENABLE_VFO_ENCODER=1;
+ ENABLE_VFO_PULLUP=0;
+ VFO_ENCODER_A=1;
+ VFO_ENCODER_B=0;
+ ENABLE_E2_ENCODER=1;
+ ENABLE_E2_PULLUP=1;
+ E2_ENCODER_A=21;
+ E2_ENCODER_B=22;
+ ENABLE_E2_TOP_ENCODER=1;
+ E2_TOP_ENCODER_A=25;
+ E2_TOP_ENCODER_B=28;
+ E2_FUNCTION=3;
+ ENABLE_E3_ENCODER=1;
+ ENABLE_E3_PULLUP=1;
+ E3_ENCODER_A=13;
+ E3_ENCODER_B=11;
+ ENABLE_E3_TOP_ENCODER=1;
+ E3_TOP_ENCODER_A=29;
+ E3_TOP_ENCODER_B=7;
+ E3_FUNCTION=2;
+ ENABLE_E4_ENCODER=1;
+ ENABLE_E4_PULLUP=1;
+ E4_ENCODER_A=14;
+ E4_ENCODER_B=12;
+ ENABLE_E4_TOP_ENCODER=1;
+ E4_TOP_ENCODER_A=24;
+ E4_TOP_ENCODER_B=27;
+ E4_FUNCTION=4;
+ ENABLE_E5_ENCODER=1;
+ ENABLE_E5_PULLUP=1;
+ E5_ENCODER_A=23;
+ E5_ENCODER_B=26;
+ ENABLE_E5_TOP_ENCODER=1;
+ E5_TOP_ENCODER_A=10;
+ E5_TOP_ENCODER_B=6;
+ E5_FUNCTION=5;
+ ENABLE_E2_BUTTON=1;
+ ENABLE_E3_BUTTON=1;
+ ENABLE_E4_BUTTON=1;
+ ENABLE_E5_BUTTON=1;
+ ENABLE_S1_BUTTON=0;
+ ENABLE_S2_BUTTON=0;
+ ENABLE_S3_BUTTON=0;
+ ENABLE_S4_BUTTON=0;
+ ENABLE_S5_BUTTON=0;
+ ENABLE_S6_BUTTON=0;
+ sw_action=g_new(int,CONTROLLER2_SWITCHES);
+ sw_action[0]=MOX;
+ sw_action[1]=TUNE;
+ sw_action[2]=PS;
+ sw_action[3]=TWO_TONE;
+ sw_action[4]=NR;
+ sw_action[5]=A_TO_B;
+ sw_action[6]=B_TO_A;
+ sw_action[7]=MODE_MINUS;
+ sw_action[8]=BAND_MINUS;
+ sw_action[9]=MODE_PLUS;
+ sw_action[10]=BAND_PLUS;
+ sw_action[11]=XIT;
+ sw_action[12]=NB;
+ sw_action[13]=SNB;
+ sw_action[14]=LOCK;
+ sw_action[15]=CTUN;
+ e2_sw_action=MENU_BAND;
+ e2_top_encoder_action=ENCODER_AF_GAIN;
+ e2_encoder_action=ENCODER_RF_GAIN;
+ e3_sw_action=MENU_MODE;
+ e3_top_encoder_action=ENCODER_AGC_GAIN;
+ e3_encoder_action=ENCODER_ATTENUATION;
+ e4_sw_action=MENU_FILTER;
+ e4_top_encoder_action=ENCODER_IF_SHIFT;
+ e4_encoder_action=ENCODER_IF_WIDTH;
+ e5_sw_action=MENU_FREQUENCY;
+ e5_top_encoder_action=ENCODER_RIT;
+ e5_encoder_action=ENCODER_XIT;
+ break;
+ default:
+ break;
+ }
+g_print("controller=%d e2_encoder_action: %d\n",ctrlr,e2_encoder_action);
+}
void gpio_restore_actions() {
char* value;
char name[80];
int i;
+g_print("gpio_restore_actions: controller=%d\n",controller);
+ if(sw_action!=NULL) {
+ g_free(sw_action);
+ sw_action=NULL;
+ }
+
+ gpio_set_defaults(controller);
+
value=getProperty("settle_time");
if(value) settle_time=atoi(value);
+
value=getProperty("e2_encoder_action");
if(value) e2_encoder_action=atoi(value);
value=getProperty("e2_sw_action");
if(value) e4_encoder_action=atoi(value);
value=getProperty("e4_sw_action");
if(value) e4_sw_action=atoi(value);
-
-#if defined (CONTROLLER2_V2)
value=getProperty("e2_top_encoder_action");
if(value) e2_top_encoder_action=atoi(value);
value=getProperty("e3_top_encoder_action");
if(value) e3_top_encoder_action=atoi(value);
value=getProperty("e4_top_encoder_action");
if(value) e4_top_encoder_action=atoi(value);
-#endif
-
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
value=getProperty("e5_encoder_action");
if(value) e5_encoder_action=atoi(value);
-#if defined (CONTROLLER2_V2)
value=getProperty("e5_top_encoder_action");
if(value) e5_top_encoder_action=atoi(value);
-#endif
value=getProperty("e5_sw_action");
if(value) e5_sw_action=atoi(value);
- for(i=0;i<SWITCHES;i++) {
+
+ int switches=0;
+ switch(controller) {
+ case CONTROLLER1:
+ //switches=CONTROLLER1_SWITCHES;
+ switches=0;
+ break;
+ case CONTROLLER2_V1:
+ case CONTROLLER2_V2:
+ switches=CONTROLLER2_SWITCHES;
+ break;
+ default:
+ switches=0;
+ break;
+ }
+
+ for(i=0;i<switches;i++) {
sprintf(name,"sw_action[%d]",i);
value=getProperty(name);
if(value) sw_action[i]=atoi(value);
}
-#endif
-
+g_print("e2_encoder_action: %d\n",e2_encoder_action);
}
void gpio_restore_state() {
char* value;
loadProperties("gpio.props");
+ value=getProperty("controller");
+ if(value) controller=atoi(value);
value=getProperty("ENABLE_VFO_ENCODER");
if(value) ENABLE_VFO_ENCODER=atoi(value);
value=getProperty("ENABLE_VFO_PULLUP");
if(value) E4_ENCODER_A=atoi(value);
value=getProperty("E4_ENCODER_B");
if(value) E4_ENCODER_B=atoi(value);
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
value=getProperty("ENABLE_E5_ENCODER");
if(value) ENABLE_E5_ENCODER=atoi(value);
value=getProperty("ENABLE_E5_PULLUP");
if(value) E5_ENCODER_A=atoi(value);
value=getProperty("E5_ENCODER_B");
if(value) E5_ENCODER_B=atoi(value);
-#endif
-#if !defined (CONTROLLER2_V2) && !defined(CONTROLLER2_V1)
value=getProperty("ENABLE_S1_BUTTON");
if(value) ENABLE_S1_BUTTON=atoi(value);
value=getProperty("S1_BUTTON");
if(value) ENABLE_MOX_BUTTON=atoi(value);
value=getProperty("MOX_BUTTON");
if(value) MOX_BUTTON=atoi(value);
-#endif
value=getProperty("ENABLE_E2_BUTTON");
if(value) ENABLE_E2_BUTTON=atoi(value);
+ value=getProperty("E2_FUNCTION");
+ if(value) E2_FUNCTION=atoi(value);
value=getProperty("ENABLE_E3_BUTTON");
if(value) ENABLE_E3_BUTTON=atoi(value);
+ value=getProperty("E3_FUNCTION");
+ if(value) E3_FUNCTION=atoi(value);
value=getProperty("ENABLE_E4_BUTTON");
if(value) ENABLE_E4_BUTTON=atoi(value);
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
+ value=getProperty("E4_FUNCTION");
+ if(value) E4_FUNCTION=atoi(value);
value=getProperty("ENABLE_E5_BUTTON");
if(value) ENABLE_E5_BUTTON=atoi(value);
-#endif
+ value=getProperty("E5_FUNCTION");
+ if(value) E5_FUNCTION=atoi(value);
+
#ifdef LOCALCW
value=getProperty("ENABLE_CW_BUTTONS");
if(value) ENABLE_CW_BUTTONS=atoi(value);
char name[80];
char value[80];
+g_print("gpio_save_actions: controller=%d\n",controller);
sprintf(value,"%d",settle_time);
setProperty("settle_time",value);
sprintf(value,"%d",e2_sw_action);
setProperty("e4_sw_action",value);
sprintf(value,"%d",e4_encoder_action);
setProperty("e4_encoder_action",value);
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
sprintf(value,"%d",e5_sw_action);
setProperty("e5_sw_action",value);
sprintf(value,"%d",e5_encoder_action);
setProperty("e5_encoder_action",value);
-#endif
-#if defined (CONTROLLER2_V2)
sprintf(value,"%d",e2_top_encoder_action);
setProperty("e2_top_encoder_action",value);
sprintf(value,"%d",e3_top_encoder_action);
setProperty("e4_top_encoder_action",value);
sprintf(value,"%d",e5_top_encoder_action);
setProperty("e5_top_encoder_action",value);
-#endif
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- for(i=0;i<SWITCHES;i++) {
- sprintf(name,"sw_action[%d]",i);
- sprintf(value,"%d",sw_action[i]);
- setProperty(name,value);
+ int switches=0;
+ switch(controller) {
+ case CONTROLLER1:
+ //switches=CONTROLLER1_SWITCHES;
+ switches=0;
+ break;
+ case CONTROLLER2_V1:
+ case CONTROLLER2_V2:
+ switches=CONTROLLER2_SWITCHES;
+ break;
+ default:
+ switches=0;
+ break;
}
-#endif
-
+ if(sw_action!=NULL) {
+ for(i=0;i<switches;i++) {
+ sprintf(name,"sw_action[%d]",i);
+ sprintf(value,"%d",sw_action[i]);
+ setProperty(name,value);
+ }
+ }
+g_print("e2_encoder_action: %d\n",e2_encoder_action);
}
void gpio_save_state() {
char value[80];
+ clearProperties();
+ sprintf(value,"%d",controller);
+ setProperty("controller",value);
sprintf(value,"%d",ENABLE_VFO_ENCODER);
setProperty("ENABLE_VFO_ENCODER",value);
sprintf(value,"%d",ENABLE_VFO_PULLUP);
setProperty("E4_ENCODER_A",value);
sprintf(value,"%d",E4_ENCODER_B);
setProperty("E4_ENCODER_B",value);
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
sprintf(value,"%d",ENABLE_E5_ENCODER);
setProperty("ENABLE_E5_ENCODER",value);
sprintf(value,"%d",ENABLE_E5_PULLUP);
setProperty("E5_ENCODER_A",value);
sprintf(value,"%d",E5_ENCODER_B);
setProperty("E5_ENCODER_B",value);
-#endif
-#if !defined(CONTROLLER2_V2) && !defined(CONTROLLER2_V1)
sprintf(value,"%d",ENABLE_S1_BUTTON);
setProperty("ENABLE_S1_BUTTON",value);
sprintf(value,"%d",S1_BUTTON);
setProperty("ENABLE_MOX_BUTTON",value);
sprintf(value,"%d",MOX_BUTTON);
setProperty("MOX_BUTTON",value);
-#endif
sprintf(value,"%d",ENABLE_E2_BUTTON);
setProperty("ENABLE_E2_BUTTON",value);
+ sprintf(value,"%d",E2_FUNCTION);
+ setProperty("E2_FUNCTION",value);
sprintf(value,"%d",ENABLE_E3_BUTTON);
setProperty("ENABLE_E3_BUTTON",value);
+ sprintf(value,"%d",E3_FUNCTION);
+ setProperty("E3_FUNCTION",value);
sprintf(value,"%d",ENABLE_E4_BUTTON);
setProperty("ENABLE_E4_BUTTON",value);
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
+ sprintf(value,"%d",E4_FUNCTION);
+ setProperty("E4_FUNCTION",value);
sprintf(value,"%d",ENABLE_E5_BUTTON);
setProperty("ENABLE_E5_BUTTON",value);
-#endif
+ sprintf(value,"%d",E5_FUNCTION);
+ setProperty("E5_FUNCTION",value);
#ifdef LOCALCW
sprintf(value,"%d",ENABLE_CW_BUTTONS);
setProperty("ENABLE_CW_BUTTONS",value);
wiringPiSetup(); // use WiringPi pin numbers
if(ENABLE_VFO_ENCODER) {
-#ifdef CONTROLLER2_V2
#ifdef VFO_HAS_FUNCTION
setup_pin(VFO_FUNCTION, PUD_UP, &vfoFunctionAlert);
vfoFunction=0;
#endif
setup_encoder_pin(VFO_ENCODER_A,ENABLE_VFO_PULLUP?PUD_UP:PUD_DOWN,&vfoEncoderInt);
setup_encoder_pin(VFO_ENCODER_B,ENABLE_VFO_PULLUP?PUD_UP:PUD_DOWN,NULL);
-#else
- setup_encoder_pin(VFO_ENCODER_A,ENABLE_VFO_PULLUP?PUD_UP:PUD_DOWN,&vfoEncoderInt);
- setup_encoder_pin(VFO_ENCODER_B,ENABLE_VFO_PULLUP?PUD_UP:PUD_DOWN,NULL);
-#endif
vfoEncoderPos=0;
}
e2EncoderPos=0;
-#ifdef CONTROLLER2_V2
- setup_encoder_pin(E2_TOP_ENCODER_A,ENABLE_E2_PULLUP?PUD_UP:PUD_OFF,&e2TopEncoderInt);
- setup_encoder_pin(E2_TOP_ENCODER_B,ENABLE_E2_PULLUP?PUD_UP:PUD_OFF,NULL);
- e2TopEncoderPos=0;
-#endif
+ if(controller==CONTROLLER2_V2) {
+ setup_encoder_pin(E2_TOP_ENCODER_A,ENABLE_E2_PULLUP?PUD_UP:PUD_OFF,&e2TopEncoderInt);
+ setup_encoder_pin(E2_TOP_ENCODER_B,ENABLE_E2_PULLUP?PUD_UP:PUD_OFF,NULL);
+ e2TopEncoderPos=0;
+ }
}
if(ENABLE_E3_ENCODER) {
setup_encoder_pin(E3_ENCODER_B,ENABLE_E3_PULLUP?PUD_UP:PUD_OFF,NULL);
e3EncoderPos=0;
-#ifdef CONTROLLER2_V2
- setup_encoder_pin(E3_TOP_ENCODER_A,ENABLE_E3_PULLUP?PUD_UP:PUD_OFF,&e3TopEncoderInt);
- setup_encoder_pin(E3_TOP_ENCODER_B,ENABLE_E3_PULLUP?PUD_UP:PUD_OFF,NULL);
- e3TopEncoderPos=0;
-#endif
+ if(controller==CONTROLLER2_V2) {
+ setup_encoder_pin(E3_TOP_ENCODER_A,ENABLE_E3_PULLUP?PUD_UP:PUD_OFF,&e3TopEncoderInt);
+ setup_encoder_pin(E3_TOP_ENCODER_B,ENABLE_E3_PULLUP?PUD_UP:PUD_OFF,NULL);
+ e3TopEncoderPos=0;
+ }
}
if(ENABLE_E4_ENCODER) {
setup_encoder_pin(E4_ENCODER_B,ENABLE_E4_PULLUP?PUD_UP:PUD_OFF,NULL);
e4EncoderPos=0;
-#ifdef CONTROLLER2_V2
- setup_encoder_pin(E4_TOP_ENCODER_A,ENABLE_E4_PULLUP?PUD_UP:PUD_OFF,&e4TopEncoderInt);
- setup_encoder_pin(E4_TOP_ENCODER_B,ENABLE_E4_PULLUP?PUD_UP:PUD_OFF,NULL);
- e4TopEncoderPos=0;
-#endif
- }
-
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- if(ENABLE_E5_ENCODER) {
- setup_pin(E5_FUNCTION, PUD_UP, &e5FunctionAlert);
-
- setup_encoder_pin(E5_ENCODER_A,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,&e5EncoderInt);
- setup_encoder_pin(E5_ENCODER_B,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,NULL);
- e5EncoderPos=0;
-
-#if defined (CONTROLLER2_V2)
- setup_encoder_pin(E5_TOP_ENCODER_A,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,&e5TopEncoderInt);
- setup_encoder_pin(E5_TOP_ENCODER_B,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,NULL);
- e5TopEncoderPos=0;
-#endif
- }
-#endif
-
-#if !defined (CONTROLLER2_V2) && !defined(CONTROLLER2_V1)
- if(ENABLE_FUNCTION_BUTTON) {
- setup_pin(FUNCTION_BUTTON, PUD_UP, &functionAlert);
- }
-
- if(ENABLE_MOX_BUTTON) {
- setup_pin(MOX_BUTTON, PUD_UP, &moxAlert);
- }
-
- if(ENABLE_S1_BUTTON) {
- setup_pin(S1_BUTTON, PUD_UP, &s1Alert);
- }
-
- if(ENABLE_S2_BUTTON) {
- setup_pin(S2_BUTTON, PUD_UP, &s2Alert);
+ if(controller==CONTROLLER2_V2) {
+ setup_encoder_pin(E4_TOP_ENCODER_A,ENABLE_E4_PULLUP?PUD_UP:PUD_OFF,&e4TopEncoderInt);
+ setup_encoder_pin(E4_TOP_ENCODER_B,ENABLE_E4_PULLUP?PUD_UP:PUD_OFF,NULL);
+ e4TopEncoderPos=0;
+ }
}
- if(ENABLE_S3_BUTTON) {
- setup_pin(S3_BUTTON, PUD_UP, &s3Alert);
- }
+ if(controller==CONTROLLER2_V1 || controller==CONTROLLER2_V2) {
+ if(ENABLE_E5_ENCODER) {
+ setup_pin(E5_FUNCTION, PUD_UP, &e5FunctionAlert);
- if(ENABLE_S4_BUTTON) {
- setup_pin(S4_BUTTON, PUD_UP, &s4Alert);
- }
+ setup_encoder_pin(E5_ENCODER_A,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,&e5EncoderInt);
+ setup_encoder_pin(E5_ENCODER_B,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,NULL);
+ e5EncoderPos=0;
- if(ENABLE_S5_BUTTON) {
- setup_pin(S5_BUTTON, PUD_UP, &s5Alert);
+ if(controller==CONTROLLER2_V2) {
+ setup_encoder_pin(E5_TOP_ENCODER_A,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,&e5TopEncoderInt);
+ setup_encoder_pin(E5_TOP_ENCODER_B,ENABLE_E5_PULLUP?PUD_UP:PUD_OFF,NULL);
+ e5TopEncoderPos=0;
+ }
+ }
}
- if(ENABLE_S6_BUTTON) {
- setup_pin(S6_BUTTON, PUD_UP, &s6Alert);
+ if(controller==CONTROLLER1){
+ if(ENABLE_FUNCTION_BUTTON) {
+ setup_pin(FUNCTION_BUTTON, PUD_UP, &functionAlert);
+ }
+
+ if(ENABLE_MOX_BUTTON) {
+ setup_pin(MOX_BUTTON, PUD_UP, &moxAlert);
+ }
+
+ if(ENABLE_S1_BUTTON) {
+ setup_pin(S1_BUTTON, PUD_UP, &s1Alert);
+ }
+
+ if(ENABLE_S2_BUTTON) {
+ setup_pin(S2_BUTTON, PUD_UP, &s2Alert);
+ }
+
+ if(ENABLE_S3_BUTTON) {
+ setup_pin(S3_BUTTON, PUD_UP, &s3Alert);
+ }
+
+ if(ENABLE_S4_BUTTON) {
+ setup_pin(S4_BUTTON, PUD_UP, &s4Alert);
+ }
+
+ if(ENABLE_S5_BUTTON) {
+ setup_pin(S5_BUTTON, PUD_UP, &s5Alert);
+ }
+
+ if(ENABLE_S6_BUTTON) {
+ setup_pin(S6_BUTTON, PUD_UP, &s6Alert);
+ }
}
-#endif
rotary_encoder_thread_id = g_thread_new( "encoders", rotary_encoder_thread, NULL);
if( ! rotary_encoder_thread_id )
}
fprintf(stderr, "rotary_encoder_thread: id=%p\n",rotary_encoder_thread_id);
-#if defined(CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- // setup i2c
- i2c_init();
+ if(controller==CONTROLLER2_V1 || controller==CONTROLLER2_V2) {
+ // setup i2c
+ i2c_init();
- // setup interrupt pin
- fprintf(stderr,"setup i2c interrupt: pin=%d\n",I2C_INTERRUPT);
- //digitalWrite(I2C_INTERRUPT,0); // clear pin
- pinMode(I2C_INTERRUPT,INPUT);
- pullUpDnControl(I2C_INTERRUPT,PUD_UP);
- usleep(10000);
- //wiringPiISR(I2C_INTERRUPT,INT_EDGE_FALLING,pI2CInterrupt);
- wiringPiISR(I2C_INTERRUPT,INT_EDGE_BOTH,pI2CInterrupt);
-#endif
+ // setup interrupt pin
+ fprintf(stderr,"setup i2c interrupt: pin=%d\n",I2C_INTERRUPT);
+ pinMode(I2C_INTERRUPT,INPUT);
+ pullUpDnControl(I2C_INTERRUPT,PUD_UP);
+ usleep(10000);
+ wiringPiISR(I2C_INTERRUPT,INT_EDGE_BOTH,pI2CInterrupt);
+ }
#ifdef LOCALCW
fprintf(stderr,"GPIO: ENABLE_CW_BUTTONS=%d CWL_BUTTON=%d CWR_BUTTON=%d\n", ENABLE_CW_BUTTONS, CWL_BUTTON, CWR_BUTTON);
return pos;
}
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
int e5_encoder_get_pos() {
int pos=e5EncoderPos;
e5EncoderPos=0;
return pos;
}
-#endif
int e4_function_get_state() {
return e4_sw_action;
}
-#ifdef CONTROLLER2_V2
int e2_top_encoder_get_pos() {
int pos=e2TopEncoderPos;
e2TopEncoderPos=0;
e5TopEncoderPos=0;
return pos;
}
-#endif
int function_get_state() {
return function_state;
int new_val;
switch(action) {
+ case ENCODER_AF_GAIN:
+ value=active_receiver->volume;
+ value+=(double)pos/100.0;
+ if(value<0.0) {
+ value=0.0;
+ } else if(value>1.0) {
+ value=1.0;
+ }
+ set_af_gain(active_receiver->id,value);
+ break;
case ENCODER_AF_GAIN_RX1:
value=receiver[0]->volume;
value+=(double)pos/100.0;
}
set_af_gain(1,value);
break;
+ case ENCODER_RF_GAIN:
+ value=active_receiver->rf_gain;
+ value+=(double)pos;
+ if(value<0.0) {
+ value=0.0;
+ } else if(value>100.0) {
+ value=100.0;
+ }
+ set_rf_gain(active_receiver->id,value);
+ break;
case ENCODER_RF_GAIN_RX1:
value=receiver[0]->rf_gain;
value+=(double)pos;
}
set_rf_gain(1,value);
break;
+ case ENCODER_AGC_GAIN:
+ value=active_receiver->agc_gain;
+ value+=(double)pos;
+ if(value<-20.0) {
+ value=-20.0;
+ } else if(value>120.0) {
+ value=120.0;
+ }
+ set_agc_gain(active_receiver->id,value);
+ break;
case ENCODER_AGC_GAIN_RX1:
value=receiver[0]->agc_gain;
value+=(double)pos;
}
set_agc_gain(1,value);
break;
+ case ENCODER_IF_WIDTH:
+ filter_width_changed(active_receiver->id,pos);
+ break;
case ENCODER_IF_WIDTH_RX1:
filter_width_changed(0,pos);
break;
case ENCODER_IF_WIDTH_RX2:
filter_width_changed(1,pos);
break;
+ case ENCODER_IF_SHIFT:
+ filter_shift_changed(active_receiver->id,pos);
+ break;
+ case ENCODER_IF_SHIFT_RX1:
+ filter_shift_changed(0,pos);
+ break;
+ case ENCODER_IF_SHIFT_RX2:
+ filter_shift_changed(1,pos);
+ break;
case ENCODER_ATTENUATION:
value=(double)adc_attenuation[active_receiver->adc];
value+=(double)pos;
- if(value<0.0) {
- value=0.0;
-#ifdef RADIOBERRY
- } else if (value>60.0) {
- value=60.0;
+ if(have_rx_gain) {
+ if(value<-12.0) {
+ value=-12.0;
+ } else if(value>48.0) {
+ value=48.0;
+ }
+ } else {
+ if(value<0.0) {
+ value=0.0;
+ } else if (value>31.0) {
+ value=31.0;
+ }
}
-#else
- } else if (value>31.0) {
- value=31.0;
- }
-#endif
set_attenuation_value(value);
break;
case ENCODER_MIC_GAIN:
}
set_drive(value);
break;
+ case ENCODER_RIT:
+ value=(double)vfo[active_receiver->id].rit;
+ value+=(double)(pos*rit_increment);
+ if(value<-10000.0) {
+ value=-10000.0;
+ } else if(value>10000.0) {
+ value=10000.0;
+ }
+ vfo[active_receiver->id].rit=(int)value;
+ receiver_frequency_changed(active_receiver);
+ g_idle_add(ext_vfo_update,NULL);
+ break;
case ENCODER_RIT_RX1:
value=(double)vfo[receiver[0]->id].rit;
value+=(double)(pos*rit_increment);
value+=(double)pos;
active_receiver->panadapter_low=(int)value;
break;
+ case ENCODER_PANADAPTER_STEP:
+ value=(double)active_receiver->panadapter_step;
+ value+=(double)pos;
+ active_receiver->panadapter_step=(int)value;
+ break;
+ case ENCODER_WATERFALL_HIGH:
+ value=(double)active_receiver->waterfall_high;
+ value+=(double)pos;
+ active_receiver->waterfall_high=(int)value;
+ break;
+ case ENCODER_WATERFALL_LOW:
+ value=(double)active_receiver->waterfall_low;
+ value+=(double)pos;
+ active_receiver->waterfall_low=(int)value;
+ break;
case ENCODER_SQUELCH:
value=active_receiver->squelch;
value+=(double)pos;
value=100.0;
}
active_receiver->squelch=value;
- set_squelch();
+ set_squelch(active_receiver);
+ break;
+ case ENCODER_SQUELCH_RX1:
+ value=receiver[0]->squelch;
+ value+=(double)pos;
+ if(value<0.0) {
+ value=0.0;
+ } else if(value>100.0) {
+ value=100.0;
+ }
+ receiver[0]->squelch=value;
+ set_squelch(receiver[0]);
+ break;
+ case ENCODER_SQUELCH_RX2:
+ value=receiver[1]->squelch;
+ value+=(double)pos;
+ if(value<0.0) {
+ value=0.0;
+ } else if(value>100.0) {
+ value=100.0;
+ }
+ receiver[1]->squelch=value;
+ set_squelch(receiver[1]);
break;
case ENCODER_COMP:
value=(double)transmitter->compressor_level;
return 0;
}
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
static int e5_encoder_changed(void *data) {
int pos=(int)data;
if(active_menu==E5_MENU) {
}
return 0;
}
-#endif
-#ifdef CONTROLLER2_V2
static int e2_top_encoder_changed(void *data) {
int pos=(int)data;
if(active_menu==E2_MENU) {
}
return 0;
}
-#endif
static gpointer rotary_encoder_thread(gpointer data) {
int pos;
g_idle_add(e4_encoder_changed,(gpointer)pos);
}
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- pos=e5_encoder_get_pos();
- if(pos!=0) {
- g_idle_add(e5_encoder_changed,(gpointer)pos);
- }
-#endif
-
-#if defined (CONTROLLER2_V2)
- pos=e2_top_encoder_get_pos();
- if(pos!=0) {
- g_idle_add(e2_top_encoder_changed,(gpointer)pos);
- }
-
- pos=e3_top_encoder_get_pos();
- if(pos!=0) {
- g_idle_add(e3_top_encoder_changed,(gpointer)pos);
- }
-
- pos=e4_top_encoder_get_pos();
- if(pos!=0) {
- g_idle_add(e4_top_encoder_changed,(gpointer)pos);
+ if(controller==CONTROLLER2_V1 || controller==CONTROLLER2_V2) {
+ pos=e5_encoder_get_pos();
+ if(pos!=0) {
+ g_idle_add(e5_encoder_changed,(gpointer)pos);
+ }
}
- pos=e5_top_encoder_get_pos();
- if(pos!=0) {
+
+ if(controller==CONTROLLER2_V2) {
+ pos=e2_top_encoder_get_pos();
+ if(pos!=0) {
+ g_idle_add(e2_top_encoder_changed,(gpointer)pos);
+ }
+
+ pos=e3_top_encoder_get_pos();
+ if(pos!=0) {
+ g_idle_add(e3_top_encoder_changed,(gpointer)pos);
+ }
+
+ pos=e4_top_encoder_get_pos();
+ if(pos!=0) {
+ g_idle_add(e4_top_encoder_changed,(gpointer)pos);
+ }
+
+ pos=e5_top_encoder_get_pos();
+ if(pos!=0) {
g_idle_add(e5_top_encoder_changed,(gpointer)pos);
+ }
}
-#endif
#ifdef sx1509
// buttons only generate interrupt when
#define _GPIO_H
enum {
- ENCODER_AF_GAIN_RX1=0,
+ NO_CONTROLLER=0,
+ CONTROLLER1,
+ CONTROLLER2_V1,
+ CONTROLLER2_V2,
+ CUSTOM_CONTROLLER
+};
+
+extern int controller;
+
+enum {
+ ENCODER_NO_ACTION=0,
+ ENCODER_AF_GAIN,
+ ENCODER_RF_GAIN,
+ ENCODER_AGC_GAIN,
+ ENCODER_IF_WIDTH,
+ ENCODER_IF_SHIFT,
+ ENCODER_AF_GAIN_RX1,
ENCODER_RF_GAIN_RX1,
ENCODER_AF_GAIN_RX2,
ENCODER_RF_GAIN_RX2,
ENCODER_AGC_GAIN_RX2,
ENCODER_IF_WIDTH_RX1,
ENCODER_IF_WIDTH_RX2,
+ ENCODER_IF_SHIFT_RX1,
+ ENCODER_IF_SHIFT_RX2,
ENCODER_ATTENUATION,
ENCODER_MIC_GAIN,
ENCODER_DRIVE,
ENCODER_TUNE_DRIVE,
+ ENCODER_RIT,
ENCODER_RIT_RX1,
ENCODER_RIT_RX2,
ENCODER_XIT,
ENCODER_CW_FREQUENCY,
ENCODER_PANADAPTER_HIGH,
ENCODER_PANADAPTER_LOW,
+ ENCODER_PANADAPTER_STEP,
+ ENCODER_WATERFALL_HIGH,
+ ENCODER_WATERFALL_LOW,
ENCODER_SQUELCH,
+ ENCODER_SQUELCH_RX1,
+ ENCODER_SQUELCH_RX2,
ENCODER_COMP,
ENCODER_DIVERSITY_GAIN,
ENCODER_DIVERSITY_PHASE,
MENU_FREQUENCY,
MENU_MEMORY,
MENU_DIVERSITY,
+ MENU_PS,
FUNCTION,
SWITCH_ACTIONS
};
extern char *sw_string[SWITCH_ACTIONS];
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1)
-#define SWITCHES 8
enum {
- SW1=0,
- SW2,
- SW3,
- SW4,
- SW5,
- SW6,
- SW7,
- SW8
+ CONTROLLER1_SW1=0,
+ CONTROLLER1_SW2,
+ CONTROLLER1_SW3,
+ CONTROLLER1_SW4,
+ CONTROLLER1_SW5,
+ CONTROLLER1_SW6,
+ CONTROLLER1_SW7,
+ CONTROLLER1_SW8,
+ CONTROLLER1_SWITCHES
};
-#endif
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
-#define SWITCHES 16
enum {
- SW2=0,
- SW3,
- SW4,
- SW5,
- SW6,
- SW7,
- SW8,
- SW9,
- SW10,
- SW11,
- SW12,
- SW13,
- SW14,
- SW15,
- SW16,
- SW17
+ CONTROLLER2_SW2=0,
+ CONTROLLER2_SW3,
+ CONTROLLER2_SW4,
+ CONTROLLER2_SW5,
+ CONTROLLER2_SW6,
+ CONTROLLER2_SW7,
+ CONTROLLER2_SW8,
+ CONTROLLER2_SW9,
+ CONTROLLER2_SW10,
+ CONTROLLER2_SW11,
+ CONTROLLER2_SW12,
+ CONTROLLER2_SW13,
+ CONTROLLER2_SW14,
+ CONTROLLER2_SW15,
+ CONTROLLER2_SW16,
+ CONTROLLER2_SW17,
+ CONTROLLER2_SWITCHES
};
-#endif
-
-extern int sw_action[SWITCHES];
+extern int *sw_action;
extern int settle_time;
extern int e4_sw_action;
extern int e5_sw_action;
+// uses wiringpi pin numbers
extern int ENABLE_VFO_ENCODER;
extern int ENABLE_VFO_PULLUP;
extern int VFO_ENCODER_A;
extern int VFO_ENCODER_B;
-extern int VFO_ENCODER_A_PIN;
-extern int VFO_ENCODER_B_PIN;
extern int ENABLE_E2_ENCODER;
extern int ENABLE_E2_PULLUP;
extern int E2_ENCODER_A;
extern int E2_ENCODER_B;
+extern int ENABLE_E2_TOP_ENCODER;
+extern int E2_TOP_ENCODER_A;
+extern int E2_TOP_ENCODER_B;
+extern int E2_FUNCTION;
extern int ENABLE_E3_ENCODER;
extern int ENABLE_E3_PULLUP;
extern int E3_ENCODER_A;
extern int E3_ENCODER_B;
+extern int ENABLE_E3_TOP_ENCODER;
+extern int E3_TOP_ENCODER_A;
+extern int E3_TOP_ENCODER_B;
+extern int E3_FUNCTION;
extern int ENABLE_E4_ENCODER;
extern int ENABLE_E4_PULLUP;
extern int E4_ENCODER_A;
extern int E4_ENCODER_B;
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
+extern int ENABLE_E4_TOP_ENCODER;
+extern int E4_TOP_ENCODER_A;
+extern int E4_TOP_ENCODER_B;
+extern int E4_FUNCTION;
extern int ENABLE_E5_ENCODER;
extern int ENABLE_E5_PULLUP;
extern int E5_ENCODER_A;
extern int E5_ENCODER_B;
-#endif
+extern int ENABLE_E5_TOP_ENCODER;
+extern int E5_TOP_ENCODER_A;
+extern int E5_TOP_ENCODER_B;
+extern int E5_FUNCTION;
+
+extern int ENABLE_E2_BUTTON;
+extern int ENABLE_E3_BUTTON;
+extern int ENABLE_E4_BUTTON;
+extern int ENABLE_E5_BUTTON;
+
extern int ENABLE_S1_BUTTON;
extern int S1_BUTTON;
extern int ENABLE_S2_BUTTON;
extern int S5_BUTTON;
extern int ENABLE_S6_BUTTON;
extern int S6_BUTTON;
+
extern int ENABLE_MOX_BUTTON;
extern int MOX_BUTTON;
extern int ENABLE_FUNCTION_BUTTON;
extern int ENABLE_GPIO_SIDETONE;
extern int ENABLE_CW_BUTTONS;
extern int CW_ACTIVE_LOW;
-void gpio_cw_sidetone_set(int level);
-int gpio_left_cw_key();
-int gpio_right_cw_key();
-int gpio_cw_sidetone_enabled();
+extern void gpio_cw_sidetone_set(int level);
+extern int gpio_left_cw_key();
+extern int gpio_right_cw_key();
+extern int gpio_cw_sidetone_enabled();
#endif
-void gpio_restore_actions();
-void gpio_restore_state();
-void gpio_save_state();
-void gpio_save_actions();
-int gpio_init();
-void gpio_close();
-int vfo_encoder_get_pos();
-int af_encoder_get_pos();
-int af_function_get_state();
-int rf_encoder_get_pos();
-int rf_function_get_state();
-int function_get_state();
-int band_get_state();
-int mode_get_state();
-int filter_get_state();
-int noise_get_state();
-int mox_get_state();
+extern void gpio_set_defaults(int ctrlr);
+extern void gpio_restore_actions();
+extern void gpio_restore_state();
+extern void gpio_save_state();
+extern void gpio_save_actions();
+extern int gpio_init();
+extern void gpio_close();
+extern int vfo_encoder_get_pos();
+extern int af_encoder_get_pos();
+extern int af_function_get_state();
+extern int rf_encoder_get_pos();
+extern int rf_function_get_state();
+extern int function_get_state();
+extern int band_get_state();
+extern int mode_get_state();
+extern int filter_get_state();
+extern int noise_get_state();
+extern int mox_get_state();
#endif
int i=-1;
switch(ints) {
case SW_2:
- i=SW2;
+ i=CONTROLLER2_SW2;
break;
case SW_3:
- i=SW3;
+ i=CONTROLLER2_SW3;
break;
case SW_4:
- i=SW4;
+ i=CONTROLLER2_SW4;
break;
case SW_5:
- i=SW5;
+ i=CONTROLLER2_SW5;
break;
case SW_6:
- i=SW6;
+ i=CONTROLLER2_SW6;
break;
case SW_7:
- i=SW7;
+ i=CONTROLLER2_SW7;
break;
case SW_8:
- i=SW8;
+ i=CONTROLLER2_SW8;
break;
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
case SW_9:
- i=SW9;
+ i=CONTROLLER2_SW9;
break;
case SW_10:
- i=SW10;
+ i=CONTROLLER2_SW10;
break;
case SW_11:
- i=SW11;
+ i=CONTROLLER2_SW11;
break;
case SW_12:
- i=SW12;
+ i=CONTROLLER2_SW12;
break;
case SW_13:
- i=SW13;
+ i=CONTROLLER2_SW13;
break;
case SW_14:
- i=SW14;
+ i=CONTROLLER2_SW14;
break;
case SW_15:
- i=SW15;
+ i=CONTROLLER2_SW15;
break;
case SW_16:
- i=SW16;
+ i=CONTROLLER2_SW16;
break;
case SW_17:
- i=SW17;
+ i=CONTROLLER2_SW17;
break;
-#endif
}
//g_print("i1c_interrupt: sw=%d action=%d\n",i,sw_action[i]);
switch(sw_action[i]) {
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
-#include "frequency.h" // for canTransmit
#include "ext.h"
struct utsname unameData;
#include "receiver.h"
#include "meter.h"
+#include "radio.h"
#include "wdsp.h"
#include "radio.h"
#include "version.h"
#include "mode.h"
#include "vox.h"
-#ifdef FREEDV
-#include "freedv.h"
-#include "vfo.h"
-#endif
-#ifdef PSK
-#include "psk.h"
-#endif
#include "new_menu.h"
static GtkWidget *parent_window;
static int meter_width;
static int meter_height;
static int last_meter_type=SMETER;
-static int max_level=-200;
+static double max_level=-200.0;
static int max_count=0;
static int max_reverse=0;
gpointer data)
{
start_meter();
-/*
- GtkWidget *dialog=gtk_dialog_new_with_buttons("Meter",GTK_WINDOW(parent_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
- //gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
-
- 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_homogeneous(GTK_GRID(grid),TRUE);
- gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
-
-
- GtkWidget *smeter_peak=gtk_radio_button_new_with_label(NULL,"S Meter Peak");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (smeter_peak), smeter==RXA_S_PK);
- gtk_widget_show(smeter_peak);
- gtk_grid_attach(GTK_GRID(grid),smeter_peak,0,1,1,1);
- g_signal_connect(smeter_peak,"toggled",G_CALLBACK(smeter_select_cb),(gpointer *)RXA_S_PK);
-
- GtkWidget *smeter_average=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(smeter_peak),"S Meter Average");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (smeter_average), smeter==RXA_S_AV);
- gtk_widget_show(smeter_average);
- gtk_grid_attach(GTK_GRID(grid),smeter_average,0,2,1,1);
- g_signal_connect(smeter_average,"toggled",G_CALLBACK(smeter_select_cb),(gpointer *)RXA_S_AV);
-
- GtkWidget *alc_peak=gtk_radio_button_new_with_label(NULL,"ALC Peak");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_peak), alc==TXA_ALC_PK);
- gtk_widget_show(alc_peak);
- gtk_grid_attach(GTK_GRID(grid),alc_peak,1,1,1,1);
- g_signal_connect(alc_peak,"toggled",G_CALLBACK(alc_meter_select_cb),(gpointer *)TXA_ALC_PK);
-
- GtkWidget *alc_average=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(alc_peak),"ALC Average");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_average), alc==TXA_ALC_AV);
- gtk_widget_show(alc_average);
- gtk_grid_attach(GTK_GRID(grid),alc_average,1,2,1,1);
- g_signal_connect(alc_average,"toggled",G_CALLBACK(alc_meter_select_cb),(gpointer *)TXA_ALC_AV);
-
- GtkWidget *alc_gain=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(alc_peak),"ALC Gain");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_gain), alc==TXA_ALC_GAIN);
- gtk_widget_show(alc_gain);
- gtk_grid_attach(GTK_GRID(grid),alc_gain,1,3,1,1);
- g_signal_connect(alc_gain,"toggled",G_CALLBACK(alc_meter_select_cb),(gpointer *)TXA_ALC_GAIN);
-
-
- gtk_container_add(GTK_CONTAINER(content),grid);
-
- GtkWidget *close_button=gtk_dialog_add_button(GTK_DIALOG(dialog),"Close",GTK_RESPONSE_OK);
- gtk_widget_override_font(close_button, pango_font_description_from_string("FreeMono 18"));
- gtk_widget_show_all(dialog);
-
- g_signal_connect_swapped (dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-
- int result=gtk_dialog_run(GTK_DIALOG(dialog));
-*/
return TRUE;
}
void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double exciter,double alc) {
+ double level;
char sf[32];
int text_location;
double offset;
- cairo_t *cr;
- cr = cairo_create (meter_surface);
+ int max_power=100;
+ char *units="W";
+ double interval=10.0;
+ cairo_t *cr = cairo_create (meter_surface);
+
+ if(meter_type==POWER) {
+ level=value;
+ if(level==0.0) {
+ level=exciter;
+ }
+ switch(pa_power) {
+ case PA_1W:
+ max_power=1000;
+ units="mW";
+ interval=100.0;
+ level=level*1000.0;
+ break;
+ case PA_10W:
+ max_power=10;
+ interval=1.0;
+ break;
+ case PA_30W:
+ max_power=30;
+ interval=3.0;
+ break;
+ case PA_50W:
+ max_power=50;
+ interval=5.0;
+ break;
+ case PA_100W:
+ max_power=100;
+ interval=10.0;
+ break;
+ case PA_200W:
+ max_power=200;
+ interval=20.0;
+ break;
+ case PA_500W:
+ max_power=500;
+ interval=50.0;
+ break;
+ }
+ }
+
if(analog_meter) {
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_paint (cr);
switch(meter_type) {
case SMETER:
{
- double level=value+(double)adc_attenuation[rx->adc];
+ if(have_rx_gain) {
+ level=value+40.0-(adc_attenuation[rx->adc]+12.0);
+ } else {
+ level=value+(double)adc_attenuation[rx->adc];
+ }
#ifdef SOAPYSDR
if(protocol==SOAPYSDR_PROTOCOL) {
level-=rx->rf_gain;
cairo_move_to(cr, 80, meter_height-2);
cairo_show_text(cr, sf);
-#ifdef FREEDV
- if(active_receiver->freedv) {
- if(freedv_sync) {
- cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
- } else {
- cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
- }
- sprintf(sf,"SNR: %3.2f",freedv_snr);
- cairo_move_to(cr, 70, meter_height-12);
- cairo_show_text(cr, sf);
- }
-#endif
-
-
}
break;
case POWER:
{
- double level=value;
offset=220.0;
int i;
cairo_set_line_width(cr, 1.0);
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
+ int max_power=100;
+ char *units="W";
+ double interval=10.0;
+ switch(pa_power) {
+ case PA_1W:
+ max_power=1000;
+ units="mW";
+ interval=100.0;
+ break;
+ case PA_10W:
+ max_power=10;
+ interval=1.0;
+ break;
+ case PA_30W:
+ max_power=30;
+ interval=3.0;
+ break;
+ case PA_50W:
+ max_power=50;
+ interval=5.0;
+ break;
+ case PA_100W:
+ max_power=100;
+ interval=10.0;
+ break;
+ case PA_200W:
+ max_power=200;
+ interval=20.0;
+ break;
+ case PA_500W:
+ max_power=500;
+ interval=50.0;
+ break;
+ }
+
+ for(i=0;i<=100;i++) {
+ angle=(double)i+offset;
+ radians=angle*M_PI/180.0;
+ if((i%10)==0) {
+ cairo_arc(cr, cx, cy, radius+4, radians, radians);
+ cairo_get_current_point(cr, &x, &y);
+ cairo_arc(cr, cx, cy, radius, radians, radians);
+ cairo_line_to(cr, x, y);
+ cairo_stroke(cr);
+
+ if((i%20)==0) {
+ sprintf(sf,"%d",(i/10)*(int)interval);
+ cairo_arc(cr, cx, cy, radius+5, radians, radians);
+ cairo_get_current_point(cr, &x, &y);
+ cairo_new_path(cr);
+ x-=6.0;
+ cairo_move_to(cr, x, y);
+ cairo_show_text(cr, sf);
+ }
+ }
+ cairo_new_path(cr);
+ }
+
+/*
for(i=0;i<=100;i++) {
angle=(double)i+offset;
radians=angle*M_PI/180.0;
}
cairo_new_path(cr);
}
+*/
cairo_set_line_width(cr, 1.0);
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
- if((int)value>max_level || max_count==10) {
- max_level=(int)value;
+ if(level>max_level || max_count==10) {
+ max_level=level;
max_count=0;
}
max_count++;
- angle=(max_level/2.0)+offset;
+ //angle=(max_level/2.0)+offset;
+ angle=(max_level*10.0*interval)+offset;
radians=angle*M_PI/180.0;
cairo_arc(cr, cx, cy, radius+8, radians, radians);
cairo_line_to(cr, cx, cy);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- sprintf(sf,"%d W",(int)max_level);
+ sprintf(sf,"%0.1f %s",max_level,units);
cairo_move_to(cr, 80, meter_height-22);
cairo_show_text(cr, sf);
// value is dBm
text_location=10;
offset=5.0;
- double level=value+(double)adc_attenuation[rx->adc];
+ if(have_rx_gain) {
+ level=value+40.0-(adc_attenuation[rx->adc]+12.0);
+ } else {
+ level=value+(double)adc_attenuation[rx->adc];
+ }
#ifdef SOAPYSDR
if(protocol==SOAPYSDR_PROTOCOL) {
level-=rx->rf_gain;
cairo_set_font_size(cr, 12);
sprintf(sf,"%d dBm",(int)level);
- cairo_move_to(cr, text_location, meter_height-30);
+ cairo_move_to(cr, text_location, meter_height-12);
cairo_show_text(cr, sf);
-
-#ifdef FREEDV
- if(active_receiver->freedv) {
- if(freedv_sync) {
- cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
- } else {
- cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
- }
- cairo_set_font_size(cr, 12);
- sprintf(sf,"SNR: %3.2f",freedv_snr);
- cairo_move_to(cr, text_location, meter_height-10);
- cairo_show_text(cr, sf);
- }
-#endif
break;
-#ifdef PSK
- case PSKMETER:
- {
- int i;
- offset=5.0;
- cairo_set_line_width(cr, 1.0);
- cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
- for(i=0;i<11;i++) {
- cairo_move_to(cr,offset+(double)(i*20),(double)meter_height-10);
- if((i%2)==0) {
- cairo_line_to(cr,offset+(double)(i*20),(double)(meter_height-20));
- cairo_move_to(cr,offset+(double)(i*20),(double)meter_height);
- sprintf(sf,"%d",i*10);
- cairo_show_text(cr, sf);
- } else {
- cairo_line_to(cr,offset+(double)(i*20),(double)(meter_height-15));
- }
- }
- cairo_stroke(cr);
-
- cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
- cairo_rectangle(cr, offset+0.0, (double)(meter_height-40), value*2, 20.0);
- cairo_fill(cr);
-
- cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
- cairo_set_font_size(cr, 12);
- sprintf(sf,"Level: %d",(int)value);
- cairo_move_to(cr, 210, 45);
- cairo_show_text(cr, sf);
- }
- break;
-#endif
case POWER:
- // value is Watts
cairo_select_font_face(cr, "FreeMono",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, 12);
- if((int)value>max_level || max_count==10) {
- max_level=(int)value;
+ if(level>max_level || max_count==10) {
+ max_level=level;
max_count=0;
}
max_count++;
- sprintf(sf,"FWD: %d W",(int)max_level);
+ sprintf(sf,"FWD: %0.1f %s",max_level,units);
cairo_move_to(cr, 10, 35);
cairo_show_text(cr, sf);
sprintf(sf,"ALC: %2.1f dB",alc);
cairo_move_to(cr, meter_width/2, 35);
cairo_show_text(cr, sf);
-
-/*
- sprintf(sf,"REV: %3.2f W",reverse);
- cairo_move_to(cr, 10, 45);
- cairo_show_text(cr, sf);
-*/
break;
}
#define SMETER 0
#define POWER 1
-#ifdef PSK
-#define PSKMETER 2
-#endif
-
extern GtkWidget* meter_init(int width,int height,GtkWidget *parent);
extern void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double exciter,double alc);
analog_meter=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
-
void meter_menu (GtkWidget *parent) {
parent_window=parent;
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
GtkWidget *grid=gtk_grid_new();
+ int row=0;
+ int col=0;
+
gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
GtkWidget *close_b=gtk_button_new_with_label("Close");
g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
- gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+ gtk_grid_attach(GTK_GRID(grid),close_b,col,row,1,1);
+
+ col++;
GtkWidget *analog_b=gtk_check_button_new_with_label("Analog Meter");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (analog_b), analog_meter);
- gtk_grid_attach(GTK_GRID(grid),analog_b,1,0,1,1);
+ gtk_grid_attach(GTK_GRID(grid),analog_b,col,row,1,1);
g_signal_connect(analog_b,"toggled",G_CALLBACK(analog_cb),NULL);
+ row++;
+ col=0;
+
GtkWidget *smeter_peak=gtk_radio_button_new_with_label(NULL,"S Meter Peak");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (smeter_peak), smeter==RXA_S_PK);
gtk_widget_show(smeter_peak);
- gtk_grid_attach(GTK_GRID(grid),smeter_peak,0,1,1,1);
- g_signal_connect(smeter_peak,"toggled",G_CALLBACK(smeter_select_cb),(gpointer)(long)RXA_S_PK);
+ gtk_grid_attach(GTK_GRID(grid),smeter_peak,col,row,1,1);
+ g_signal_connect(smeter_peak,"toggled",G_CALLBACK(smeter_select_cb),GINT_TO_POINTER(RXA_S_PK));
- GtkWidget *smeter_average=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(smeter_peak),"S Meter Average");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (smeter_average), smeter==RXA_S_AV);
- gtk_widget_show(smeter_average);
- gtk_grid_attach(GTK_GRID(grid),smeter_average,0,2,1,1);
- g_signal_connect(smeter_average,"toggled",G_CALLBACK(smeter_select_cb),(gpointer)(long)RXA_S_AV);
+ col++;
GtkWidget *alc_peak=gtk_radio_button_new_with_label(NULL,"ALC Peak");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_peak), alc==TXA_ALC_PK);
gtk_widget_show(alc_peak);
- gtk_grid_attach(GTK_GRID(grid),alc_peak,1,1,1,1);
- g_signal_connect(alc_peak,"toggled",G_CALLBACK(alc_meter_select_cb),(gpointer)(long)TXA_ALC_PK);
+ gtk_grid_attach(GTK_GRID(grid),alc_peak,col,row,1,1);
+ g_signal_connect(alc_peak,"toggled",G_CALLBACK(alc_meter_select_cb),GINT_TO_POINTER(TXA_ALC_PK));
+
+ row++;
+ col=0;
+
+ GtkWidget *smeter_average=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(smeter_peak),"S Meter Average");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (smeter_average), smeter==RXA_S_AV);
+ gtk_widget_show(smeter_average);
+ gtk_grid_attach(GTK_GRID(grid),smeter_average,col,row,1,1);
+ g_signal_connect(smeter_average,"toggled",G_CALLBACK(smeter_select_cb),GINT_TO_POINTER(RXA_S_AV));
+
+ col++;
GtkWidget *alc_average=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(alc_peak),"ALC Average");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_average), alc==TXA_ALC_AV);
gtk_widget_show(alc_average);
- gtk_grid_attach(GTK_GRID(grid),alc_average,1,2,1,1);
- g_signal_connect(alc_average,"toggled",G_CALLBACK(alc_meter_select_cb),(gpointer)(long)TXA_ALC_AV);
+ gtk_grid_attach(GTK_GRID(grid),alc_average,col,row,1,1);
+ g_signal_connect(alc_average,"toggled",G_CALLBACK(alc_meter_select_cb),GINT_TO_POINTER(TXA_ALC_AV));
+
+ row++;
+ col=0;
GtkWidget *alc_gain=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(alc_peak),"ALC Gain");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_gain), alc==TXA_ALC_GAIN);
gtk_widget_show(alc_gain);
- gtk_grid_attach(GTK_GRID(grid),alc_gain,1,3,1,1);
- g_signal_connect(alc_gain,"toggled",G_CALLBACK(alc_meter_select_cb),(gpointer)(long)TXA_ALC_GAIN);
+ gtk_grid_attach(GTK_GRID(grid),alc_gain,col,row,1,1);
+ g_signal_connect(alc_gain,"toggled",G_CALLBACK(alc_meter_select_cb),GINT_TO_POINTER(TXA_ALC_GAIN));
gtk_container_add(GTK_CONTAINER(content),grid);
,"DIGL"
,"SAM"
,"DRM"
-#ifdef PSK
- ,"PSK"
-#endif
};
#define modeDIGL 9
#define modeSAM 10
#define modeDRM 11
-#ifdef PSK
-#define modePSK 12
-#define MODES 13
-#else
#define MODES 12
-#endif
char *mode_string[MODES];
frequency_max=61440000.0;
break;
case NEW_DEVICE_HERMES_LITE:
- if (discovered[devices].software_version < 40) {
+ if (discovered[devices].software_version < 40) {
strcpy(discovered[devices].name,"Hermes Lite V1");
} else {
strcpy(discovered[devices].name,"Hermes Lite V2");
discovered[devices].device = NEW_DEVICE_HERMES_LITE2;
}
- frequency_min=0.0;
- frequency_max=30720000.0;
break;
default:
strcpy(discovered[devices].name,"Unknown");
#include "oc_menu.h"
#include "cw_menu.h"
#include "store_menu.h"
-#ifdef FREEDV
-#include "freedv_menu.h"
-#endif
#include "xvtr_menu.h"
#include "equalizer_menu.h"
#include "radio.h"
#include "tx_menu.h"
#include "ps_menu.h"
#include "encoder_menu.h"
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
#include "switch_menu.h"
-#endif
#include "vfo_menu.h"
#include "fft_menu.h"
#include "main.h"
+#include "gpio.h"
static GtkWidget *menu_b=NULL;
return TRUE;
}
-#ifdef GPIO
static gboolean encoder_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
cleanup();
fprintf(stderr, "new_menu: calling encoder_menu\n");
return TRUE;
}
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
static gboolean switch_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
cleanup();
fprintf(stderr, "new_menu: calling switch_menu\n");
switch_menu(top_window);
return TRUE;
}
-#endif
-#endif
static gboolean cw_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
cleanup();
return TRUE;
}
-#ifdef FREEDV
-static gboolean freedv_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
- cleanup();
- freedv_menu(top_window);
- return TRUE;
-}
-#endif
-
static gboolean xvtr_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
cleanup();
xvtr_menu(top_window);
gtk_grid_attach(GTK_GRID(grid),oc_b,(i%5),i/5,1,1);
i++;
-#ifdef FREEDV
- GtkWidget *freedv_b=gtk_button_new_with_label("FreeDV");
- g_signal_connect (freedv_b, "button-press-event", G_CALLBACK(freedv_cb), NULL);
- gtk_grid_attach(GTK_GRID(grid),freedv_b,(i%5),i/5,1,1);
- i++;
-#endif
-
GtkWidget *display_b=gtk_button_new_with_label("Display");
g_signal_connect (display_b, "button-press-event", G_CALLBACK(display_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),display_b,(i%5),i/5,1,1);
gtk_grid_attach(GTK_GRID(grid),encoders_b,(i%5),i/5,1,1);
i++;
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- GtkWidget *switches_b=gtk_button_new_with_label("Switches");
- g_signal_connect (switches_b, "button-press-event", G_CALLBACK(switch_cb), NULL);
- gtk_grid_attach(GTK_GRID(grid),switches_b,(i%5),i/5,1,1);
- i++;
-#endif
+ if(controller==CONTROLLER2_V1 || controller==CONTROLLER2_V2) {
+ GtkWidget *switches_b=gtk_button_new_with_label("Switches");
+ g_signal_connect (switches_b, "button-press-event", G_CALLBACK(switch_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),switches_b,(i%5),i/5,1,1);
+ i++;
+ }
#endif
//
extern void start_rx();
extern void start_tx();
extern void start_diversity();
+#ifdef PURESIGNAL
+extern void start_ps();
+#endif
extern void encoder_step(int encoder,int step);
#include "signal.h"
#include "vfo.h"
#include "toolbar.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
#include "vox.h"
#include "ext.h"
#include "iambic.h"
static unsigned char audiobuffer[260]; // was 1444
static int audioindex;
-#ifdef PSK
-static int psk_samples=0;
-static int psk_resample=6; // convert from 48000 to 8000
-#endif
-
// Use this to determine the source port of messages received
static struct sockaddr_in addr;
static socklen_t length=sizeof(addr);
int rc;
spectrumWIDTH=pixels;
- fprintf(stderr,"new_protocol_init: MIC_SAMPLES=%d\n",MIC_SAMPLES);
+ g_print("new_protocol_init: MIC_SAMPLES=%d\n",MIC_SAMPLES);
memset(rxcase , 0, MAX_DDC*sizeof(int));
memset(rxid , 0, MAX_DDC*sizeof(int));
#ifdef OLD_AUDIO
if(local_audio) {
if(audio_open_output()!=0) {
- fprintf(stderr,"audio_open_output failed\n");
+ g_print("audio_open_output failed\n");
local_audio=0;
}
}
if(transmitter->local_microphone) {
if(audio_open_input()!=0) {
- fprintf(stderr,"audio_open_input failed\n");
+ g_print("audio_open_input failed\n");
transmitter->local_microphone=0;
}
}
#endif
command_response_thread_id = g_thread_new( "command_response thread",command_response_thread, NULL);
if( ! command_response_thread_id ) {
- fprintf(stderr,"g_thread_new failed on command_response_thread\n");
+ g_print("g_thread_new failed on command_response_thread\n");
exit( -1 );
}
- fprintf(stderr, "command_response_thread: id=%p\n",command_response_thread_id);
+ g_print( "command_response_thread: id=%p\n",command_response_thread_id);
#ifdef __APPLE__
sem_unlink("HIGHREADY");
high_priority_sem_ready=sem_open("HIGHREADY", O_CREAT | O_EXCL, 0700, 0);
#endif
high_priority_thread_id = g_thread_new( "high_priority thread", high_priority_thread, NULL);
if( ! high_priority_thread_id ) {
- fprintf(stderr,"g_thread_new failed on high_priority_thread\n");
+ g_print("g_thread_new failed on high_priority_thread\n");
exit( -1 );
}
- fprintf(stderr, "high_priority_thread: id=%p\n",high_priority_thread_id);
+ g_print( "high_priority_thread: id=%p\n",high_priority_thread_id);
#ifdef __APPLE__
sem_unlink("MICREADY");
mic_line_sem_ready=sem_open("MICREADY", O_CREAT | O_EXCL, 0700, 0);
#endif
mic_line_thread_id = g_thread_new( "mic_line thread", mic_line_thread, NULL);
if( ! mic_line_thread_id ) {
- fprintf(stderr,"g_thread_new failed on mic_line_thread\n");
+ g_print("g_thread_new failed on mic_line_thread\n");
exit( -1 );
}
- fprintf(stderr, "mic_line_thread: id=%p\n",mic_line_thread_id);
+ g_print( "mic_line_thread: id=%p\n",mic_line_thread_id);
//
// Spawn off one IQ reading thread for each DDC to be used
sem_unlink(sname);
iq_sem_ready[i]=sem_open(sname, O_CREAT | O_EXCL, 0700, 0);
if (iq_sem_ready[i] == SEM_FAILED) {
- fprintf(stderr,"SEM=%s, ",sname);
+ g_print("SEM=%s, ",sname);
perror("IQreadySemaphore");
}
sprintf(sname,"IQBUF%03d", i);
sem_unlink(sname);
iq_sem_buffer[i]=sem_open(sname, O_CREAT| O_EXCL, 0700, 0);
if (iq_sem_buffer[i] == SEM_FAILED) {
- fprintf(stderr,"SEM=%s, ",sname);
+ g_print("SEM=%s, ",sname);
perror("IQbufferSemaphore");
}
#else
data_socket=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP);
if(data_socket<0) {
- fprintf(stderr,"NewProtocol: create socket failed for data_socket\n");
+ g_print("NewProtocol: create socket failed for data_socket\n");
exit(-1);
}
// bind to the interface
if(bind(data_socket,(struct sockaddr*)&radio->info.network.interface_address,radio->info.network.interface_length)<0) {
- fprintf(stderr,"metis: bind socket failed for data_socket\n");
+ g_print("metis: bind socket failed for data_socket\n");
exit(-1);
}
-fprintf(stderr,"new_protocol_init: data_socket %d bound to interface %s:%d\n",data_socket,inet_ntoa(radio->info.network.interface_address.sin_addr),ntohs(radio->info.network.interface_address.sin_port));
+g_print("new_protocol_init: data_socket %d bound to interface %s:%d\n",data_socket,inet_ntoa(radio->info.network.interface_address.sin_addr),ntohs(radio->info.network.interface_address.sin_port));
memcpy(&base_addr,&radio->info.network.address,radio->info.network.address_length);
base_addr_length=radio->info.network.address_length;
base_addr.sin_port=htons(GENERAL_REGISTERS_FROM_HOST_PORT);
-g_print("base_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
+//g_print("base_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
memcpy(&receiver_addr,&radio->info.network.address,radio->info.network.address_length);
receiver_addr_length=radio->info.network.address_length;
receiver_addr.sin_port=htons(RECEIVER_SPECIFIC_REGISTERS_FROM_HOST_PORT);
-g_print("receive_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
+//g_print("receive_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
memcpy(&transmitter_addr,&radio->info.network.address,radio->info.network.address_length);
transmitter_addr_length=radio->info.network.address_length;
transmitter_addr.sin_port=htons(TRANSMITTER_SPECIFIC_REGISTERS_FROM_HOST_PORT);
-g_print("transmit_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
+//g_print("transmit_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
memcpy(&high_priority_addr,&radio->info.network.address,radio->info.network.address_length);
high_priority_addr_length=radio->info.network.address_length;
high_priority_addr.sin_port=htons(HIGH_PRIORITY_FROM_HOST_PORT);
-g_print("high_priority_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
+//g_print("high_priority_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
-fprintf(stderr,"new_protocol_thread: high_priority_addr setup for port %d\n",HIGH_PRIORITY_FROM_HOST_PORT);
+//g_print("new_protocol_thread: high_priority_addr setup for port %d\n",HIGH_PRIORITY_FROM_HOST_PORT);
memcpy(&audio_addr,&radio->info.network.address,radio->info.network.address_length);
audio_addr_length=radio->info.network.address_length;
audio_addr.sin_port=htons(AUDIO_FROM_HOST_PORT);
-g_print("audio_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
+//g_print("audio_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
memcpy(&iq_addr,&radio->info.network.address,radio->info.network.address_length);
iq_addr_length=radio->info.network.address_length;
iq_addr.sin_port=htons(TX_IQ_FROM_HOST_PORT);
-g_print("iq_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
+//g_print("iq_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
for(i=0;i<MAX_DDC;i++) {
new_protocol_thread_id = g_thread_new( "new protocol", new_protocol_thread, NULL);
if( ! new_protocol_thread_id )
{
- fprintf(stderr,"g_thread_new failed on new_protocol_thread\n");
+ g_print("g_thread_new failed on new_protocol_thread\n");
exit( -1 );
}
- fprintf(stderr, "new_protocol_thread: id=%p\n",new_protocol_thread_id);
+ g_print( "new_protocol_thread: id=%p\n",new_protocol_thread_id);
new_protocol_general();
new_protocol_start();
general_buffer[58]=0x01; // enable PA
}
-// fprintf(stderr,"new_protocol_general: PA Enable=%02X\n",general_buffer[58]);
+// g_print("new_protocol_general: PA Enable=%02X\n",general_buffer[58]);
if(filter_board==APOLLO) {
general_buffer[58]|=0x02; // enable APOLLO tuner
}
}
-//fprintf(stderr,"Alex Enable=%02X\n",general_buffer[59]);
+//g_print("Alex Enable=%02X\n",general_buffer[59]);
//g_print("new_protocol_general: %s:%d\n",inet_ntoa(base_addr.sin_addr),ntohs(base_addr.sin_port));
if((rc=sendto(data_socket,general_buffer,sizeof(general_buffer),0,(struct sockaddr*)&base_addr,base_addr_length))<0) {
- fprintf(stderr,"sendto socket failed for general\n");
+ g_print("sendto socket failed for general\n");
exit(1);
}
if(rc!=sizeof(general_buffer)) {
- fprintf(stderr,"sendto socket for general: %d rather than %ld",rc,(long)sizeof(general_buffer));
+ g_print("sendto socket for general: %d rather than %ld",rc,(long)sizeof(general_buffer));
}
general_sequence++;
high_priority_buffer_to_radio[1]=high_priority_sequence>>16;
high_priority_buffer_to_radio[2]=high_priority_sequence>>8;
high_priority_buffer_to_radio[3]=high_priority_sequence;
-
high_priority_buffer_to_radio[4]=running;
//
// We need not set PTT of doing internal CW with break-in
// Out of paranoia: print warning and choose ANT1
//
if (i<0 || i>2) {
- fprintf(stderr,"WARNING: illegal TX antenna chosen, using ANT1\n");
+ g_print("WARNING: illegal TX antenna chosen, using ANT1\n");
transmitter->alex_antenna=0;
i=0;
}
high_priority_buffer_to_radio[1434]=(alex0>>8)&0xFF;
high_priority_buffer_to_radio[1435]=alex0&0xFF;
-//fprintf(stderr,"ALEX0 bits: %02X %02X %02X %02X for rx=%lld tx=%lld\n",high_priority_buffer_to_radio[1432],high_priority_buffer_to_radio[1433],high_priority_buffer_to_radio[1434],high_priority_buffer_to_radio[1435],rxFrequency,txFrequency);
+//g_print("ALEX0 bits: %02X %02X %02X %02X for rx=%lld tx=%lld\n",high_priority_buffer_to_radio[1432],high_priority_buffer_to_radio[1433],high_priority_buffer_to_radio[1434],high_priority_buffer_to_radio[1435],rxFrequency,txFrequency);
//
// Orion2 boards: set RX2 filters according ro VFOB frequency
high_priority_buffer_to_radio[1430]=(alex1>>8)&0xFF;
high_priority_buffer_to_radio[1431]=alex1&0xFF;
-//fprintf(stderr,"ALEX1 bits: rx1: %02X %02X for rx=%lld\n",high_priority_buffer_to_radio[1430],high_priority_buffer_to_radio[1431],rxFrequency);
+//g_print("ALEX1 bits: rx1: %02X %02X for rx=%lld\n",high_priority_buffer_to_radio[1430],high_priority_buffer_to_radio[1431],rxFrequency);
}
//g_print("new_protocol_high_priority: %s:%d\n",inet_ntoa(high_priority_addr.sin_addr),ntohs(high_priority_addr.sin_port));
int rc;
if((rc=sendto(data_socket,high_priority_buffer_to_radio,sizeof(high_priority_buffer_to_radio),0,(struct sockaddr*)&high_priority_addr,high_priority_addr_length))<0) {
- fprintf(stderr,"sendto socket failed for high priority: rc=%d errno=%d\n",rc,errno);
+ g_print("sendto socket failed for high priority: rc=%d errno=%d\n",rc,errno);
abort();
//exit(1);
}
if(rc!=sizeof(high_priority_buffer_to_radio)) {
- fprintf(stderr,"sendto socket for high_priority: %d rather than %ld",rc,(long)sizeof(high_priority_buffer_to_radio));
+ g_print("sendto socket for high_priority: %d rather than %ld",rc,(long)sizeof(high_priority_buffer_to_radio));
}
high_priority_sequence++;
if(last_50!=transmit_specific_buffer[50]) {
last_50=transmit_specific_buffer[50];
-//fprintf(stderr,"tx_specific: 50=%02X\n",transmit_specific_buffer[50]);
+//g_print("tx_specific: 50=%02X\n",transmit_specific_buffer[50]);
}
// 0..31
//g_print("new_protocol_transmit_specific: %s:%d\n",inet_ntoa(transmitter_addr.sin_addr),ntohs(transmitter_addr.sin_port));
if((rc=sendto(data_socket,transmit_specific_buffer,sizeof(transmit_specific_buffer),0,(struct sockaddr*)&transmitter_addr,transmitter_addr_length))<0) {
- fprintf(stderr,"sendto socket failed for tx specific: %d\n",rc);
+ g_print("sendto socket failed for tx specific: %d\n",rc);
exit(1);
}
if(rc!=sizeof(transmit_specific_buffer)) {
- fprintf(stderr,"sendto socket for transmit_specific: %d rather than %ld",rc,(long)sizeof(transmit_specific_buffer));
+ g_print("sendto socket for transmit_specific: %d rather than %ld",rc,(long)sizeof(transmit_specific_buffer));
}
tx_specific_sequence++;
//g_print("new_protocol_receive_specific: %s:%d enable=%02X\n",inet_ntoa(receiver_addr.sin_addr),ntohs(receiver_addr.sin_port),receive_specific_buffer[7]);
if((rc=sendto(data_socket,receive_specific_buffer,sizeof(receive_specific_buffer),0,(struct sockaddr*)&receiver_addr,receiver_addr_length))<0) {
- fprintf(stderr,"sendto socket failed for receive_specific: %d\n",rc);
+ g_print("sendto socket failed for receive_specific: %d\n",rc);
exit(1);
}
if(rc!=sizeof(receive_specific_buffer)) {
- fprintf(stderr,"sendto socket for receive_specific: %d rather than %ld",rc,(long)sizeof(receive_specific_buffer));
+ g_print("sendto socket for receive_specific: %d rather than %ld",rc,(long)sizeof(receive_specific_buffer));
}
rx_specific_sequence++;
new_protocol_timer_thread_id = g_thread_new( "new protocol timer", new_protocol_timer_thread, NULL);
if( ! new_protocol_timer_thread_id )
{
- fprintf(stderr,"g_thread_new failed on new_protocol_timer_thread\n");
+ g_print("g_thread_new failed on new_protocol_timer_thread\n");
exit( -1 );
}
- fprintf(stderr, "new_protocol_timer_thread: id=%p\n",new_protocol_timer_thread_id);
+ g_print( "new_protocol_timer_thread: id=%p\n",new_protocol_timer_thread_id);
}
unsigned char *buffer;
int bytesread;
-fprintf(stderr,"new_protocol_thread\n");
+g_print("new_protocol_thread\n");
micsamples=0;
iqindex=4;
buffer=malloc(NET_BUFFER_SIZE);
bytesread=recvfrom(data_socket,buffer,NET_BUFFER_SIZE,0,(struct sockaddr*)&addr,&length);
if(bytesread<0) {
- fprintf(stderr,"recvfrom socket failed for new_protocol_thread");
+ g_print("recvfrom socket failed for new_protocol_thread");
exit(-1);
}
ddc=sourceport-RX_IQ_TO_HOST_PORT_0;
//g_print("iq packet from port=%d ddc=%d\n",sourceport,ddc);
if(ddc>=MAX_DDC) {
- fprintf(stderr,"unexpected iq data from ddc %d\n",ddc);
+ g_print("unexpected iq data from ddc %d\n",ddc);
} else {
#ifdef __APPLE__
sem_wait(iq_sem_ready[ddc]);
#endif
break;
default:
-fprintf(stderr,"new_protocol_thread: Unknown port %d\n",sourceport);
+g_print("new_protocol_thread: Unknown port %d\n",sourceport);
free(buffer);
break;
}
}
static gpointer command_response_thread(gpointer data) {
- fprintf(stderr,"command_response_thread\n");
+ g_print("command_response_thread\n");
while(1) {
#ifdef __APPLE__
sem_post(command_response_sem_ready);
}
static gpointer high_priority_thread(gpointer data) {
-fprintf(stderr,"high_priority_thread\n");
+g_print("high_priority_thread\n");
while(1) {
#ifdef __APPLE__
sem_post(high_priority_sem_ready);
}
static gpointer mic_line_thread(gpointer data) {
-fprintf(stderr,"mic_line_thread\n");
+g_print("mic_line_thread\n");
while(1) {
#ifdef __APPLE__
sem_post(mic_line_sem_ready);
int ddc=GPOINTER_TO_INT(data);
long sequence;
unsigned char *buffer;
- fprintf(stderr,"iq_thread: ddc=%d\n",ddc);
+ g_print("iq_thread: ddc=%d\n",ddc);
while(1) {
#ifdef __APPLE__
sem_post(iq_sem_ready[ddc]);
//
sequence=((buffer[0]&0xFF)<<24)+((buffer[1]&0xFF)<<16)+((buffer[2]&0xFF)<<8)+(buffer[3]&0xFF);
if(ddc_sequence[ddc] !=sequence) {
- fprintf(stderr,"DDC %d sequence error: expected %ld got %ld\n",ddc,ddc_sequence[ddc],sequence);
+ g_print("DDC %d sequence error: expected %ld got %ld\n",ddc,ddc_sequence[ddc],sequence);
ddc_sequence[ddc]=sequence;
}
ddc_sequence[ddc]++;
bitspersample=((buffer[12]&0xFF)<<8)+(buffer[13]&0xFF); // used in debug code
samplesperframe=((buffer[14]&0xFF)<<8)+(buffer[15]&0xFF);
-//fprintf(stderr,"process_ps_iq_data: bitspersample=%d samplesperframe=%d\n", bitspersample,samplesperframe);
+//g_print("process_ps_iq_data: bitspersample=%d samplesperframe=%d\n", bitspersample,samplesperframe);
b=16;
int i;
for(i=0;i<samplesperframe;i+=2) {
add_ps_iq_samples(transmitter, leftsampledouble1,rightsampledouble1,leftsampledouble0,rightsampledouble0);
-//fprintf(stderr,"%06x,%06x %06x,%06x\n",leftsample0,rightsample0,leftsample1,rightsample1);
+//g_print("%06x,%06x %06x,%06x\n",leftsample0,rightsample0,leftsample1,rightsample1);
}
}
long sequence;
sequence=((command_response_buffer[0]&0xFF)<<24)+((command_response_buffer[1]&0xFF)<<16)+((command_response_buffer[2]&0xFF)<<8)+(command_response_buffer[3]&0xFF);
if (sequence != response_sequence) {
- fprintf(stderr,"CommRes SeqErr: expected=%ld seen=%ld\n", response_sequence, sequence);
+ g_print("CommRes SeqErr: expected=%ld seen=%ld\n", response_sequence, sequence);
response_sequence=sequence;
}
response_sequence++;
response=command_response_buffer[4]&0xFF;
- fprintf(stderr,"CommandResponse with seq=%ld and command=%d\n",sequence,response);
+ g_print("CommandResponse with seq=%ld and command=%d\n",sequence,response);
#ifdef __APPLE__
sem_post(response_sem);
#else
sequence=((high_priority_buffer[0]&0xFF)<<24)+((high_priority_buffer[1]&0xFF)<<16)+((high_priority_buffer[2]&0xFF)<<8)+(high_priority_buffer[3]&0xFF);
if (sequence != highprio_rcvd_sequence) {
- fprintf(stderr,"HighPrio SeqErr Expected=%ld Seen=%ld\n", highprio_rcvd_sequence, sequence);
+ g_print("HighPrio SeqErr Expected=%ld Seen=%ld\n", highprio_rcvd_sequence, sequence);
highprio_rcvd_sequence=sequence;
}
highprio_rcvd_sequence++;
}
if(previous_ptt!=local_ptt) {
- g_idle_add(ext_mox_update,(gpointer)(long)(local_ptt));
+ g_idle_add(ext_mox_update,GINT_TO_POINTER(local_ptt));
}
}
sequence=((mic_line_buffer[0]&0xFF)<<24)+((mic_line_buffer[1]&0xFF)<<16)+((mic_line_buffer[2]&0xFF)<<8)+(mic_line_buffer[3]&0xFF);
if (sequence != micsamples_sequence) {
- fprintf(stderr,"MicSample SeqErr Expected=%ld Seen=%ld\n", micsamples_sequence, sequence);
+ g_print("MicSample SeqErr Expected=%ld Seen=%ld\n", micsamples_sequence, sequence);
micsamples_sequence=sequence;
}
micsamples_sequence++;
sample=(short)(mic_line_buffer[b++]<<8);
sample |= (short) (mic_line_buffer[b++]&0xFF);
fsample = transmitter->local_microphone ? audio_get_next_mic_sample() : (float) sample * 0.00003051;
-#ifdef FREEDV
- if(active_receiver->freedv) {
- add_freedv_mic_sample(transmitter,fsample);
- } else {
-#endif
- add_mic_sample(transmitter,fsample);
-#ifdef FREEDV
- }
-#endif
+ add_mic_sample(transmitter,fsample);
}
}
rc=sendto(data_socket,audiobuffer,sizeof(audiobuffer),0,(struct sockaddr*)&audio_addr,audio_addr_length);
if(rc!=sizeof(audiobuffer)) {
- fprintf(stderr,"sendto socket failed for %ld bytes of audio: %d\n",(long)sizeof(audiobuffer),rc);
+ g_print("sendto socket failed for %ld bytes of audio: %d\n",(long)sizeof(audiobuffer),rc);
}
audioindex=4;
audiosequence++;
rc=sendto(data_socket,audiobuffer,sizeof(audiobuffer),0,(struct sockaddr*)&audio_addr,audio_addr_length);
if(rc!=sizeof(audiobuffer)) {
- fprintf(stderr,"sendto socket failed for %ld bytes of audio: %d\n",(long)sizeof(audiobuffer),rc);
+ g_print("sendto socket failed for %ld bytes of audio: %d\n",(long)sizeof(audiobuffer),rc);
}
audioindex=4;
audiosequence++;
// send the buffer
if(sendto(data_socket,iqbuffer,sizeof(iqbuffer),0,(struct sockaddr*)&iq_addr,iq_addr_length)<0) {
- fprintf(stderr,"sendto socket failed for iq\n");
+ g_print("sendto socket failed for iq\n");
exit(1);
}
iqindex=4;
// send the buffer
if(sendto(data_socket,iqbuffer,sizeof(iqbuffer),0,(struct sockaddr*)&iq_addr,iq_addr_length)<0) {
- fprintf(stderr,"sendto socket failed for iq\n");
+ g_print("sendto socket failed for iq\n");
exit(1);
}
iqindex=4;
g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
- GtkWidget *band_title=gtk_label_new("Band");
+ GtkWidget *band_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(band_title), "<b>Band</b>");
//gtk_widget_override_font(band_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(band_title);
gtk_grid_attach(GTK_GRID(grid),band_title,0,1,1,1);
- GtkWidget *rx_title=gtk_label_new("Rx");
+ GtkWidget *rx_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rx_title), "<b>Rx</b>");
//gtk_widget_override_font(rx_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(rx_title);
gtk_grid_attach(GTK_GRID(grid),rx_title,4,1,1,1);
- GtkWidget *tx_title=gtk_label_new("Tx");
+ GtkWidget *tx_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tx_title), "<b>Tx</b>");
//gtk_widget_override_font(tx_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(tx_title);
gtk_grid_attach(GTK_GRID(grid),tx_title,11,1,1,1);
- GtkWidget *tune_title=gtk_label_new("Tune (ORed with TX)");
+ GtkWidget *tune_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tune_title), "<b>Tune (ORed with TX)</b>");
//gtk_widget_override_font(tune_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(tune_title);
gtk_grid_attach(GTK_GRID(grid),tune_title,18,1,2,1);
for(i=1;i<8;i++) {
- char oc_id[8];
- sprintf(oc_id,"%d",i);
- GtkWidget *oc_rx_title=gtk_label_new(oc_id);
+ char oc_id[16];
+ sprintf(oc_id,"<b>%d</b>",i);
+ GtkWidget *oc_rx_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(oc_rx_title), oc_id);
//gtk_widget_override_font(oc_rx_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(oc_rx_title);
gtk_grid_attach(GTK_GRID(grid),oc_rx_title,i,2,1,1);
gtk_grid_attach(GTK_GRID(grid),oc_tx_title,i+7,2,1,1);
}
- for(i=0;i<BANDS+XVTRS;i++) {
+ int bands=BANDS;
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch(device) {
+ case DEVICE_HERMES_LITE:
+ case DEVICE_HERMES_LITE2:
+ bands=band10+1;
+ break;
+ default:
+ bands=band6+1;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch(device) {
+ case NEW_DEVICE_HERMES_LITE:
+ case NEW_DEVICE_HERMES_LITE2:
+ bands=band10+1;
+ break;
+ default:
+ bands=band6+1;
+ break;
+ }
+ break;
+ }
+
+ int row=3;
+
+ for(i=0;i<bands;i++) {
BAND *band=band_get_band(i);
if(strlen(band->title)>0) {
- GtkWidget *band_label=gtk_label_new(band->title);
- //gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
- gtk_widget_show(band_label);
- gtk_grid_attach(GTK_GRID(grid),band_label,0,i+3,1,1);
-
- int mask;
- for(j=1;j<8;j++) {
- mask=0x01<<(j-1);
- GtkWidget *oc_rx_b=gtk_check_button_new();
- //gtk_widget_override_font(oc_rx_b, pango_font_description_from_string("Arial 18"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_rx_b), (band->OCrx&mask)==mask);
- gtk_widget_show(oc_rx_b);
- gtk_grid_attach(GTK_GRID(grid),oc_rx_b,j,i+3,1,1);
- g_signal_connect(oc_rx_b,"toggled",G_CALLBACK(oc_rx_cb),(gpointer)(long)(j+(i<<4)));
-
- GtkWidget *oc_tx_b=gtk_check_button_new();
- //gtk_widget_override_font(oc_tx_b, pango_font_description_from_string("Arial 18"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_tx_b), (band->OCtx&mask)==mask);
- gtk_widget_show(oc_tx_b);
- gtk_grid_attach(GTK_GRID(grid),oc_tx_b,j+7,i+3,1,1);
- g_signal_connect(oc_tx_b,"toggled",G_CALLBACK(oc_tx_cb),(gpointer)(long)(j+(i<<4)));
-
+ GtkWidget *band_label=gtk_label_new(NULL);
+ char band_text[16];
+ sprintf(band_text,"<b>%s</b>",band->title);
+ gtk_label_set_markup(GTK_LABEL(band_label), band_text);
+ //gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(band_label);
+ gtk_grid_attach(GTK_GRID(grid),band_label,0,row,1,1);
+
+ int mask;
+ for(j=1;j<8;j++) {
+ mask=0x01<<(j-1);
+ GtkWidget *oc_rx_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_rx_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_rx_b), (band->OCrx&mask)==mask);
+ gtk_widget_show(oc_rx_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_rx_b,j,row,1,1);
+ g_signal_connect(oc_rx_b,"toggled",G_CALLBACK(oc_rx_cb),(gpointer)(long)(j+(i<<4)));
+
+ GtkWidget *oc_tx_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_tx_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_tx_b), (band->OCtx&mask)==mask);
+ gtk_widget_show(oc_tx_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_tx_b,j+7,row,1,1);
+ g_signal_connect(oc_tx_b,"toggled",G_CALLBACK(oc_tx_cb),(gpointer)(long)(j+(i<<4)));
+
+ }
+ row++;
}
}
+
+ for(i=BANDS;i<BANDS+XVTRS;i++) {
+ BAND *band=band_get_band(i);
+ if(strlen(band->title)>0) {
+ GtkWidget *band_label=gtk_label_new(band->title);
+ //gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
+ gtk_widget_show(band_label);
+ gtk_grid_attach(GTK_GRID(grid),band_label,0,row,1,1);
+
+ int mask;
+ for(j=1;j<8;j++) {
+ mask=0x01<<(j-1);
+ GtkWidget *oc_rx_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_rx_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_rx_b), (band->OCrx&mask)==mask);
+ gtk_widget_show(oc_rx_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_rx_b,j,row,1,1);
+ g_signal_connect(oc_rx_b,"toggled",G_CALLBACK(oc_rx_cb),(gpointer)(long)(j+(i<<4)));
+
+ GtkWidget *oc_tx_b=gtk_check_button_new();
+ //gtk_widget_override_font(oc_tx_b, pango_font_description_from_string("Arial 18"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (oc_tx_b), (band->OCtx&mask)==mask);
+ gtk_widget_show(oc_tx_b);
+ gtk_grid_attach(GTK_GRID(grid),oc_tx_b,j+7,row,1,1);
+ g_signal_connect(oc_tx_b,"toggled",G_CALLBACK(oc_tx_cb),(gpointer)(long)(j+(i<<4)));
+
+ }
+ row++;
+ }
}
int mask;
g_signal_connect(oc_tune_b,"toggled",G_CALLBACK(oc_tune_cb),(gpointer)(long)j);
}
- GtkWidget *oc_full_tune_time_title=gtk_label_new("Full Tune(ms):");
+ GtkWidget *oc_full_tune_time_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(oc_full_tune_time_title), "Full Tune(ms):");
//gtk_widget_override_font(oc_full_tune_time_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(oc_full_tune_time_title);
gtk_grid_attach(GTK_GRID(grid),oc_full_tune_time_title,18,j+1,2,1);
g_signal_connect(oc_full_tune_time_b,"value_changed",G_CALLBACK(oc_full_tune_time_cb),NULL);
j++;
- GtkWidget *oc_memory_tune_time_title=gtk_label_new("Memory Tune(ms):");
+ GtkWidget *oc_memory_tune_time_title=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(oc_memory_tune_time_title), "Memory Tune(ms):");
//gtk_widget_override_font(oc_memory_tune_time_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(oc_memory_tune_time_title);
gtk_grid_attach(GTK_GRID(grid),oc_memory_tune_time_title,18,j+1,2,1);
while (ifa) {
g_main_context_iteration(NULL, 0);
if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) {
- #ifdef RADIOBERRY
- if((ifa->ifa_flags&IFF_UP)==IFF_UP
- && (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING) {
- discover(ifa);
- }
- #else
if((ifa->ifa_flags&IFF_UP)==IFF_UP
- && (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING
- && (ifa->ifa_flags&IFF_LOOPBACK)!=IFF_LOOPBACK) {
+ && (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING) {
+ //&& (ifa->ifa_flags&IFF_LOOPBACK)!=IFF_LOOPBACK) {
discover(ifa);
}
- #endif
}
ifa = ifa->ifa_next;
}
#include "signal.h"
#include "toolbar.h"
#include "vfo.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
-#ifdef PSK
-#include "psk.h"
-#endif
#include "ext.h"
#include "iambic.h"
#include "error_handler.h"
static int samples=0;
static int mic_samples=0;
static int mic_sample_divisor=1;
-#ifdef FREEDV
-static int freedv_divisor=6;
-#endif
-#ifdef PSK
-static int psk_samples=0;
-static int psk_divisor=6;
-#endif
static int local_ptt=0;
static int dash=0;
void old_protocol_init(int rx,int pixels,int rate) {
int i;
- fprintf(stderr,"old_protocol_init: num_hpsdr_receivers=%d\n",how_many_receivers());
+ g_print("old_protocol_init: num_hpsdr_receivers=%d\n",how_many_receivers());
old_protocol_set_mic_sample_rate(rate);
if(transmitter->local_microphone) {
if(audio_open_input()!=0) {
- fprintf(stderr,"audio_open_input failed\n");
+ g_print("audio_open_input failed\n");
transmitter->local_microphone=0;
}
}
// if we have a USB interfaced Ozy device:
//
if (device == DEVICE_OZY) {
- fprintf(stderr,"old_protocol_init: initialise ozy on USB\n");
+ g_print("old_protocol_init: initialise ozy on USB\n");
ozy_initialise();
start_usb_receive_threads();
}
else
#endif
{
- fprintf(stderr,"old_protocol starting receive thread: buffer_size=%d output_buffer_size=%d\n",buffer_size,output_buffer_size);
+ g_print("old_protocol starting receive thread: buffer_size=%d output_buffer_size=%d\n",buffer_size,output_buffer_size);
if (radio->use_tcp) {
open_tcp_socket();
} else {
receive_thread_id = g_thread_new( "old protocol", receive_thread, NULL);
if( ! receive_thread_id )
{
- fprintf(stderr,"g_thread_new failed on receive_thread\n");
+ g_print("g_thread_new failed on receive_thread\n");
exit( -1 );
}
- fprintf(stderr, "receive_thread: id=%p\n",receive_thread_id);
+ g_print( "receive_thread: id=%p\n",receive_thread_id);
}
- fprintf(stderr,"old_protocol_init: prime radio\n");
+ g_print("old_protocol_init: prime radio\n");
for(i=8;i<OZY_BUFFER_SIZE;i++) {
output_buffer[i]=0;
}
//
static void start_usb_receive_threads()
{
- fprintf(stderr,"old_protocol starting USB receive thread: buffer_size=%d\n",buffer_size);
+ g_print("old_protocol starting USB receive thread: buffer_size=%d\n",buffer_size);
ozy_EP6_rx_thread_id = g_thread_new( "OZY EP6 RX", ozy_ep6_rx_thread, NULL);
if( ! ozy_EP6_rx_thread_id )
{
- fprintf(stderr,"g_thread_new failed for ozy_ep6_rx_thread\n");
+ g_print("g_thread_new failed for ozy_ep6_rx_thread\n");
exit( -1 );
}
}
static gpointer ozy_ep6_rx_thread(gpointer arg) {
int bytes;
- fprintf(stderr, "old_protocol: USB EP6 receive_thread\n");
+ g_print( "old_protocol: USB EP6 receive_thread\n");
running=1;
while (running)
if (bytes == 0)
{
- fprintf(stderr,"old_protocol_ep6_read: ozy_read returned 0 bytes... retrying\n");
+ g_print("old_protocol_ep6_read: ozy_read returned 0 bytes... retrying\n");
continue;
}
else if (bytes != EP6_BUFFER_SIZE)
{
- fprintf(stderr,"old_protocol_ep6_read: OzyBulkRead failed %d bytes\n",bytes);
+ g_print("old_protocol_ep6_read: OzyBulkRead failed %d bytes\n",bytes);
perror("ozy_read(EP6 read failed");
//exit(1);
}
if (setsockopt(tmp, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval))<0) {
perror("data_socket: SO_RCVBUF");
}
+
//
// set a timeout for receive
// This is necessary because we might already "sit" in an UDP recvfrom() call while
}
// bind to the interface
+g_print("binding UDP socket to %s:%d\n",inet_ntoa(radio->info.network.interface_address.sin_addr),ntohs(radio->info.network.interface_address.sin_port));
if(bind(tmp,(struct sockaddr*)&radio->info.network.interface_address,radio->info.network.interface_length)<0) {
perror("old_protocol: bind socket failed for data_socket\n");
exit(-1);
memcpy(&data_addr,&radio->info.network.address,radio->info.network.address_length);
data_addr.sin_port=htons(DATA_PORT);
data_socket=tmp;
- fprintf(stderr,"UDP socket established: %d\n", data_socket);
+ g_print("UDP socket established: %d\n", data_socket);
}
static void open_tcp_socket() {
memcpy(&data_addr,&radio->info.network.address,radio->info.network.address_length);
data_addr.sin_port=htons(DATA_PORT);
data_addr.sin_family = AF_INET;
- fprintf(stderr,"Trying to open TCP connection to %s\n", inet_ntoa(radio->info.network.address.sin_addr));
+ g_print("Trying to open TCP connection to %s\n", inet_ntoa(radio->info.network.address.sin_addr));
tmp=socket(AF_INET, SOCK_STREAM, 0);
if (tmp < 0) {
perror("tcp_socket: SO_RCVBUF");
}
tcp_socket=tmp;
- fprintf(stderr,"TCP socket established: %d\n", tcp_socket);
+ g_print("TCP socket established: %d\n", tcp_socket);
}
static gpointer receive_thread(gpointer arg) {
int ep;
uint32_t sequence;
- fprintf(stderr, "old_protocol: receive_thread\n");
+ g_print( "old_protocol: receive_thread\n");
running=1;
length=sizeof(addr);
// A sequence error with a seqnum of zero usually indicates a METIS restart
// and is no error condition
if (sequence != 0 && sequence != last_seq_num+1) {
- fprintf(stderr,"SEQ ERROR: last %ld, recvd %ld\n", (long) last_seq_num, (long) sequence);
+ g_print("SEQ ERROR: last %ld, recvd %ld\n", (long) last_seq_num, (long) sequence);
}
last_seq_num=sequence;
switch(ep) {
*/
break;
default:
- fprintf(stderr,"unexpected EP %d length=%d\n",ep,bytes_read);
+ g_print("unexpected EP %d length=%d\n",ep,bytes_read);
break;
}
break;
case 2: // response to a discovery packet
- fprintf(stderr,"unexepected discovery response when not in discovery mode\n");
+ g_print("unexepected discovery response when not in discovery mode\n");
break;
default:
- fprintf(stderr,"unexpected packet type: 0x%02X\n",buffer[2]);
+ g_print("unexpected packet type: 0x%02X\n",buffer[2]);
break;
}
} else {
- fprintf(stderr,"received bad header bytes on data port %02X,%02X\n",buffer[0],buffer[1]);
+ g_print("received bad header bytes on data port %02X,%02X\n",buffer[0],buffer[1]);
}
break;
}
vfonum=-1;
break;
}
- //
// Radios with small FPGAs use RX1/RX2 for feedback while transmitting,
//
if (isTransmitting() && transmitter->puresignal && (chan == rx_feedback_channel() || chan == tx_feedback_channel())) {
}
}
#endif
- return ret;
+ return ret;
}
static void process_ozy_input_buffer(unsigned char *buffer) {
IO3=(control_in[1]&0x08)?0:1;
if(mercury_software_version!=control_in[2]) {
mercury_software_version=control_in[2];
- fprintf(stderr," Mercury Software version: %d (0x%0X)\n",mercury_software_version,mercury_software_version);
+ g_print(" Mercury Software version: %d (0x%0X)\n",mercury_software_version,mercury_software_version);
}
if(penelope_software_version!=control_in[3]) {
penelope_software_version=control_in[3];
- fprintf(stderr," Penelope Software version: %d (0x%0X)\n",penelope_software_version,penelope_software_version);
+ g_print(" Penelope Software version: %d (0x%0X)\n",penelope_software_version,penelope_software_version);
}
if(ozy_software_version!=control_in[4]) {
ozy_software_version=control_in[4];
- fprintf(stderr,"FPGA firmware version: %d.%d\n",ozy_software_version/10,ozy_software_version%10);
+ g_print("FPGA firmware version: %d.%d\n",ozy_software_version/10,ozy_software_version%10);
}
break;
case 1:
mic_samples++;
if(mic_samples>=mic_sample_divisor) { // reduce to 48000
fsample = transmitter->local_microphone ? audio_get_next_mic_sample() : (float) mic_sample * 0.00003051;
-#ifdef FREEDV
- if(active_receiver->freedv) {
- add_freedv_mic_sample(transmitter,fsample);
- } else {
-#endif
- add_mic_sample(transmitter,fsample);
-#ifdef FREEDV
- }
-#endif
+ add_mic_sample(transmitter,fsample);
mic_samples=0;
}
time(&t);
gmt=gmtime(&t);
- fprintf(stderr,"%s: process_ozy_input_buffer: did not find sync: restarting\n",
+ g_print("%s: process_ozy_input_buffer: did not find sync: restarting\n",
asctime(gmt));
// Out of paranoia: print warning and choose ANT1
//
if (i<0 || i>2) {
- fprintf(stderr,"WARNING: illegal TX antenna chosen, using ANT1\n");
+ g_print("WARNING: illegal TX antenna chosen, using ANT1\n");
transmitter->alex_antenna=0;
i=0;
}
{
BAND *band=band_get_current_band();
int power=0;
+static int last_power=0;
//
// Some HPSDR apps for the RedPitaya generate CW inside the FPGA, but while
// doing this, DriveLevel changes are processed by the server, but do not become effective.
power=transmitter->drive_level;
}
}
+
+if(last_power!=power) {
+ g_print("power=%d\n",power);
+ last_power=power;
+}
+
+
output_buffer[C0]=0x12;
output_buffer[C1]=power&0xFF;
if(mic_linein) {
output_buffer[C2]|=0x02;
}
- if(filter_board==APOLLO) {
+ if(filter_board==APOLLO || device==DEVICE_HERMES_LITE2) {
output_buffer[C2]|=0x2C;
}
if((filter_board==APOLLO) && tune) {
output_buffer[C2]|=0x10;
}
+ if((device==DEVICE_HERMES_LITE2) && pa_enabled) {
+ output_buffer[C2]|=0x10; // Enable PA
+ }
if(band_get_current()==band6) {
output_buffer[C3]=output_buffer[C3]|0x40; // Alex 6M low noise amplifier
}
// to behave differently and stores bit5 of the gain in the
// dither bit (see above) and a 5-bit attenuation value here.
//
- int rxgain = rx_gain_calibration - adc_attenuation[active_receiver->adc];
+ int rxgain = rx_gain_calibration - adc_attenuation[active_receiver->adc]+12; // -12..48 to 0..60
if (rxgain < 0) rxgain=0;
if (rxgain > 60) rxgain=60;
// encode all 6 bits of RXgain in ATT value and set bit6
* ship out line after each complete run
*/
if (proto_mod && command == 1) {
- fprintf(stderr,"DIS=%d DRIVE=%3d PTT=%d i1=%4d RXout=%d RXant=%d i2=%d TXrel=%d FB=%d BP=%d LNA=%d HPF=%02x LPF=%02x\n",
+ g_print("DIS=%d DRIVE=%3d PTT=%d i1=%4d RXout=%d RXant=%d i2=%d TXrel=%d FB=%d BP=%d LNA=%d HPF=%02x LPF=%02x\n",
C3_TXDIS, C1_DRIVE, PC_PTT, CASE1, C3_RX1_OUT, C3_RX1_ANT, CASE2, C4_TX_REL,
C2_FB, C3_BP, C3_LNA, C3_HPF, C4_LPF);
proto_mod=0;
#endif
metis_write(0x02,output_buffer,OZY_BUFFER_SIZE);
- //fprintf(stderr,"C0=%02X C1=%02X C2=%02X C3=%02X C4=%02X\n",
+ //g_print("C0=%02X C1=%02X C2=%02X C3=%02X C4=%02X\n",
// output_buffer[C0],output_buffer[C1],output_buffer[C2],output_buffer[C3],output_buffer[C4]);
}
ozy_send_buffer();
}
- usleep(250000L);
+ usleep(250000);
// start the data flowing
metis_start_stop(1);
tcp_socket=-1;
usleep(100000); // give some time to swallow incoming TCP packets
close(tmp);
- fprintf(stderr,"TCP socket closed\n");
+ g_print("TCP socket closed\n");
}
#ifdef USBOZY
if (tcp_socket >= 0) {
if (length != 1032) {
- fprintf(stderr,"PROGRAMMING ERROR: TCP LENGTH != 1032\n");
+ g_print("PROGRAMMING ERROR: TCP LENGTH != 1032\n");
exit(-1);
}
if(sendto(tcp_socket,buffer,length,0,NULL, 0) != length) {
perror("sendto socket failed for TCP metis_send_data\n");
}
} else if (data_socket >= 0) {
- if(sendto(data_socket,buffer,length,0,(struct sockaddr*)&data_addr,sizeof(data_addr))!=length) {
+ int rc;
+ if((rc=sendto(data_socket,buffer,length,0,(struct sockaddr*)&data_addr,sizeof(data_addr)))!=length) {
perror("sendto socket failed for UDP metis_send_data\n");
}
} else {
// This should not happen
- fprintf(stderr,"METIS send: neither UDP nor TCP socket available!\n");
+ g_print("METIS send: neither UDP nor TCP socket available!\n");
exit(-1);
}
}
static GtkWidget *dialog=NULL;
+static GtkWidget *grid2;
+
static void cleanup() {
if(dialog!=NULL) {
gtk_widget_destroy(dialog);
tx_out_of_band=tx_out_of_band==1?0:1;
}
+static void trim_changed_cb(GtkWidget *widget, gpointer data) {
+ int i=GPOINTER_TO_INT(data);
+ pa_trim[i]=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
+}
+
+static void show_1W(gboolean reset) {
+ int i;
+ char text[16];
+
+ if(reset) {
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*100;
+ }
+ }
+ for(i=1;i<11;i++) {
+ sprintf(text,"<b>%dmW</b>",pa_trim[i]);
+ GtkWidget *label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), text);
+ gtk_grid_attach(GTK_GRID(grid2),label,0,i,1,1);
+
+ GtkWidget *spin=gtk_spin_button_new_with_range(0.0,(double)((i+2)*100),1.0);
+ gtk_grid_attach(GTK_GRID(grid2),spin,1,i,1,1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),(double)pa_trim[i]);
+ g_signal_connect(spin,"value_changed",G_CALLBACK(trim_changed_cb),GINT_TO_POINTER(i));
+ }
+}
+
+static void show_W(int watts,gboolean reset) {
+ int i;
+ char text[16];
+ int increment=watts/10;
+
+ if(reset) {
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*increment;
+ }
+ }
+
+ for(i=1;i<11;i++) {
+ sprintf(text,"<b>%dW</b>",pa_trim[i]);
+ GtkWidget *label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), text);
+ gtk_grid_attach(GTK_GRID(grid2),label,0,i,1,1);
+
+ GtkWidget *spin=gtk_spin_button_new_with_range(0.0,(double)((i+2)*increment),1.0);
+ gtk_grid_attach(GTK_GRID(grid2),spin,1,i,1,1);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),(double)pa_trim[i]);
+ g_signal_connect(spin,"value_changed",G_CALLBACK(trim_changed_cb),GINT_TO_POINTER(i));
+ }
+}
+
+static void clear_W() {
+ int i;
+ for(i=0;i<10;i++) {
+ gtk_grid_remove_row(GTK_GRID(grid2),1);
+ }
+}
+
+static void max_power_changed_cb(GtkWidget *widget, gpointer data) {
+ pa_power = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+g_print("max_power_changed_cb: %d\n",pa_power);
+ clear_W();
+ switch(pa_power) {
+ case PA_1W:
+ show_1W(TRUE);
+ break;
+ case PA_10W:
+ show_W(10,TRUE);
+ break;
+ case PA_30W:
+ show_W(30,TRUE);
+ break;
+ case PA_50W:
+ show_W(50,TRUE);
+ break;
+ case PA_100W:
+ show_W(100,TRUE);
+ break;
+ case PA_200W:
+ show_W(200,TRUE);
+ break;
+ case PA_500W:
+ show_W(500,TRUE);
+ break;
+ }
+ gtk_widget_show_all(grid2);
+}
+
void pa_menu(GtkWidget *parent) {
int i;
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 *notebook=gtk_notebook_new();
+
+ GtkWidget *grid0=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid0),10);
GtkWidget *close_b=gtk_button_new_with_label("Close");
g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
- gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+ gtk_grid_attach(GTK_GRID(grid0),close_b,0,0,1,1);
+
+ GtkWidget *max_power_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(max_power_label), "<b>MAX Power</b>");
+ gtk_grid_attach(GTK_GRID(grid0),max_power_label,1,0,1,1);
+
+ GtkWidget *max_power_b=gtk_combo_box_text_new();
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"1W");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"10W");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"30W");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"50W");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"100W");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"200W");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(max_power_b),NULL,"500W");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(max_power_b),pa_power);
+ gtk_grid_attach(GTK_GRID(grid0),max_power_b,2,0,1,1);
+ g_signal_connect(max_power_b,"changed",G_CALLBACK(max_power_changed_cb),NULL);
+
+ GtkWidget *tx_out_of_band_b=gtk_check_button_new_with_label("Transmit out of band");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx_out_of_band_b), tx_out_of_band);
+ gtk_widget_show(tx_out_of_band_b);
+ gtk_grid_attach(GTK_GRID(grid0),tx_out_of_band_b,3,0,1,1);
+ g_signal_connect(tx_out_of_band_b,"toggled",G_CALLBACK(tx_out_of_band_cb),NULL);
+
+ GtkWidget *grid1=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid1),10);
- for(i=0;i<BANDS;i++) {
+ int bands=BANDS;
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch(device) {
+ case DEVICE_HERMES_LITE:
+ case DEVICE_HERMES_LITE2:
+ bands=band10+1;
+ break;
+ default:
+ bands=band6+1;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch(device) {
+ case NEW_DEVICE_HERMES_LITE:
+ case NEW_DEVICE_HERMES_LITE2:
+ bands=band10+1;
+ break;
+ default:
+ bands=band6+1;
+ break;
+ }
+ break;
+ }
+
+
+ for(i=0;i<bands;i++) {
BAND *band=band_get_band(i);
- GtkWidget *band_label=gtk_label_new(band->title);
+ GtkWidget *band_label=gtk_label_new(NULL);
+ char band_text[32];
+ sprintf(band_text,"<b>%s</b>",band->title);
+ gtk_label_set_markup(GTK_LABEL(band_label), band_text);
//gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(band_label);
- gtk_grid_attach(GTK_GRID(grid),band_label,(i/6)*2,(i%6)+1,1,1);
+ gtk_grid_attach(GTK_GRID(grid1),band_label,(i/6)*2,(i%6)+1,1,1);
GtkWidget *pa_r=gtk_spin_button_new_with_range(38.8,100.0,0.1);
//gtk_widget_override_font(pa_r, pango_font_description_from_string("Arial 18"));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(pa_r),(double)band->pa_calibration);
gtk_widget_show(pa_r);
- gtk_grid_attach(GTK_GRID(grid),pa_r,((i/6)*2)+1,(i%6)+1,1,1);
+ gtk_grid_attach(GTK_GRID(grid1),pa_r,((i/6)*2)+1,(i%6)+1,1,1);
g_signal_connect(pa_r,"value_changed",G_CALLBACK(pa_value_changed_cb),band);
}
- GtkWidget *tx_out_of_band_b=gtk_check_button_new_with_label("Transmit out of band");
- //gtk_widget_override_font(tx_out_of_band_b, pango_font_description_from_string("Arial 18"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx_out_of_band_b), tx_out_of_band);
- gtk_widget_show(tx_out_of_band_b);
- gtk_grid_attach(GTK_GRID(grid),tx_out_of_band_b,0,7,4,1);
- g_signal_connect(tx_out_of_band_b,"toggled",G_CALLBACK(tx_out_of_band_cb),NULL);
-
- gtk_container_add(GTK_CONTAINER(content),grid);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook),grid1,gtk_label_new("Calibrate"));
+
+ grid2=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid2),10);
+
+ switch(pa_power) {
+ case PA_1W:
+ show_1W(FALSE);
+ break;
+ case PA_10W:
+ show_W(10,FALSE);
+ break;
+ case PA_30W:
+ show_W(30,FALSE);
+ break;
+ case PA_50W:
+ show_W(50,FALSE);
+ break;
+ case PA_100W:
+ show_W(100,FALSE);
+ break;
+ case PA_200W:
+ show_W(200,FALSE);
+ break;
+ case PA_500W:
+ show_W(500,FALSE);
+ break;
+ }
+
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook),grid2,gtk_label_new("Watt Meter Calibrate"));
+
+ gtk_grid_attach(GTK_GRID(grid0),notebook,0,1,6,1);
+ gtk_container_add(GTK_CONTAINER(content),grid0);
sub_menu=dialog;
*
*/
+#include <gtk/gtk.h>
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "property.h"
-PROPERTY* properties;
+PROPERTY* properties=NULL;
static double version=0.0;
+void clearProperties() {
+g_print("clearProperties\n");
+ if(properties!=NULL) {
+ // free all the properties
+ PROPERTY *next;
+ while(properties!=NULL) {
+ next=properties->next_property;
+ free(properties);
+ properties=next;
+ }
+ }
+}
+
/* --------------------------------------------------------------------------*/
/**
* @brief Load Properties
char* name;
char* value;
FILE* f=fopen(filename,"r");
- properties=NULL;
PROPERTY* property;
fprintf(stderr,"loadProperties: %s\n",filename);
-
+ clearProperties();
if(f) {
while(fgets(string,sizeof(string),f)) {
if(string[0]!='#') {
PROPERTY* next_property;
};
+extern void clearProperties();
extern void loadProperties(char* filename);
extern char* getProperty(char* name);
extern void setProperty(char* name,char* value);
-
extern void saveProperties(char* filename);
#endif
* PureSignal 2.0 parameters and declarations
*/
-static double ampdelay = 150e-9; // 150 nsec
+static double ampdelay = 150e-9; // 150 nsec
static int ints = 16;
static int spi = 256; // ints=16/spi=256 corresponds to "TINT=0.5 dB"
static int stbl = 0; // "Stbl" un-checked
old5_2=info[5];
switch(state) {
case 0:
- //
+ //
// A value of 175 means 1.2 dB too strong
// A value of 132 means 1.2 dB too weak
//
+++ /dev/null
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pskcoresdr.h>
-#include <wdsp.h>
-
-#include "psk.h"
-#include "radio.h"
-#include "channel.h"
-
-static void *detector;
-
-static double buffer[PSK_BUFFER_SIZE];
-static float spectrum_buffer[PSK_BUFFER_SIZE];
-static int psk_index;
-
-#define PSK_TEXT_SIZE 128
-static char psk_text[PSK_TEXT_SIZE];
-
-GtkWidget *dialog;
-GtkWidget *psk_label;
-
-#define TEXT_LINES 10
-#define TEXT_LINE_LENGTH 80
-char text_label[TEXT_LINES][TEXT_LINE_LENGTH+1];
-int first_text_line=0;
-int current_text_line=9;
-int current_text_offset=0;
-
-static char temp_text[TEXT_LINES*(TEXT_LINE_LENGTH+1)];
-
-static void build_temp_text() {
- int i;
- int offset=0;
- i=first_text_line;
- do {
- strcpy(&temp_text[offset],text_label[i]);
- offset+=strlen(text_label[i]);
- temp_text[offset]=0x0D;
- offset++;
- i++;
- if(i==TEXT_LINES) {
- i=0;
- }
- } while (i!=first_text_line);
-
- // replace last \r with \0
- temp_text[offset-1]='\0';
-}
-
-static void add_text(char *text, int length) {
- int i;
-
- for(i=0;i<length;i++) {
- if(text[i]==0x0D || text[i]==0x11 || current_text_offset>=TEXT_LINE_LENGTH) {
- current_text_line++;
- if(current_text_line==TEXT_LINES) {
- current_text_line=0;
- }
- first_text_line++;
- if(first_text_line==TEXT_LINES) {
- first_text_line=0;
- }
- current_text_offset=0;
- }
- if(text[i]==0x08 || text[i]==0x7F) {
- if(current_text_offset>0) {
- current_text_offset--;
- }
- } else {
- if(text[i]!=0x0D && text[i]!=0x0A) {
- if(text[i]>0x1F) {
- text_label[current_text_line][current_text_offset++]=text[i];
- }
- }
- }
- text_label[current_text_line][current_text_offset]=0x00;
- }
-}
-
-GtkWidget *init_psk() {
- int i;
-
- psk_index=0;
- detector=createPSKDet(8000);
- if(detector==NULL) {
- fprintf(stderr,"init_psk: createPSKDet return null!\n");
- return NULL;
- }
- SetRXFrequency(detector,1500);
- ResetDetector(detector);
-
- for(i=0;i<TEXT_LINES;i++) {
- text_label[i][0]='\0';
- }
- build_temp_text();
- psk_label=gtk_label_new(temp_text);
- gtk_label_set_single_line_mode (GTK_LABEL(psk_label), FALSE);
- gtk_label_set_width_chars (GTK_LABEL(psk_label), 80);
- gtk_label_set_lines (GTK_LABEL(psk_label), TEXT_LINES);
- gtk_label_set_line_wrap (GTK_LABEL(psk_label), TRUE);
- gtk_misc_set_alignment (GTK_MISC(psk_label), 0, 0);
- //gtk_widget_set_halign(psk_label,GTK_ALIGN_START);
- //gtk_widget_set_valign(psk_label,GTK_ALIGN_START);
-
- return psk_label;
-}
-
-void close_psk() {
- if(detector!=NULL) {
- freePSKDet(detector);
- gtk_widget_destroy (dialog);
- }
-}
-
-void psk_set_frequency(int f) {
- if(detector!=NULL) {
- SetRXFrequency(detector,f);
- ResetDetector(detector);
- }
-}
-
-int psk_get_frequency() {
- return GetRXFrequency(detector);
-}
-
-int psk_get_signal_level() {
- return GetSignalLevel(detector);
-}
-
-static gint psk_update(void* arg) {
- gtk_label_set_text(GTK_LABEL(psk_label),temp_text);
- return 0;
-}
-
-int psk_demod(double sample) {
- int i;
- int c;
- int new_lines;
- if(detector!=NULL) {
- buffer[psk_index]=sample;
- spectrum_buffer[psk_index]=(float)sample;
- psk_index++;
- if(psk_index==PSK_BUFFER_SIZE) {
- int detected=runPSKDet(detector,buffer,PSK_BUFFER_SIZE,1,psk_text,PSK_TEXT_SIZE);
- psk_text[detected]='\0';
- if(detected>0) {
- add_text(psk_text,detected);
- build_temp_text();
- g_idle_add(psk_update,(gpointer)NULL);
- }
- Spectrum(CHANNEL_PSK,0,0,spectrum_buffer,spectrum_buffer);
- psk_index=0;
- }
- }
-}
+++ /dev/null
-/* Copyright (C)
-* 2016 - 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.
-*
-*/
-
-#ifndef _PSK_H
-#define _PSK_H
-
-#define PSK_BUFFER_SIZE 1024
-
-#define PSK_RX_TEXT_SIZE 2048
-extern char psk_rx_text_data[PSK_RX_TEXT_SIZE];
-
-extern GtkWidget *init_psk();
-extern void close_psk();
-extern void psk_set_frequency(int f);
-extern int psk_get_frequency();
-extern int psk_get_signal_level();
-extern int psk_demod(double sample);
-
-#endif
+++ /dev/null
-/* 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 <gtk/gtk.h>
-#include <gdk/gdk.h>
-#include <math.h>
-#include <unistd.h>
-#include <semaphore.h>
-#include <string.h>
-#include "filter.h"
-#include "radio.h"
-#include "vfo.h"
-#include "psk.h"
-#include "psk_waterfall.h"
-#include "receiver.h"
-
-static GtkWidget *waterfall;
-static GdkPixbuf *pixbuf = NULL;
-
-static int colorLowR=0; // black
-static int colorLowG=0;
-static int colorLowB=0;
-
-static int colorMidR=255; // red
-static int colorMidG=0;
-static int colorMidB=0;
-
-static int colorHighR=255; // yellow
-static int colorHighG=255;
-static int colorHighB=0;
-
-
-static gint first_x;
-static gint last_x;
-static gboolean has_moved=FALSE;
-static gboolean pressed=FALSE;
-
-static gfloat hz_per_pixel;
-
-/*
-#define BANDS 7
-static long long frequency[BANDS];
-static gint mode[BANDS];
-static gint band=4;
-*/
-
-// fixed for psk waterfall?
-static int psk_waterfall_low=30;
-static int psk_waterfall_high=90;
-
-static int display_width;
-static int waterfall_height;
-
-/* Create a new surface of the appropriate size to store our scribbles */
-static gboolean
-waterfall_configure_event_cb (GtkWidget *widget,
- GdkEventConfigure *event,
- gpointer data)
-{
- int width=gtk_widget_get_allocated_width (widget);
- int height=gtk_widget_get_allocated_height (widget);
- pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- char *pixels = gdk_pixbuf_get_pixels (pixbuf);
- memset(pixels, 0, width*height*3);
- return TRUE;
-}
-
-/* Redraw the screen from the surface. Note that the ::draw
- * signal receives a ready-to-be-used cairo_t that is already
- * clipped to only draw the exposed areas of the widget
- */
-static gboolean
-waterfall_draw_cb (GtkWidget *widget,
- cairo_t *cr,
- gpointer data)
-{
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_paint (cr);
-
- int cursor_x=(int)((float)psk_get_frequency()/hz_per_pixel);
- cairo_set_source_rgb (cr, 1, 0, 0);
- cairo_set_line_width(cr, 1.0);
- cairo_move_to(cr,(double)cursor_x,0.0);
- cairo_line_to(cr,(double)cursor_x,(double)waterfall_height);
-
- cairo_move_to(cr, (double)cursor_x+2.0,10.0);
- char f[8];
- sprintf(f,"%d",psk_get_frequency());
- cairo_show_text(cr, f);
-
- cairo_stroke(cr);
-
- return TRUE;
-}
-
-static gboolean
-waterfall_button_press_event_cb (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- float x=(float)event->x;
- int f=(int)(x*hz_per_pixel);
- psk_set_frequency(f);
- return TRUE;
-}
-
-static gboolean
-waterfall_button_release_event_cb (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
-/*
- int x=(int)event->x;
- if (event->button == 1) {
- if(has_moved) {
- // drag
- vfo_move((long long)((float)(x-last_x)*hz_per_pixel));
- } else {
- // move to this frequency
- vfo_move_to((long long)((float)(x-(display_width/2))*hz_per_pixel));
- }
- last_x=x;
- pressed=FALSE;
- }
-*/
- return TRUE;
-}
-
-static gboolean
-waterfall_motion_notify_event_cb (GtkWidget *widget,
- GdkEventMotion *event,
- gpointer data)
-{
-/*
- int x, y;
- GdkModifierType state;
- gdk_window_get_device_position (event->window,
- event->device,
- &x,
- &y,
- &state);
- if((state & GDK_BUTTON1_MASK == GDK_BUTTON1_MASK) || pressed) {
- int moved=last_x-x;
- vfo_move((long long)((float)moved*hz_per_pixel));
- last_x=x;
- has_moved=TRUE;
- }
-*/
- return TRUE;
-}
-
-static gboolean
-waterfall_scroll_event_cb (GtkWidget *widget,
- GdkEventScroll *event,
- gpointer data)
-{
-/*
- if(event->direction==GDK_SCROLL_UP) {
- vfo_move(step);
- } else {
- vfo_move(-step);
- }
-*/
- return TRUE;
-}
-
-void psk_waterfall_update(RECEIVER *rx) {
-
- int i;
-
- if(pixbuf) {
- char *pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- int width=gdk_pixbuf_get_width(pixbuf);
- int height=gdk_pixbuf_get_height(pixbuf);
- int rowstride=gdk_pixbuf_get_rowstride(pixbuf);
- int channels=gdk_pixbuf_get_n_channels(pixbuf);
-
- memmove(&pixels[rowstride],pixels,(height-1)*rowstride);
-
- float sample;
- int average=0;
- char *p;
- p=pixels;
- for(i=0;i<width;i++) {
- sample=data[i];
- average+=(int)sample;
- if(sample<(float)psk_waterfall_low) {
- *p++=colorLowR;
- *p++=colorLowG;
- *p++=colorLowB;
- } else if(sample>(float)psk_waterfall_high) {
- *p++=colorHighR;
- *p++=colorHighG;
- *p++=colorHighB;
- } else {
- float range=(float)psk_waterfall_high-(float)psk_waterfall_low;
- float offset=sample-(float)psk_waterfall_low;
- float percent=offset/range;
- if(percent<(2.0f/9.0f)) {
- float local_percent = percent / (2.0f/9.0f);
- *p++ = (int)((1.0f-local_percent)*colorLowR);
- *p++ = (int)((1.0f-local_percent)*colorLowG);
- *p++ = (int)(colorLowB + local_percent*(255-colorLowB));
- } else if(percent<(3.0f/9.0f)) {
- float local_percent = (percent - 2.0f/9.0f) / (1.0f/9.0f);
- *p++ = 0;
- *p++ = (int)(local_percent*255);
- *p++ = 255;
- } else if(percent<(4.0f/9.0f)) {
- float local_percent = (percent - 3.0f/9.0f) / (1.0f/9.0f);
- *p++ = 0;
- *p++ = 255;
- *p++ = (int)((1.0f-local_percent)*255);
- } else if(percent<(5.0f/9.0f)) {
- float local_percent = (percent - 4.0f/9.0f) / (1.0f/9.0f);
- *p++ = (int)(local_percent*255);
- *p++ = 255;
- *p++ = 0;
- } else if(percent<(7.0f/9.0f)) {
- float local_percent = (percent - 5.0f/9.0f) / (2.0f/9.0f);
- *p++ = 255;
- *p++ = (int)((1.0f-local_percent)*255);
- *p++ = 0;
- } else if(percent<(8.0f/9.0f)) {
- float local_percent = (percent - 7.0f/9.0f) / (1.0f/9.0f);
- *p++ = 255;
- *p++ = 0;
- *p++ = (int)(local_percent*255);
- } else {
- float local_percent = (percent - 8.0f/9.0f) / (1.0f/9.0f);
- *p++ = (int)((0.75f + 0.25f*(1.0f-local_percent))*255.0f);
- *p++ = (int)(local_percent*255.0f*0.5f);
- *p++ = 255;
- }
- }
- }
-
-
-/*
- if(waterfall_automatic) {
- waterfall_low=average/display_width;
- waterfall_high=waterfall_low+50;
- }
-*/
-
- gtk_widget_queue_draw (waterfall);
-
- }
-}
-
-GtkWidget* psk_waterfall_init(int width,int height) {
- display_width=width;
- waterfall_height=height;
-
- hz_per_pixel=(double)(8000/2)/(double)display_width;
-
- //waterfall_frame = gtk_frame_new (NULL);
- waterfall = gtk_drawing_area_new ();
- gtk_widget_set_size_request (waterfall, width, height);
-
- /* Signals used to handle the backing surface */
- g_signal_connect (waterfall, "draw",
- G_CALLBACK (waterfall_draw_cb), NULL);
- g_signal_connect (waterfall,"configure-event",
- G_CALLBACK (waterfall_configure_event_cb), NULL);
-
- //pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);
-
- /* Event signals */
- g_signal_connect (waterfall, "motion-notify-event",
- G_CALLBACK (waterfall_motion_notify_event_cb), NULL);
- g_signal_connect (waterfall, "button-press-event",
- G_CALLBACK (waterfall_button_press_event_cb), NULL);
- g_signal_connect (waterfall, "button-release-event",
- G_CALLBACK (waterfall_button_release_event_cb), NULL);
- g_signal_connect(waterfall,"scroll_event",
- G_CALLBACK(waterfall_scroll_event_cb),NULL);
-
- /* Ask to receive events the drawing area doesn't normally
- * subscribe to. In particular, we need to ask for the
- * button press and motion notify events that want to handle.
- */
- gtk_widget_set_events (waterfall, gtk_widget_get_events (waterfall)
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON1_MOTION_MASK
- | GDK_SCROLL_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK);
-
- return waterfall;
-}
+++ /dev/null
-/* 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.
-*
-*/
-
-#ifndef _PSK_WATERFALL_H
-#define _PSK_WATERFALL_H
-
-void psk_waterfall_update(RECEIVER *rx);
-GtkWidget* psk_waterfall_init(int width,int height);
-
-#endif
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
-#ifdef FREEDV
-#include "freedv.h"
-#endif
-#include "audio_waterfall.h"
#ifdef GPIO
#include "gpio.h"
#endif
#define SLIDERS_HEIGHT (100)
#define TOOLBAR_HEIGHT (30)
#define WATERFALL_HEIGHT (105)
-#ifdef PSK
-#define PSK_WATERFALL_HEIGHT (90)
-#define PSK_HEIGHT (display_height-(VFO_HEIGHT+PSK_WATERFALL_HEIGHT+SLIDERS_HEIGHT+TOOLBAR_HEIGHT))
-#endif
-
-#ifdef FREEDV
-#define FREEDV_WATERFALL_HEIGHT (105)
-#endif
GtkWidget *fixed;
static GtkWidget *vfo_panel;
static GtkWidget *toolbar;
static GtkWidget *panadapter;
static GtkWidget *waterfall;
-#ifdef PSK
-static GtkWidget *psk;
-static GtkWidget *psk_waterfall;
-#endif
static GtkWidget *audio_waterfall;
#ifdef GPIO
static GtkWidget *encoders;
static cairo_surface_t *encoders_surface = NULL;
#endif
-#ifdef WIRIINGPI
-static GtkWidget *encoders;
-static cairo_surface_t *encoders_surface = NULL;
-#endif
-
-gint sat_mode;
+ gint sat_mode;
-int region=REGION_OTHER;
+ int region=REGION_OTHER;
-int echo=0;
+ int echo=0;
-int radio_sample_rate;
-gboolean iqswap;
+ int radio_sample_rate;
+ gboolean iqswap;
-static gint save_timer_id;
+ static gint save_timer_id;
-DISCOVERED *radio=NULL;
+ DISCOVERED *radio=NULL;
-char property_path[128];
+ char property_path[128];
#ifdef __APPLE__
-sem_t *property_sem;
+ sem_t *property_sem;
#else
-sem_t property_sem;
+ sem_t property_sem;
#endif
RECEIVER *receiver[MAX_RECEIVERS];
double tone_level=0.2;
int filter_board=ALEX;
-//int pa=PA_ENABLED;
-//int apollo_tuner=0;
+int pa_enabled=PA_ENABLED;
+int pa_power=0;
+int pa_trim[11];
int updates_per_second=10;
void reconfigure_radio() {
int i;
int y;
-//fprintf(stderr,"reconfigure_radio: receivers=%d\n",receivers);
+//g_print("reconfigure_radio: receivers=%d\n",receivers);
rx_height=display_height-VFO_HEIGHT;
if(display_sliders) {
rx_height-=SLIDERS_HEIGHT;
void start_radio() {
int i;
int y;
-//fprintf(stderr,"start_radio: selected radio=%p device=%d\n",radio,radio->device);
+//g_print("start_radio: selected radio=%p device=%d\n",radio,radio->device);
gdk_window_set_cursor(gtk_widget_get_window(top_window),gdk_cursor_new(GDK_WATCH));
int rc;
protocol=radio->protocol;
device=radio->device;
+ // set the default power output
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch(device) {
+ case DEVICE_METIS:
+ pa_power=PA_1W;
+ break;
+ case DEVICE_HERMES:
+ pa_power=PA_100W;
+ break;
+ case DEVICE_GRIFFIN:
+ pa_power=PA_100W;
+ break;
+ case DEVICE_ANGELIA:
+ pa_power=PA_100W;
+ break;
+ case DEVICE_ORION:
+ pa_power=PA_100W;
+ break;
+ case DEVICE_HERMES_LITE:
+ pa_power=PA_1W;
+ break;
+ case DEVICE_HERMES_LITE2:
+ pa_power=PA_10W;
+ break;
+ case DEVICE_ORION2:
+ pa_power=PA_200W;
+ break;
+ case DEVICE_STEMLAB:
+ pa_power=PA_100W;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch(device) {
+ case NEW_DEVICE_ATLAS:
+ pa_power=PA_1W;
+ break;
+ case NEW_DEVICE_HERMES:
+ case NEW_DEVICE_HERMES2:
+ pa_power=PA_100W;
+ break;
+ case NEW_DEVICE_ANGELIA:
+ pa_power=PA_100W;
+ break;
+ case NEW_DEVICE_ORION:
+ pa_power=PA_100W;
+ break;
+ case NEW_DEVICE_HERMES_LITE:
+ pa_power=PA_1W;
+ break;
+ case NEW_DEVICE_HERMES_LITE2:
+ pa_power=PA_10W;
+ break;
+ case NEW_DEVICE_ORION2:
+ pa_power=PA_200W;
+ break;
+ case DEVICE_STEMLAB:
+ pa_power=PA_100W;
+ break;
+ }
+ break;
+#ifdef SOAPYSDR
+ case SOAPYSDR_PROTOCOL:
+ pa_power=PA_1W;
+ break;
+#endif
+ }
+
+ switch(pa_power) {
+ case PA_1W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*100;
+ }
+ break;
+ case PA_10W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i;
+ }
+ break;
+ case PA_30W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*3;
+ }
+ break;
+ case PA_50W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*5;
+ }
+ break;
+ case PA_100W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*10;
+ }
+ break;
+ case PA_200W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*20;
+ }
+ break;
+ case PA_500W:
+ for(i=0;i<11;i++) {
+ pa_trim[i]=i*50;
+ }
+ break;
+ }
+
//
// have_rx_gain determines whether we have "ATT" or "RX Gain" Sliders
// It is set for HermesLite (and RadioBerry, for that matter)
rc=sem_init(&property_sem, 0, 0);
#endif
if(rc!=0) {
- fprintf(stderr,"start_radio: sem_init failed for property_sem: %d\n", rc);
+ g_print("start_radio: sem_init failed for property_sem: %d\n", rc);
exit(-1);
}
#ifdef __APPLE__
adc_attenuation[0]=0;
adc_attenuation[1]=0;
+ if(have_rx_gain) {
+ adc_attenuation[0]=25;
+ adc_attenuation[1]=25;
+ }
+
adc[0].antenna=ANTENNA_1;
adc[0].filters=AUTOMATIC;
adc[0].hpf=HPF_13;
radio_sample_rate=radio->info.soapy.sample_rate;
#endif
-//fprintf(stderr,"meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration);
+//g_print("meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration);
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
- display_sliders=0;
- display_toolbar=0;
+#ifdef GPIO
+ switch(controller) {
+ case CONTROLLER2_V1:
+ case CONTROLLER2_V2:
+ display_sliders=0;
+ display_toolbar=0;
+ break;
+ default:
+ display_sliders=1;
+ display_toolbar=1;
+ break;
+ }
#else
display_sliders=1;
display_toolbar=1;
#endif
-#ifdef GPIO
- gpio_restore_state();
-#endif
radioRestoreState();
-
//
// It is possible that an option has been read in
// which is not compatible with the hardware.
gtk_container_remove(GTK_CONTAINER(top_window),grid);
gtk_container_add(GTK_CONTAINER(top_window), fixed);
-//fprintf(stderr,"radio: vfo_init\n");
+//g_print("radio: vfo_init\n");
vfo_panel = vfo_init(VFO_WIDTH,VFO_HEIGHT,top_window);
gtk_fixed_put(GTK_FIXED(fixed),vfo_panel,0,y);
-//fprintf(stderr,"radio: meter_init\n");
+//g_print("radio: meter_init\n");
meter = meter_init(METER_WIDTH,METER_HEIGHT,top_window);
gtk_fixed_put(GTK_FIXED(fixed),meter,VFO_WIDTH,y);
active_receiver=receiver[0];
- //fprintf(stderr,"Create transmitter\n");
+ //g_print("Create transmitter\n");
if(can_transmit) {
if(duplex) {
transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width/4, display_height/2);
transmitter->x=0;
transmitter->y=VFO_HEIGHT;
+ calcDriveLevel();
+
#ifdef PURESIGNAL
tx_set_ps_sample_rate(transmitter,protocol==NEW_PROTOCOL?192000:active_receiver->sample_rate);
receiver[PS_TX_FEEDBACK]=create_pure_signal_receiver(PS_TX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
#endif
#ifdef GPIO
- if(gpio_init()<0) {
- fprintf(stderr,"GPIO failed to initialize\n");
+ if(controller!=NO_CONTROLLER) {
+ if(gpio_init()<0) {
+ g_print("GPIO failed to initialize\n");
+ }
}
#endif
#ifdef LOCALCW
// init local keyer if enabled
if (cw_keyer_internal == 0) {
- fprintf(stderr,"Initialize keyer.....\n");
+ g_print("Initialize keyer.....\n");
keyer_update();
}
#endif
}
if(display_sliders) {
-//fprintf(stderr,"create sliders\n");
+//g_print("create sliders\n");
sliders = sliders_init(display_width,SLIDERS_HEIGHT);
gtk_fixed_put(GTK_FIXED(fixed),sliders,0,y);
y+=SLIDERS_HEIGHT;
}
gtk_widget_show_all (fixed);
-//#ifdef FREEDV
-// if(!active_receiver->freedv) {
-// gtk_widget_hide(audio_waterfall);
-// }
-//#endif
-
// save every 30 seconds
//save_timer_id=gdk_threads_add_timeout(30000, save_cb, NULL);
-#ifdef PSK
- if(vfo[active_receiver->id].mode==modePSK) {
- show_psk();
- } else {
- show_waterfall();
- }
-#endif
-
if(rigctl_enable) {
launch_rigctl();
}
}
void disable_rigctl() {
- fprintf(stderr,"RIGCTL: disable_rigctl()\n");
+ g_print("RIGCTL: disable_rigctl()\n");
close_rigctl_ports();
}
// The button in the radio menu will call this function even if the
// number of receivers has not changed.
if (receivers == r) return;
- fprintf(stderr,"radio_change_receivers: from %d to %d\n",receivers,r);
+ g_print("radio_change_receivers: from %d to %d\n",receivers,r);
//
// When changing the number of receivers, restart the
// old protocol
#ifdef SOAPYSDR
case SOAPYSDR_PROTOCOL:
soapy_protocol_change_sample_rate(receiver[0],rate);
+ soapy_protocol_set_mic_sample_rate(rate);
break;
#endif
}
if(state) {
// switch to tx
-#ifdef FREEDV
- if(active_receiver->freedv) {
- freedv_reset_tx_text_index();
- }
-#endif
#ifdef PURESIGNAL
RECEIVER *rx_feedback=receiver[PS_RX_FEEDBACK];
RECEIVER *tx_feedback=receiver[PS_TX_FEEDBACK];
gtk_container_remove(GTK_CONTAINER(fixed),receiver[i]->panel);
}
}
-//#ifdef FREEDV
-// if(active_receiver->freedv) {
-// gtk_widget_show(audio_waterfall);
-// }
-//#endif
if(duplex) {
gtk_widget_show_all(transmitter->dialog);
} else {
gtk_container_remove(GTK_CONTAINER(fixed), transmitter->panel);
}
-//#ifdef FREEDV
-// if(active_receiver->freedv) {
-// gtk_widget_hide(audio_waterfall);
-// }
-//#endif
if(!duplex) {
for(i=0;i<receivers;i++) {
gtk_fixed_put(GTK_FIXED(fixed),receiver[i]->panel,receiver[i]->x,receiver[i]->y);
set_displaying(receiver[i],1);
}
}
-//#ifdef FREEDV
-// if(active_receiver->freedv) {
-// gtk_widget_show(audio_waterfall);
-// }
-//#endif
}
#ifdef PURESIGNAL
}
void frequency_changed(RECEIVER *rx) {
-//fprintf(stderr,"frequency_changed: channel=%d frequency=%ld lo=%ld error=%ld ctun=%d offset=%ld\n",rx->channel,rx->frequency_a,rx->lo_a,rx->error_a,rx->ctun,rx->offset);
+//g_print("frequency_changed: channel=%d frequency=%ld lo=%ld error=%ld ctun=%d offset=%ld\n",rx->channel,rx->frequency_a,rx->lo_a,rx->error_a,rx->ctun,rx->offset);
if(vfo[0].ctun) {
SetRXAShiftFreq(rx->id, (double)vfo[0].offset);
RXANBPSetShiftFrequency(rx->id, (double)vfo[0].offset);
level=(int)(actual_volts*255.0);
-//fprintf(stderr,"calcLevel: %f calib=%f level=%d\n",d, gbb, level);
return level;
}
if(isTransmitting() && protocol==NEW_PROTOCOL) {
schedule_high_priority();
}
-//fprintf(stderr,"calcDriveLevel: drive=%d drive_level=%d\n",transmitter->drive,transmitter->drive_level);
+//g_print("calcDriveLevel: drive=%d drive_level=%d\n",transmitter->drive,transmitter->drive_level);
}
void setDrive(double value) {
case NEW_PROTOCOL:
schedule_high_priority();
break;
-#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- //soapy_protocol_set_attenuation(value);
- break;
-#endif
}
}
}
void radioRestoreState() {
+ char name[32];
char *value;
+ int i;
-fprintf(stderr,"radioRestoreState: %s\n",property_path);
-//fprintf(stderr,"sem_wait\n");
+g_print("radioRestoreState: %s\n",property_path);
+//g_print("sem_wait\n");
#ifdef __APPLE__
sem_wait(property_sem);
#else
sem_wait(&property_sem);
#endif
-//fprintf(stderr,"sem_wait: returner\n");
+//g_print("sem_wait: returner\n");
loadProperties(property_path);
value=getProperty("diversity_enabled");
if(value) tx_out_of_band=atoi(value);
value=getProperty("filter_board");
if(value) filter_board=atoi(value);
-/*
- value=getProperty("apollo_tuner");
- if(value) apollo_tuner=atoi(value);
- value=getProperty("pa");
- if(value) pa=atoi(value);
-*/
+ value=getProperty("pa_enabled");
+ if(value) pa_enabled=atoi(value);
+ value=getProperty("pa_power");
+ if(value) pa_power=atoi(value);
+ for(i=0;i<11;i++) {
+ sprintf(name,"pa_trim[%d]",i);
+ value=getProperty(name);
+ if(value) pa_trim[i]=atoi(value);
+ }
value=getProperty("updates_per_second");
if(value) updates_per_second=atoi(value);
value=getProperty("display_filled");
modesettings_restore_state();
#ifdef GPIO
gpio_restore_actions();
-#endif
-#ifdef FREEDV
- freedv_restore_state();
#endif
value=getProperty("rigctl_enable");
if(value) rigctl_enable=atoi(value);
#endif
-//fprintf(stderr,"sem_post\n");
+//g_print("sem_post\n");
#ifdef __APPLE__
sem_post(property_sem);
#else
void radioSaveState() {
int i;
char value[80];
+ char name[32];
-fprintf(stderr,"radioSaveState: %s\n",property_path);
-//fprintf(stderr,"sem_wait\n");
+g_print("radioSaveState: %s\n",property_path);
#ifdef __APPLE__
sem_wait(property_sem);
#else
sem_wait(&property_sem);
#endif
-//fprintf(stderr,"sem_wait: returned\n");
+ clearProperties();
sprintf(value,"%d",diversity_enabled);
setProperty("diversity_enabled",value);
sprintf(value,"%f",div_gain);
setProperty("tx_filter_low",value);
sprintf(value,"%d",tx_filter_high);
setProperty("tx_filter_high",value);
+ sprintf(value,"%d",pa_enabled);
+ setProperty("pa_enabled",value);
+ sprintf(value,"%d",pa_power);
+ setProperty("pa_power",value);
+ for(i=0;i<11;i++) {
+ sprintf(name,"pa_trim[%d]",i);
+ sprintf(value,"%d",pa_trim[i]);
+ setProperty(name,value);
+ }
sprintf(value,"%lld",step);
setProperty("step",value);
sprintf(value,"%d",sat_mode);
setProperty("sat_mode",value);
-#ifdef FREEDV
- freedv_save_state();
-#endif
-
filterSaveState();
bandSaveState();
memSaveState();
#ifdef GPIO
- gpio_save_actions();
+ if(controller!=NO_CONTROLLER) {
+ gpio_save_actions();
+ }
#endif
sprintf(value,"%d",rigctl_enable);
setProperty("rigctl_port_base",value);
saveProperties(property_path);
-fprintf(stderr,"sem_post\n");
+g_print("sem_post\n");
#ifdef __APPLE__
sem_post(property_sem);
#else
void set_filter_type(int filter_type) {
int i;
- //fprintf(stderr,"set_filter_type: %d\n",filter_type);
+ //g_print("set_filter_type: %d\n",filter_type);
for(i=0;i<RECEIVERS;i++) {
receiver[i]->low_latency=filter_type;
RXASetMP(receiver[i]->id, filter_type);
void set_filter_size(int filter_size) {
int i;
- //fprintf(stderr,"set_filter_size: %d\n",filter_size);
+ //g_print("set_filter_size: %d\n",filter_size);
for(i=0;i<RECEIVERS;i++) {
receiver[i]->fft_size=filter_size;
RXASetNC(receiver[i]->id, filter_size);
TXASetNC(transmitter->id, filter_size);
}
-#ifdef FREEDV
-void set_freedv(int state) {
-fprintf(stderr,"set_freedv: rx=%p state=%d\n",active_receiver,state);
- g_mutex_lock(&active_receiver->freedv_mutex);
- active_receiver->freedv=state;
- if(active_receiver->freedv) {
- SetRXAPanelRun(active_receiver->id, 0);
- init_freedv(active_receiver);
- transmitter->freedv_samples=0;
- } else {
- SetRXAPanelRun(active_receiver->id, 1);
- close_freedv(active_receiver);
- }
- g_mutex_unlock(&active_receiver->freedv_mutex);
- g_idle_add(ext_vfo_update,NULL);
-}
-#endif
-
void radio_change_region(int r) {
region=r;
switch (region) {
#define OLD_ORION_MIC_BIAS_DISABLED 0x00
#define OLD_ORION_MIC_BIAS_ENABLED 0x20
+enum {
+ PA_1W=0,
+ PA_10W,
+ PA_30W,
+ PA_50W,
+ PA_100W,
+ PA_200W,
+ PA_500W
+};
+
extern DISCOVERED *radio;
extern GtkWidget *fixed;
extern TRANSMITTER *transmitter;
-/*
+
#define PA_DISABLED 0
#define PA_ENABLED 1
-#define APOLLO_TUNER 1
-*/
#define KEYER_STRAIGHT 0
#define KEYER_MODE_A 1
#define KEYER_MODE_B 2
extern double tone_level;
extern int filter_board;
-extern int pa;
+extern int pa_enabled;
+extern int pa_power;
+extern int pa_trim[11];
extern int apollo_tuner;
extern int updates_per_second;
extern void set_filter_type(int filter_type);
extern void set_filter_size(int filter_size);
-#ifdef FREEDV
-extern void set_freedv(int state);
-#endif
-
extern void radio_change_region(int region);
extern void disable_rigctl();
*/
#endif
+static void rx_gain_calibration_value_changed_cb(GtkWidget *widget, gpointer data) {
+ rx_gain_calibration=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
static void vfo_divisor_value_changed_cb(GtkWidget *widget, gpointer data) {
vfo_encoder_divisor=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
col++;
- GtkWidget *region_label=gtk_label_new("Region: ");
+ GtkWidget *region_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(region_label), "<b>Region:</b>");
gtk_grid_attach(GTK_GRID(grid),region_label,col,row,1,1);
col++;
row++;
col=0;
- GtkWidget *receivers_label=gtk_label_new("Receivers: ");
+ GtkWidget *receivers_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(receivers_label), "<b>Receivers:</b>");
+ gtk_label_set_justify(GTK_LABEL(receivers_label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),receivers_label,col,row,1,1);
row++;
- receivers_1=gtk_radio_button_new_with_label(NULL,"1");
+ receivers_1=gtk_radio_button_new_with_label(NULL,"1");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (receivers_1), receivers==1);
gtk_grid_attach(GTK_GRID(grid),receivers_1,col,row,1,1);
g_signal_connect(receivers_1,"toggled",G_CALLBACK(receivers_cb),(gpointer *)1);
row++;
- receivers_2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(receivers_1),"2");
+ receivers_2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(receivers_1),"2");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (receivers_2), receivers==2);
gtk_grid_attach(GTK_GRID(grid),receivers_2,col,row,1,1);
g_signal_connect(receivers_2,"toggled",G_CALLBACK(receivers_cb),(gpointer *)2);
switch(protocol) {
case ORIGINAL_PROTOCOL:
{
- GtkWidget *sample_rate_label=gtk_label_new("Sample Rate:");
+ GtkWidget *sample_rate_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(sample_rate_label), "<b>Sample Rate:</b>");
gtk_grid_attach(GTK_GRID(grid),sample_rate_label,col,row,1,1);
row++;
#ifdef SOAPYSDR
case SOAPYSDR_PROTOCOL:
{
- GtkWidget *sample_rate_label=gtk_label_new("Sample Rate:");
+ GtkWidget *sample_rate_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(sample_rate_label), "<b>Sample Rate:</b>");
gtk_grid_attach(GTK_GRID(grid),sample_rate_label,col,row,1,1);
row++;
row=1;
- GtkWidget *sample_rate_label=gtk_label_new("Filter Board:");
- gtk_grid_attach(GTK_GRID(grid),sample_rate_label,col,row,1,1);
+ GtkWidget *filter_board_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(filter_board_label), "<b>Filter Board:</b>");
+ gtk_grid_attach(GTK_GRID(grid),filter_board_label,col,row,1,1);
row++;
GtkWidget *none_b = gtk_radio_button_new_with_label(NULL, "NONE");
row=1;
- GtkWidget *rit_label=gtk_label_new("R/XIT step (Hz): ");
+ GtkWidget *rit_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rit_label), "<b>RIT/XIT step (Hz):</b>");
gtk_grid_attach(GTK_GRID(grid),rit_label,col,row,1,1);
row++;
col++;
row=1;
- GtkWidget *vfo_divisor_label=gtk_label_new("VFO Encoder Divisor: ");
+ GtkWidget *vfo_divisor_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(vfo_divisor_label), "<b>VFO Encoder Divisor:</b>");
gtk_grid_attach(GTK_GRID(grid),vfo_divisor_label,col,row,1,1);
row++;
#endif
{
row=1;
- GtkWidget *atlas_label=gtk_label_new("Atlas bus: ");
+ GtkWidget *atlas_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(atlas_label), "<b>Atlas bus:</b>");
gtk_grid_attach(GTK_GRID(grid),atlas_label,col,row,1,1);
row++;
col++;
- duplex_b=gtk_check_button_new_with_label("Duplex");
+ duplex_b=gtk_check_button_new_with_label("Duplex");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (duplex_b), duplex);
gtk_grid_attach(GTK_GRID(grid),duplex_b,col,row,1,1);
g_signal_connect(duplex_b,"toggled",G_CALLBACK(duplex_cb),NULL);
g_signal_connect(sat_combo,"changed",G_CALLBACK(sat_cb),NULL);
row++;
+
+ if(have_rx_gain) {
+ col=0;
+ GtkWidget *rx_gain_label=gtk_label_new("RX Gain Calibration:");
+ gtk_label_set_markup(GTK_LABEL(rx_gain_label), "<b>RX Gain Calibration:</b>");
+ gtk_grid_attach(GTK_GRID(grid),rx_gain_label,col,row,1,1);
+ col++;
+
+ GtkWidget *rx_gain_calibration_b=gtk_spin_button_new_with_range(-50.0,50.0,1.0);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(rx_gain_calibration_b),(double)rx_gain_calibration);
+ gtk_grid_attach(GTK_GRID(grid),rx_gain_calibration_b,col,row,1,1);
+ g_signal_connect(rx_gain_calibration_b,"value_changed",G_CALLBACK(rx_gain_calibration_value_changed_cb),NULL);
+
+ row++;
+ }
+
if(row>temp_row) temp_row=row;
#ifdef SOAPYSDR
if(radio->device==SOAPYSDR_USB_DEVICE) {
int i;
if(radio->info.soapy.rx_gains>0) {
- GtkWidget *rx_gain=gtk_label_new("Rx Gains:");
+ GtkWidget *rx_gain=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rx_gain), "<b>RX Gains:</b>");
+ gtk_label_set_justify(GTK_LABEL(rx_gain),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),rx_gain,col,row,1,1);
}
if(can_transmit) {
if(radio->info.soapy.tx_gains>0) {
col=2;
- GtkWidget *tx_gain=gtk_label_new("Tx Gains:");
+ GtkWidget *tx_gain=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tx_gain), "<b>TX Gains:</b>");
gtk_grid_attach(GTK_GRID(grid),tx_gain,col,row,1,1);
}
}
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
-#ifdef FREEDV
-#include "freedv.h"
-#endif
-#include "audio_waterfall.h"
#include "ext.h"
#include "new_menu.h"
#define min(x,y) (x<y?x:y)
#define max(x,y) (x<y?y:x)
-#ifdef PSK
-static int psk_samples=0;
-static int psk_resample=6; // convert from 48000 to 8000
-#endif
-
static gint last_x;
static gboolean has_moved=FALSE;
static gboolean pressed=FALSE;
if(event->button==3) {
g_idle_add(ext_start_rx,NULL);
}
+
+ 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 {
//int display_width=gtk_widget_get_allocated_width (rx->panadapter);
//int display_height=gtk_widget_get_allocated_height (rx->panadapter);
sprintf(value,"%f",rx->squelch);
setProperty(name,value);
-#ifdef FREEDV
- sprintf(name,"receiver.%d.freedv",rx->id);
- sprintf(value,"%d",rx->freedv);
- setProperty(name,value);
-#endif
}
void receiver_restore_state(RECEIVER *rx) {
value=getProperty(name);
if(value) rx->squelch=atof(value);
-#ifdef FREEDV
- sprintf(name,"receiver.%d.freedv",rx->id);
- value=getProperty(name);
- if(value) rx->freedv=atoi(value);
-#endif
}
void reconfigure_receiver(RECEIVER *rx,int height) {
GetPixels(rx->id,0,rx->pixel_samples,&rc);
if(rc) {
if(rx->display_panadapter) {
- switch(vfo[rx->id].mode) {
-#ifdef PSK
- case modePSK:
- psk_waterfall_update(rx);
- break;
-#endif
- default:
- rx_panadapter_update(rx);
- break;
- }
+ rx_panadapter_update(rx);
}
if(rx->display_waterfall) {
waterfall_update(rx);
}
}
-#ifdef AUDIO_SAMPLES
- if(audio_samples!=NULL) {
- GetPixels(CHANNEL_AUDIO,0,audio_samples,&rc);
- if(rc) {
- //audio_waterfall_update();
- }
- }
-#endif
-
-
if(active_receiver==rx) {
double m=GetRXAMeter(rx->id,smeter)+meter_calibration;
meter_update(rx,SMETER,m,0.0,0.0,0.0);
}
void set_mode(RECEIVER *rx,int m) {
-#ifdef PSK
- if(vfo[rx->id].mode!=modePSK && m==modePSK) {
- //init_psk();
- show_psk();
- } else if(vfo[rx->id].mode==modePSK && m!=modePSK) {
- //close_psk();
- show_waterfall();
- }
-#endif
vfo[rx->id].mode=m;
SetRXAMode(rx->id, vfo[rx->id].mode);
}
rx->filter_high=525;
rx->filter_low=275;
-#ifdef FREEDV
- g_mutex_init(&rx->freedv_mutex);
- rx->freedv=0;
- rx->freedv_samples=0;
- strcpy(rx->freedv_text_data,"");
- rx->freedv_text_index=0;
-#endif
rx->deviation=2500;
SetRXAPanelGain1(rx->id, rx->volume);
SetRXAPanelBinaural(rx->id, binaural);
-#ifdef FREEDV
- if(rx->freedv) {
- SetRXAPanelRun(rx->id, 0);
- } else {
-#endif
- SetRXAPanelRun(rx->id, 1);
-#ifdef FREEDV
- }
-#endif
+ SetRXAPanelRun(rx->id, 1);
if(enable_rx_equalizer) {
SetRXAGrphEQ(rx->id, rx_equalizer);
SetDisplayDetectorMode(rx->id, 0, display_detector_mode);
SetDisplayAverageMode(rx->id, 0, display_average_mode);
-#ifdef FREEDV
- if(rx->freedv) {
- init_freedv(rx);
- }
-#endif
-
calculate_display_average(rx);
create_visual(rx);
if(protocol==SOAPYSDR_PROTOCOL) {
rx->resample_step=radio_sample_rate/rx->sample_rate;
g_print("receiver_change_sample_rate: resample_step=%d\n",rx->resample_step);
+ soapy_protocol_set_mic_sample_rate(rx->sample_rate);
}
#endif
//receiver_filter_changed(rx);
}
-#ifdef FREEDV
-static void process_freedv_rx_buffer(RECEIVER *rx) {
- short left_audio_sample;
- short right_audio_sample;
- int i;
- int demod_samples;
- for(i=0;i<rx->output_samples;i++) {
- if(rx->freedv_samples==0) {
- if(isTransmitting()) {
- left_audio_sample=0;
- right_audio_sample=0;
- } else {
- left_audio_sample=(short)(rx->audio_output_buffer[i*2]*32767.0);
- right_audio_sample=(short)(rx->audio_output_buffer[(i*2)+1]*32767.0);
- }
- demod_samples=demod_sample_freedv((left_audio_sample+right_audio_sample)/2);
- if(demod_samples!=0) {
- int s;
- int t;
- for(s=0;s<demod_samples;s++) {
- if(freedv_sync) {
- left_audio_sample=right_audio_sample=(short)((double)speech_out[s]*rx->volume);
- } else {
- left_audio_sample=right_audio_sample=(short)((double)speech_out[s]*rx->volume);
- //left_audio_sample=right_audio_sample=0;
- }
- for(t=0;t<freedv_resample;t++) { // 8k to 48k
-
- if(rx->local_audio) {
- if(rx!=active_receiver && rx->mute_when_not_active) {
- audio_write(rx,0,0);
- } else {
- switch(rx->audio_channel) {
- case STEREO:
- audio_write(rx,left_audio_sample,right_audio_sample);
- break;
- case LEFT:
- audio_write(rx,left_audio_sample,0);
- break;
- case RIGHT:
- audio_write(rx,0,right_audio_sample);
- break;
- }
- }
- }
-
- if(rx==active_receiver) {
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- old_protocol_audio_samples(rx,left_audio_sample,right_audio_sample);
- break;
- case NEW_PROTOCOL:
- new_protocol_audio_samples(rx,left_audio_sample,right_audio_sample);
- break;
-#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- break;
-#endif
- }
- }
- }
- }
- }
- }
- rx->freedv_samples++;
- if(rx->freedv_samples>=freedv_resample) {
- rx->freedv_samples=0;
- }
- }
-}
-#endif
-
static void process_rx_buffer(RECEIVER *rx) {
gdouble left_sample,right_sample;
short left_audio_sample,right_audio_sample;
right_sample=rx->audio_output_buffer[(i*2)+1];
left_audio_sample=(short)(left_sample*32767.0);
right_audio_sample=(short)(right_sample*32767.0);
-#ifdef PSK
- if(vfo[rx->id].mode==modePSK) {
- if(psk_samples==0) {
- psk_demod((double)((left_audio_sample+right_audio_sample)/2));
- }
- psk_samples++;
- if(psk_samples==psk_resample) {
- psk_samples=0;
- }
- }
-#endif
}
if(rx->local_audio) {
Spectrum0(1, rx->id, 0, 0, rx->iq_input_buffer);
}
-#ifdef FREEDV
- g_mutex_lock(&rx->freedv_mutex);
- if(rx->freedv) {
- process_freedv_rx_buffer(rx);
- } else {
-#endif
//g_print("full_rx_buffer: rx=%d buffer_size=%d samples=%d\n",rx->id,rx->buffer_size,rx->samples);
- process_rx_buffer(rx);
-#ifdef FREEDV
- }
- g_mutex_unlock(&rx->freedv_mutex);
-#endif
+ process_rx_buffer(rx);
g_mutex_unlock(&rx->mutex);
}
gdouble *buffer;
gint resample_step;
-#ifdef FREEDV
- GMutex freedv_mutex;
- gint freedv;
- gint freedv_samples;
- gchar freedv_text_data[64];
- gint freedv_text_index;
-#endif
-
gint x;
gint y;
} RECEIVER;
gtk_grid_attach(GTK_GRID(grid),rigctl_enable_b,0,1,1,1);
g_signal_connect(rigctl_enable_b,"toggled",G_CALLBACK(rigctl_enable_cb),NULL);
- GtkWidget *rigctl_port_label =gtk_label_new("RigCtl Port Number");
+ GtkWidget *rigctl_port_label =gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(rigctl_port_label), "<b>RigCtl Port Number</b>");
//gtk_widget_override_font(band_label, pango_font_description_from_string("Arial 18"));
gtk_widget_show(rigctl_port_label);
gtk_grid_attach(GTK_GRID(grid),rigctl_port_label,0,2,1,1);
gtk_grid_attach(GTK_GRID(grid),serial_enable_b,0,3,1,1);
g_signal_connect(serial_enable_b,"toggled",G_CALLBACK(serial_enable_cb),NULL);
- GtkWidget *serial_text_label=gtk_label_new("Serial Port: /dev/ttyUSB");
+ GtkWidget *serial_text_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(serial_text_label), "<b>Serial Port: /dev/ttyUSB</b>");
gtk_grid_attach(GTK_GRID(grid),serial_text_label,0,4,1,1);
GtkWidget *serial_port_spinner =gtk_spin_button_new_with_range(0,7,1);
g_signal_connect(serial_port_spinner,"value_changed",G_CALLBACK(serial_value_changed_cb),NULL);
// Serial baud rate here
- GtkWidget *baud_rate_label =gtk_label_new("Baud Rate:");
+ GtkWidget *baud_rate_label =gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(baud_rate_label), "<b>Baud Rate:</b>");
gtk_widget_show(baud_rate_label);
gtk_grid_attach(GTK_GRID(grid),baud_rate_label,0,5,1,1);
switch(protocol) {
case NEW_PROTOCOL:
{
- GtkWidget *sample_rate_label=gtk_label_new("Sample Rate");
+ GtkWidget *sample_rate_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(sample_rate_label), "<b>Sample Rate</b>");
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");
case SOAPYSDR_PROTOCOL:
{
int row=1;
- GtkWidget *sample_rate_label=gtk_label_new("Sample Rate");
+ GtkWidget *sample_rate_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(sample_rate_label), "<b>Sample Rate</b>");
gtk_grid_attach(GTK_GRID(grid),sample_rate_label,x,row,1,1);
row++;
if (filter_board == ALEX && active_receiver->adc == 0
&& ((protocol==ORIGINAL_PROTOCOL && device != DEVICE_ORION2) || (protocol==NEW_PROTOCOL && device != NEW_DEVICE_ORION2))) {
- GtkWidget *alex_att_label=gtk_label_new("Alex Attenuator");
+ GtkWidget *alex_att_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(alex_att_label), "<b>Alex Attenuator</b>");
gtk_grid_attach(GTK_GRID(grid), alex_att_label, x, 5, 1, 1);
GtkWidget *last_alex_att_b = NULL;
for (i = 0; i <= 3; i++) {
#include "rx_panadapter.h"
#include "vfo.h"
#include "mode.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
#ifdef GPIO
#include "gpio.h"
#endif
int display_width=gtk_widget_get_allocated_width (rx->panadapter);
int display_height=gtk_widget_get_allocated_height (rx->panadapter);
-#ifdef FREEDV
- if(rx->freedv) {
- display_height=display_height-20;
- }
-#endif
samples=rx->pixel_samples;
//clear_panadater_surface();
samples[0]=-200.0;
samples[display_width-1]=-200.0;
- s1=(double)samples[0]+(double)adc_attenuation[rx->adc];
+ if(have_rx_gain) {
+ s1=(double)samples[0]+40.0-(adc_attenuation[rx->adc]+12.0);
+ } else {
+ s1=(double)samples[0]+(double)adc_attenuation[rx->adc];
+ }
if (filter_board == ALEX && rx->adc == 0) s1 += (double)(10*rx->alex_attenuation);
#ifdef SOAPYSDR
if(protocol==SOAPYSDR_PROTOCOL) {
/ (rx->panadapter_high - rx->panadapter_low));
cairo_move_to(cr, 0.0, s1);
for(i=1;i<display_width;i++) {
- s2=(double)samples[i]+(double)adc_attenuation[rx->adc];
+ if(have_rx_gain) {
+ s2=(double)samples[i]+40.0-(adc_attenuation[rx->adc]+12.0);
+ } else {
+ s2=(double)samples[i]+(double)adc_attenuation[rx->adc];
+ }
if (filter_board == ALEX && rx->adc == 0) s2 += (double)(10*rx->alex_attenuation);
#ifdef SOAPYSDR
if(protocol==SOAPYSDR_PROTOCOL) {
cairo_set_line_width(cr, 1.0);
cairo_stroke(cr);
-#ifdef FREEDV
- if(rx->freedv) {
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
- cairo_rectangle(cr,0,display_height,display_width,display_height+20);
- cairo_fill(cr);
-
- cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
- cairo_set_font_size(cr, 18);
- cairo_move_to(cr, 0.0, (double)display_height+20.0-2.0);
- cairo_show_text(cr, rx->freedv_text_data);
- }
-#endif
+#ifdef GPIO
+ if(active && controller==CONTROLLER1) {
+ char text[64];
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) && defined (GPIO)
- if(active) {
cairo_set_source_rgb(cr,1.0,1.0,0.0);
cairo_set_font_size(cr,16);
if(ENABLE_E2_ENCODER) {
- cairo_move_to(cr, display_width-150,30);
- cairo_show_text(cr, encoder_string[e2_encoder_action]);
+ cairo_move_to(cr, display_width-200,30);
+ sprintf(text,"%s (%s)",encoder_string[e2_encoder_action],sw_string[e2_sw_action]);
+ cairo_show_text(cr, text);
}
if(ENABLE_E3_ENCODER) {
- cairo_move_to(cr, display_width-150,50);
- cairo_show_text(cr, encoder_string[e3_encoder_action]);
+ cairo_move_to(cr, display_width-200,50);
+ sprintf(text,"%s (%s)",encoder_string[e3_encoder_action],sw_string[e3_sw_action]);
+ cairo_show_text(cr, text);
}
if(ENABLE_E4_ENCODER) {
- cairo_move_to(cr, display_width-150,70);
- cairo_show_text(cr, encoder_string[e4_encoder_action]);
+ cairo_move_to(cr, display_width-200,70);
+ sprintf(text,"%s (%s)",encoder_string[e4_encoder_action],sw_string[e4_sw_action]);
+ cairo_show_text(cr, text);
}
}
#endif
#include "sliders.h"
#include "mode.h"
#include "filter.h"
-#include "frequency.h"
#include "bandstack.h"
#include "band.h"
#include "discovered.h"
static GtkWidget *sliders;
-#define NONE 0
-#define AF_GAIN 1
-#define RF_GAIN 2
-#define MIC_GAIN 3
-#define LINEIN_GAIN 4
-#define AGC_GAIN 5
-#define DRIVE 6
-#define ATTENUATION 7
-#define SQUELCH 8
-#define COMP 9
-#define FILTER_WIDTH 10
-#define DIVERSITY_GAIN 11
-#define DIVERSITY_PHASE 12
+enum {
+ NO_FUNCTION=0,
+ AF_GAIN,
+ RF_GAIN,
+ MIC_GAIN,
+ LINEIN_GAIN,
+ AGC_GAIN,
+ DRIVE,
+ ATTENUATION,
+ SQUELCH,
+ COMP,
+ FILTER_WIDTH,
+ FILTER_SHIFT,
+ DIVERSITY_GAIN,
+ DIVERSITY_PHASE,
+};
static gint scale_timer;
-static int scale_status=NONE;
+static int scale_status=NO_FUNCTION;
+static int scale_rx=0;
static GtkWidget *scale_dialog;
static GtkWidget *af_gain_label;
static GtkWidget *af_gain_scale;
static GtkWidget *comp_enable;
static GtkWidget *dummy_label;
static GtkWidget *filter_width_scale;
+static GtkWidget *filter_shift_scale;
static GtkWidget *diversity_gain_scale;
static GtkWidget *diversity_phase_scale;
}
char title[64];
if (have_rx_gain) {
- sprintf(title,"RX GAIN"/*,active_receiver->adc*/);
+ sprintf(title,"RX GAIN");
} else {
- sprintf(title,"ATT (dB)"/*,active_receiver->adc*/);
+ sprintf(title,"ATT (dB)");
}
gtk_label_set_text(GTK_LABEL(attenuation_label),title);
sliders_update();
int scale_timeout_cb(gpointer data) {
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
return FALSE;
}
//from 0 - 48 db; the rx-gain slider functions as a gain slider with att = 0;
//att set to 20 for good power measurement.
int rx_gain_slider_value = (int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
- adc_attenuation[active_receiver->adc]= rx_gain_calibration - rx_gain_slider_value;
+ adc_attenuation[active_receiver->adc]= rx_gain_slider_value;
set_attenuation(adc_attenuation[active_receiver->adc]);
} else {
adc_attenuation[active_receiver->adc]=(int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
adc_attenuation[active_receiver->adc]=(int)value;
if(display_sliders) {
if (have_rx_gain) {
- gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)(rx_gain_calibration-adc_attenuation[active_receiver->adc]));
+ gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc_attenuation[active_receiver->adc]);
} else {
gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc_attenuation[active_receiver->adc]);
}
} else {
if(scale_status!=ATTENUATION) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
char title[64];
if (have_rx_gain) {
sprintf(title,"RX GAIN - ADC-%d (dB)",active_receiver->adc);
scale_status=ATTENUATION;
scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
- attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.00);
+ if (have_rx_gain) {
+ attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0, 48.0, 1.00);
+ } else {
+ attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.00);
+ }
gtk_widget_set_size_request (attenuation_scale, 400, 30);
gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc_attenuation[active_receiver->adc]);
gtk_widget_show(attenuation_scale);
if(display_sliders) {
gtk_range_set_value (GTK_RANGE(agc_scale),receiver[rx]->agc_gain);
} else {
- if(scale_status!=AGC_GAIN) {
- if(scale_status!=NONE) {
+ if(scale_status!=AGC_GAIN || scale_rx!=rx) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=AGC_GAIN;
- scale_dialog=gtk_dialog_new_with_buttons("AGC Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ scale_rx=rx;
+ char title[64];
+ sprintf(title,"AGC Gain RX %d",rx);
+ scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
agc_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-20.0, 120.0, 1.00);
gtk_widget_set_size_request (agc_scale, 400, 30);
static void afgain_value_changed_cb(GtkWidget *widget, gpointer data) {
active_receiver->volume=gtk_range_get_value(GTK_RANGE(af_gain_scale))/100.0;
-#ifdef FREEDV
- if(!active_receiver->freedv) {
-#endif
- SetRXAPanelGain1 (active_receiver->id, active_receiver->volume);
-#ifdef FREEDV
- }
-#endif
+ SetRXAPanelGain1 (active_receiver->id, active_receiver->volume);
}
void update_af_gain() {
if(display_sliders) {
gtk_range_set_value (GTK_RANGE(af_gain_scale),receiver[rx]->volume*100.0);
} else {
- if(scale_status!=AF_GAIN) {
- if(scale_status!=NONE) {
+ if(scale_status!=AF_GAIN || scale_rx!=rx) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=AF_GAIN;
- scale_dialog=gtk_dialog_new_with_buttons("AF Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ scale_rx=rx;
+ char title[64];
+ sprintf(title,"AF Gain RX %d",rx);
+ scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
af_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 100.0, 1.00);
gtk_widget_set_size_request (af_gain_scale, 400, 30);
if(display_sliders) {
gtk_range_set_value (GTK_RANGE(rf_gain_scale),receiver[rx]->rf_gain);
} else {
- if(scale_status!=RF_GAIN) {
- if(scale_status!=NONE) {
+ if(scale_status!=RF_GAIN || scale_rx!=rx) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=RF_GAIN;
- scale_dialog=gtk_dialog_new_with_buttons("RF Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ scale_rx=rx;
+ char title[64];
+ sprintf(title,"RF Gain RX %d",rx);
+ scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
rf_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 100.0, 1.00);
gtk_widget_set_size_request (rf_gain_scale, 400, 30);
}
void set_filter_width(int rx,int width) {
- if(scale_status!=FILTER_WIDTH) {
- if(scale_status!=NONE) {
+ if(scale_status!=FILTER_WIDTH || scale_rx!=rx) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=FILTER_WIDTH;
- scale_dialog=gtk_dialog_new_with_buttons("Filter Width (Hz)",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ scale_rx=rx;
+ char title[64];
+ sprintf(title,"Filter Width RX %d (Hz)",rx);
+ scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
filter_width_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 4000.0, 1.00);
gtk_widget_set_size_request (filter_width_scale, 400, 30);
}
}
+void set_filter_shift(int rx,int shift) {
+ if(scale_status!=FILTER_SHIFT || scale_rx!=rx) {
+ if(scale_status!=NO_FUNCTION) {
+ g_source_remove(scale_timer);
+ gtk_widget_destroy(scale_dialog);
+ scale_status=NO_FUNCTION;
+ }
+ }
+ if(scale_status==NO_FUNCTION) {
+ scale_status=FILTER_SHIFT;
+ scale_rx=rx;
+ char title[64];
+ sprintf(title,"Filter SHIFT RX %d (Hz)",rx);
+ scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
+ filter_shift_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-1000.0, 1000.0, 1.00);
+ gtk_widget_set_size_request (filter_shift_scale, 400, 30);
+ gtk_range_set_value (GTK_RANGE(filter_shift_scale),(double)shift);
+ gtk_widget_show(filter_shift_scale);
+ gtk_container_add(GTK_CONTAINER(content),filter_shift_scale);
+ scale_timer=g_timeout_add(2000,scale_timeout_cb,NULL);
+ //gtk_widget_show_all(scale_dialog);
+ gtk_dialog_run(GTK_DIALOG(scale_dialog));
+ } else {
+ g_source_remove(scale_timer);
+ gtk_range_set_value (GTK_RANGE(filter_shift_scale),(double)shift);
+ scale_timer=g_timeout_add(2000,scale_timeout_cb,NULL);
+ }
+}
static void micgain_value_changed_cb(GtkWidget *widget, gpointer data) {
if(mic_linein) {
gtk_range_set_value (GTK_RANGE(mic_gain_scale),mic_gain);
} else {
if(scale_status!=MIC_GAIN) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=MIC_GAIN;
scale_dialog=gtk_dialog_new_with_buttons("Mic Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
gtk_range_set_value (GTK_RANGE(mic_gain_scale),linein_gain);
} else {
if(scale_status!=LINEIN_GAIN) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=LINEIN_GAIN;
scale_dialog=gtk_dialog_new_with_buttons("Linein Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
gtk_range_set_value (GTK_RANGE(drive_scale),value);
} else {
if(scale_status!=DRIVE) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=DRIVE;
scale_dialog=gtk_dialog_new_with_buttons("Drive",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
} else {
#endif
if(scale_status!=SQUELCH) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=SQUELCH;
- scale_dialog=gtk_dialog_new_with_buttons("Squelch",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
+ char title[64];
+ sprintf(title,"Squelch RX %d (Hz)",active_receiver->id);
+ scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
squelch_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 100.0, 1.00);
gtk_widget_override_font(squelch_scale, pango_font_description_from_string("Sans 10"));
} else {
#endif
if(scale_status!=COMP) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=COMP;
scale_dialog=gtk_dialog_new_with_buttons("COMP",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
void show_diversity_gain() {
if(scale_status!=DIVERSITY_GAIN) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=DIVERSITY_GAIN;
scale_dialog=gtk_dialog_new_with_buttons("Diversity Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
void show_diversity_phase() {
if(scale_status!=DIVERSITY_PHASE) {
- if(scale_status!=NONE) {
+ if(scale_status!=NO_FUNCTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NONE;
+ scale_status=NO_FUNCTION;
}
}
- if(scale_status==NONE) {
+ if(scale_status==NO_FUNCTION) {
scale_status=DIVERSITY_PHASE;
scale_dialog=gtk_dialog_new_with_buttons("Diversity Phase",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
af_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 100.0, 1.00);
gtk_widget_override_font(af_gain_scale, pango_font_description_from_string("Sans 10"));
+ gtk_range_set_increments (GTK_RANGE(af_gain_scale),1.0,1.0);
gtk_range_set_value (GTK_RANGE(af_gain_scale),active_receiver->volume*100.0);
gtk_widget_show(af_gain_scale);
gtk_grid_attach(GTK_GRID(sliders),af_gain_scale,1,0,2,1);
agc_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-20.0, 120.0, 1.0);
gtk_widget_override_font(agc_scale, pango_font_description_from_string("Sans 10"));
+ gtk_range_set_increments (GTK_RANGE(agc_scale),1.0,1.0);
gtk_range_set_value (GTK_RANGE(agc_scale),active_receiver->agc_gain);
gtk_widget_show(agc_scale);
gtk_grid_attach(GTK_GRID(sliders),agc_scale,4,0,2,1);
char title[64];
if (have_rx_gain) {
- sprintf(title,"RX-GAIN:"/*,active_receiver->adc*/);
+ sprintf(title,"RX-GAIN:");
} else {
- sprintf(title,"ATT (dB)"/*,active_receiver->adc*/);
+ sprintf(title,"ATT (dB):");
}
attenuation_label=gtk_label_new(title);
gtk_widget_override_font(attenuation_label, pango_font_description_from_string("Sans 10"));
gtk_grid_attach(GTK_GRID(sliders),attenuation_label,6,0,1,1);
if (have_rx_gain) {
- attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 60.0, 1.0);
- gtk_range_set_value (GTK_RANGE(attenuation_scale),rx_gain_calibration-adc_attenuation[active_receiver->adc]);
+ attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0, 48.0, 1.0);
+ gtk_range_set_value (GTK_RANGE(attenuation_scale),adc_attenuation[active_receiver->adc]);
} else {
attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.0);
gtk_range_set_value (GTK_RANGE(attenuation_scale),adc_attenuation[active_receiver->adc]);
}
+ gtk_range_set_increments (GTK_RANGE(attenuation_scale),1.0,1.0);
gtk_widget_override_font(attenuation_scale, pango_font_description_from_string("Sans 10"));
gtk_grid_attach(GTK_GRID(sliders),mic_gain_label,0,1,1,1);
mic_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,mic_linein?0.0:-12.0,mic_linein?31.0:50.0, 1.0);
+ gtk_range_set_increments (GTK_RANGE(mic_gain_scale),1.0,1.0);
gtk_widget_override_font(mic_gain_scale, pango_font_description_from_string("Sans 10"));
gtk_range_set_value (GTK_RANGE(mic_gain_scale),mic_linein?linein_gain:mic_gain);
gtk_grid_attach(GTK_GRID(sliders),mic_gain_scale,1,1,2,1);
drive_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 100.0, 1.0);
gtk_widget_override_font(drive_scale, pango_font_description_from_string("Sans 10"));
+ gtk_range_set_increments (GTK_RANGE(drive_scale),1.0,1.0);
gtk_range_set_value (GTK_RANGE(drive_scale),getDrive());
gtk_widget_show(drive_scale);
gtk_grid_attach(GTK_GRID(sliders),drive_scale,4,1,2,1);
squelch_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 100.0, 1.0);
gtk_widget_override_font(squelch_scale, pango_font_description_from_string("Sans 10"));
+ gtk_range_set_increments (GTK_RANGE(squelch_scale),1.0,1.0);
gtk_range_set_value (GTK_RANGE(squelch_scale),active_receiver->squelch);
gtk_widget_show(squelch_scale);
gtk_grid_attach(GTK_GRID(sliders),squelch_scale,7,1,2,1);
comp_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 20.0, 1.0);
gtk_widget_override_font(comp_scale, pango_font_description_from_string("Sans 10"));
+ gtk_range_set_increments (GTK_RANGE(comp_scale),1.0,1.0);
gtk_range_set_value (GTK_RANGE(comp_scale),transmitter->compressor_level);
gtk_widget_show(comp_scale);
gtk_grid_attach(GTK_GRID(sliders),comp_scale,7,1,2,1);
//extern void set_tune(double tune);
extern void set_attenuation_value(double attenuation);
extern void set_filter_width(int rx,int width);
+extern void set_filter_shift(int rx,int width);
extern GtkWidget *sliders_init(int my_width, int my_height);
extern void sliders_update();
SoapySDRKwargs args={};
fprintf(stderr,"soapy_discovery\n");
+ rtlsdr_count=0;
SoapySDRKwargs *results = SoapySDRDevice_enumerate(NULL, &length);
fprintf(stderr,"soapy_discovery: length=%d\n",length);
for (i = 0; i < length; i++) {
#include "audio.h"
#include "signal.h"
#include "vfo.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
-#ifdef PSK
-#include "psk.h"
-#endif
#include "ext.h"
#include "error_handler.h"
static gboolean running;
+static int mic_samples=0;
static int mic_sample_divisor=1;
-
static int max_tx_samples;
static float *output_buffer;
static int output_buffer_index;
if(rx->sample_rate!=radio_sample_rate) {
soapy_rx_sample_rate=radio_sample_rate;
}
+ mic_sample_divisor=soapy_rx_sample_rate/48000;
-fprintf(stderr,"soapy_protocol_create_receiver: setting samplerate=%f adc=%d\n",(double)soapy_rx_sample_rate,rx->adc);
+fprintf(stderr,"soapy_protocol_create_receiver: setting samplerate=%f adc=%d mic_sample_divisor=%d\n",(double)soapy_rx_sample_rate,rx->adc,mic_sample_divisor);
rc=SoapySDRDevice_setSampleRate(soapy_device,SOAPY_SDR_RX,rx->adc,(double)soapy_rx_sample_rate);
if(rc!=0) {
fprintf(stderr,"soapy_protocol_create_receiver: SoapySDRDevice_setSampleRate(%f) failed: %s\n",(double)soapy_rx_sample_rate,SoapySDR_errToStr(rc));
RECEIVER *rx=(RECEIVER *)arg;
float *buffer=g_new(float,max_samples*2);
void *buffs[]={buffer};
+ float fsample;
running=TRUE;
fprintf(stderr,"soapy_protocol: receive_thread\n");
while(running) {
} else {
add_iq_samples(rx,isample,qsample);
}
+ if(can_transmit) {
+ mic_samples++;
+ if(mic_samples>=mic_sample_divisor) { // reduce to 48000
+ fsample = transmitter->local_microphone ? audio_get_next_mic_sample() : (float)0.0;
+ add_mic_sample(transmitter,fsample);
+ mic_samples=0;
+ }
+ }
}
} else {
for(i=0;i<elements;i++) {
} else {
add_iq_samples(rx,isample,qsample);
}
+ if(can_transmit) {
+ mic_samples++;
+ if(mic_samples>=mic_sample_divisor) { // reduce to 48000
+ fsample = transmitter->local_microphone ? audio_get_next_mic_sample() : (float)0.0;
+ add_mic_sample(transmitter,fsample);
+ mic_samples=0;
+ }
+ }
}
}
}
}
void soapy_protocol_process_local_mic(float sample) {
-#ifdef FREEDV
- if(active_receiver->freedv) {
- add_freedv_mic_sample(transmitter,sample);
- } else {
-#endif
- add_mic_sample(transmitter,sample);
-#ifdef FREEDV
- }
-#endif
+ add_mic_sample(transmitter,sample);
}
void soapy_protocol_iq_samples(float isample,float qsample) {
fprintf(stderr,"audio_open_input: selected=%d:%s\n",n_selected_input_device,selected);
switch(protocol) {
-#ifdef RADIOBERRY
- case RADIOBERRY_PROTOCOL:
- mic_buffer_size = 1024;
- break;
-#endif
case ORIGINAL_PROTOCOL:
mic_buffer_size = 720;
break;
} else {
// process the mic input
switch(protocol) {
-#ifdef RADIOBERRY
- case RADIOBERRY_PROTOCOL:
- radioberry_protocol_iq_samples(mic_buffer,1);
- break;
-#endif
case ORIGINAL_PROTOCOL:
old_protocol_process_local_mic(mic_buffer,1);
break;
*
*/
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
#include <gtk/gtk.h>
#include <stdio.h>
#include <string.h>
int row=0;
int col=0;
char label[64];
+ int i;
dialog=gtk_dialog_new();
gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
row++;
col=0;
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1)
-
- GtkWidget *sw7_title=gtk_label_new("SW7: ");
- gtk_grid_attach(GTK_GRID(grid),sw7_title,col,row,1,1);
- col++;
-
- GtkWidget *sw7_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw7_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw7_combo_box),sw_action[6]);
- g_signal_connect(sw7_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW7));
- gtk_grid_attach(GTK_GRID(grid),sw7_combo_box,col,row,1,1);
- col++;
-
- GtkWidget *sw1_title=gtk_label_new("SW1: ");
- gtk_grid_attach(GTK_GRID(grid),sw1_title,col,row,1,1);
- col++;
-
- GtkWidget *sw1_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw1_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw1_combo_box),sw_action[0]);
- g_signal_connect(sw1_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW1));
- gtk_grid_attach(GTK_GRID(grid),sw1_combo_box,col,row,1,1);
- row++;
- col=0;
-
- GtkWidget *sw2_title=gtk_label_new("SW2: ");
- gtk_grid_attach(GTK_GRID(grid),sw2_title,col,row,1,1);
- col++;
-
- GtkWidget *sw2_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw2_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw2_combo_box),sw_action[1]);
- g_signal_connect(sw2_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW2));
- gtk_grid_attach(GTK_GRID(grid),sw2_combo_box,col,row,1,1);
- col++;
-
- GtkWidget *sw3_title=gtk_label_new("SW3: ");
- gtk_grid_attach(GTK_GRID(grid),sw3_title,col,row,1,1);
- col++;
-
- GtkWidget *sw3_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw3_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw3_combo_box),sw_action[2]);
- g_signal_connect(sw3_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW3));
- gtk_grid_attach(GTK_GRID(grid),sw3_combo_box,col,row,1,1);
- row++;
- col=0;
-
- GtkWidget *sw4_title=gtk_label_new("SW4: ");
- gtk_grid_attach(GTK_GRID(grid),sw4_title,col,row,1,1);
- col++;
-
- GtkWidget *sw4_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw4_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw4_combo_box),sw_action[3]);
- g_signal_connect(sw4_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW4));
- gtk_grid_attach(GTK_GRID(grid),sw4_combo_box,col,row,1,1);
- col++;
-
- GtkWidget *sw5_title=gtk_label_new("SW5: ");
- gtk_grid_attach(GTK_GRID(grid),sw5_title,col,row,1,1);
- col++;
-
- GtkWidget *sw5_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw5_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw5_combo_box),sw_action[4]);
- g_signal_connect(sw5_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW5));
- gtk_grid_attach(GTK_GRID(grid),sw5_combo_box,col,row,1,1);
- row++;
- col=0;
-
- GtkWidget *sw6_title=gtk_label_new("SW6: ");
- gtk_grid_attach(GTK_GRID(grid),sw6_title,col,row,1,1);
- col++;
-
- GtkWidget *sw6_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw6_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw6_combo_box),sw_action[5]);
- g_signal_connect(sw6_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW6));
- gtk_grid_attach(GTK_GRID(grid),sw6_combo_box,col,row,1,1);
- col++;
-
- GtkWidget *sw8_title=gtk_label_new("SW8: ");
- gtk_grid_attach(GTK_GRID(grid),sw8_title,col,row,1,1);
- col++;
-
- GtkWidget *sw8_combo_box=gtk_combo_box_text_new();
- for(i=0;i<SWITCH_ACTIONS;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw8_combo_box),NULL,sw_string[i]);
- }
- gtk_combo_box_set_active(GTK_COMBO_BOX(sw8_combo_box),sw_action[7]);
- g_signal_connect(sw8_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(SW8));
- gtk_grid_attach(GTK_GRID(grid),sw8_combo_box,col,row,1,1);
- col++;
-
-#else
-
- col=8;
-
- GtkWidget *sw13=gtk_button_new_with_label(sw_string[sw_action[SW13]]);
- GtkWidget *sw13_label=gtk_bin_get_child(GTK_BIN(sw13));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW13]]);
- gtk_label_set_markup (GTK_LABEL(sw13_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw13,col,row,1,1);
- g_signal_connect (sw13, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW13));
- row++;
- col=7;
-
- GtkWidget *sw12=gtk_button_new_with_label(sw_string[sw_action[SW12]]);
- GtkWidget *sw12_label=gtk_bin_get_child(GTK_BIN(sw12));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW12]]);
- gtk_label_set_markup (GTK_LABEL(sw12_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw12,col,row,1,1);
- g_signal_connect (sw12, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW12));
- col++;
-
- GtkWidget *sw11=gtk_button_new_with_label(sw_string[sw_action[SW11]]);
- GtkWidget *sw11_label=gtk_bin_get_child(GTK_BIN(sw11));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW11]]);
- gtk_label_set_markup (GTK_LABEL(sw11_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw11,col,row,1,1);
- g_signal_connect (sw11, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW11));
- row++;
- col=7;
-
- GtkWidget *sw10=gtk_button_new_with_label(sw_string[sw_action[SW10]]);
- GtkWidget *sw10_label=gtk_bin_get_child(GTK_BIN(sw10));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW10]]);
- gtk_label_set_markup (GTK_LABEL(sw10_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw10,col,row,1,1);
- g_signal_connect (sw10, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW10));
- col++;
-
- GtkWidget *sw9=gtk_button_new_with_label(sw_string[sw_action[SW9]]);
- GtkWidget *sw9_label=gtk_bin_get_child(GTK_BIN(sw9));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW9]]);
- gtk_label_set_markup (GTK_LABEL(sw9_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw9,col,row,1,1);
- g_signal_connect (sw9, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW9));
- row++;
- col=7;
-
- GtkWidget *sw7=gtk_button_new_with_label(sw_string[sw_action[SW7]]);
- GtkWidget *sw7_label=gtk_bin_get_child(GTK_BIN(sw7));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW7]]);
- gtk_label_set_markup (GTK_LABEL(sw7_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw7,col,row,1,1);
- g_signal_connect (sw7, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW7));
- col++;
-
- GtkWidget *sw8=gtk_button_new_with_label(sw_string[sw_action[SW8]]);
- GtkWidget *sw8_label=gtk_bin_get_child(GTK_BIN(sw8));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW8]]);
- gtk_label_set_markup (GTK_LABEL(sw8_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw8,col,row,1,1);
- g_signal_connect (sw8, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW8));
- row++;
- col=7;
-
- GtkWidget *sw16=gtk_button_new_with_label(sw_string[sw_action[SW16]]);
- GtkWidget *sw16_label=gtk_bin_get_child(GTK_BIN(sw16));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW16]]);
- gtk_label_set_markup (GTK_LABEL(sw16_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw16,col,row,1,1);
- g_signal_connect (sw16, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW16));
- col++;
-
- GtkWidget *sw17=gtk_button_new_with_label(sw_string[sw_action[SW17]]);
- GtkWidget *sw17_label=gtk_bin_get_child(GTK_BIN(sw17));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW17]]);
- gtk_label_set_markup (GTK_LABEL(sw17_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw17,col,row,1,1);
- g_signal_connect (sw17, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW17));
- row++;
- col=0;
-
- GtkWidget *sw2=gtk_button_new_with_label(sw_string[sw_action[SW2]]);
- GtkWidget *sw2_label=gtk_bin_get_child(GTK_BIN(sw2));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW2]]);
- gtk_label_set_markup (GTK_LABEL(sw2_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw2,col,row,1,1);
- g_signal_connect (sw2, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW2));
- col++;
+ switch(controller) {
+ default:
+ {
+ GtkWidget *sw7_title=gtk_label_new("SW7: ");
+ gtk_grid_attach(GTK_GRID(grid),sw7_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw7_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw7_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw7_combo_box),sw_action[6]);
+ g_signal_connect(sw7_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW7));
+ gtk_grid_attach(GTK_GRID(grid),sw7_combo_box,col,row,1,1);
+ col++;
+
+ GtkWidget *sw1_title=gtk_label_new("SW1: ");
+ gtk_grid_attach(GTK_GRID(grid),sw1_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw1_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw1_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw1_combo_box),sw_action[0]);
+ g_signal_connect(sw1_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW1));
+ gtk_grid_attach(GTK_GRID(grid),sw1_combo_box,col,row,1,1);
+ row++;
+ col=0;
+
+ GtkWidget *sw2_title=gtk_label_new("SW2: ");
+ gtk_grid_attach(GTK_GRID(grid),sw2_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw2_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw2_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw2_combo_box),sw_action[1]);
+ g_signal_connect(sw2_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW2));
+ gtk_grid_attach(GTK_GRID(grid),sw2_combo_box,col,row,1,1);
+ col++;
+
+ GtkWidget *sw3_title=gtk_label_new("SW3: ");
+ gtk_grid_attach(GTK_GRID(grid),sw3_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw3_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw3_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw3_combo_box),sw_action[2]);
+ g_signal_connect(sw3_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW3));
+ gtk_grid_attach(GTK_GRID(grid),sw3_combo_box,col,row,1,1);
+ row++;
+ col=0;
+
+ GtkWidget *sw4_title=gtk_label_new("SW4: ");
+ gtk_grid_attach(GTK_GRID(grid),sw4_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw4_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw4_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw4_combo_box),sw_action[3]);
+ g_signal_connect(sw4_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW4));
+ gtk_grid_attach(GTK_GRID(grid),sw4_combo_box,col,row,1,1);
+ col++;
+
+ GtkWidget *sw5_title=gtk_label_new("SW5: ");
+ gtk_grid_attach(GTK_GRID(grid),sw5_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw5_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw5_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw5_combo_box),sw_action[4]);
+ g_signal_connect(sw5_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW5));
+ gtk_grid_attach(GTK_GRID(grid),sw5_combo_box,col,row,1,1);
+ row++;
+ col=0;
+
+ GtkWidget *sw6_title=gtk_label_new("SW6: ");
+ gtk_grid_attach(GTK_GRID(grid),sw6_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw6_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw6_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw6_combo_box),sw_action[5]);
+ g_signal_connect(sw6_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW6));
+ gtk_grid_attach(GTK_GRID(grid),sw6_combo_box,col,row,1,1);
+ col++;
+
+ GtkWidget *sw8_title=gtk_label_new("SW8: ");
+ gtk_grid_attach(GTK_GRID(grid),sw8_title,col,row,1,1);
+ col++;
+
+ GtkWidget *sw8_combo_box=gtk_combo_box_text_new();
+ for(i=0;i<SWITCH_ACTIONS;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sw8_combo_box),NULL,sw_string[i]);
+ }
+ gtk_combo_box_set_active(GTK_COMBO_BOX(sw8_combo_box),sw_action[7]);
+ g_signal_connect(sw8_combo_box,"changed",G_CALLBACK(sw_cb),GINT_TO_POINTER(CONTROLLER1_SW8));
+ gtk_grid_attach(GTK_GRID(grid),sw8_combo_box,col,row,1,1);
+ col++;
+ }
+ break;
+
+ case CONTROLLER2_V1:
+ case CONTROLLER2_V2:
+ {
+ col=8;
+
+ GtkWidget *sw13=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW13]]);
+ GtkWidget *sw13_label=gtk_bin_get_child(GTK_BIN(sw13));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW13]]);
+ gtk_label_set_markup (GTK_LABEL(sw13_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw13,col,row,1,1);
+ g_signal_connect (sw13, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW13));
+ row++;
+ col=7;
+
+ GtkWidget *sw12=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW12]]);
+ GtkWidget *sw12_label=gtk_bin_get_child(GTK_BIN(sw12));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW12]]);
+ gtk_label_set_markup (GTK_LABEL(sw12_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw12,col,row,1,1);
+ g_signal_connect (sw12, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW12));
+ col++;
+
+ GtkWidget *sw11=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW11]]);
+ GtkWidget *sw11_label=gtk_bin_get_child(GTK_BIN(sw11));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW11]]);
+ gtk_label_set_markup (GTK_LABEL(sw11_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw11,col,row,1,1);
+ g_signal_connect (sw11, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW11));
+ row++;
+ col=7;
+
+ GtkWidget *sw10=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW10]]);
+ GtkWidget *sw10_label=gtk_bin_get_child(GTK_BIN(sw10));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW10]]);
+ gtk_label_set_markup (GTK_LABEL(sw10_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw10,col,row,1,1);
+ g_signal_connect (sw10, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW10));
+ col++;
+
+ GtkWidget *sw9=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW9]]);
+ GtkWidget *sw9_label=gtk_bin_get_child(GTK_BIN(sw9));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW9]]);
+ gtk_label_set_markup (GTK_LABEL(sw9_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw9,col,row,1,1);
+ g_signal_connect (sw9, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW9));
+ row++;
+ col=7;
+
+ GtkWidget *sw7=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW7]]);
+ GtkWidget *sw7_label=gtk_bin_get_child(GTK_BIN(sw7));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW7]]);
+ gtk_label_set_markup (GTK_LABEL(sw7_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw7,col,row,1,1);
+ g_signal_connect (sw7, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW7));
+ col++;
+
+ GtkWidget *sw8=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW8]]);
+ GtkWidget *sw8_label=gtk_bin_get_child(GTK_BIN(sw8));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW8]]);
+ gtk_label_set_markup (GTK_LABEL(sw8_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw8,col,row,1,1);
+ g_signal_connect (sw8, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW8));
+ row++;
+ col=7;
+
+ GtkWidget *sw16=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW16]]);
+ GtkWidget *sw16_label=gtk_bin_get_child(GTK_BIN(sw16));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW16]]);
+ gtk_label_set_markup (GTK_LABEL(sw16_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw16,col,row,1,1);
+ g_signal_connect (sw16, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW16));
+ col++;
+
+ GtkWidget *sw17=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW17]]);
+ GtkWidget *sw17_label=gtk_bin_get_child(GTK_BIN(sw17));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW17]]);
+ gtk_label_set_markup (GTK_LABEL(sw17_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw17,col,row,1,1);
+ g_signal_connect (sw17, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW17));
+ row++;
+ col=0;
+
+ GtkWidget *sw2=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW2]]);
+ GtkWidget *sw2_label=gtk_bin_get_child(GTK_BIN(sw2));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW2]]);
+ gtk_label_set_markup (GTK_LABEL(sw2_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw2,col,row,1,1);
+ g_signal_connect (sw2, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW2));
+ col++;
- GtkWidget *sw3=gtk_button_new_with_label(sw_string[sw_action[SW3]]);
- GtkWidget *sw3_label=gtk_bin_get_child(GTK_BIN(sw3));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW3]]);
- gtk_label_set_markup (GTK_LABEL(sw3_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw3,col,row,1,1);
- g_signal_connect (sw3, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW3));
- col++;
+ GtkWidget *sw3=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW3]]);
+ GtkWidget *sw3_label=gtk_bin_get_child(GTK_BIN(sw3));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW3]]);
+ gtk_label_set_markup (GTK_LABEL(sw3_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw3,col,row,1,1);
+ g_signal_connect (sw3, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW3));
+ col++;
- GtkWidget *sw4=gtk_button_new_with_label(sw_string[sw_action[SW4]]);
- GtkWidget *sw4_label=gtk_bin_get_child(GTK_BIN(sw4));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW4]]);
- gtk_label_set_markup (GTK_LABEL(sw4_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw4,col,row,1,1);
- g_signal_connect (sw4, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW4));
- col++;
+ GtkWidget *sw4=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW4]]);
+ GtkWidget *sw4_label=gtk_bin_get_child(GTK_BIN(sw4));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW4]]);
+ gtk_label_set_markup (GTK_LABEL(sw4_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw4,col,row,1,1);
+ g_signal_connect (sw4, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW4));
+ col++;
- GtkWidget *sw5=gtk_button_new_with_label(sw_string[sw_action[SW5]]);
- GtkWidget *sw5_label=gtk_bin_get_child(GTK_BIN(sw5));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW5]]);
- gtk_label_set_markup (GTK_LABEL(sw5_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw5,col,row,1,1);
- g_signal_connect (sw5, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW5));
- col++;
+ GtkWidget *sw5=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW5]]);
+ GtkWidget *sw5_label=gtk_bin_get_child(GTK_BIN(sw5));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW5]]);
+ gtk_label_set_markup (GTK_LABEL(sw5_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw5,col,row,1,1);
+ g_signal_connect (sw5, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW5));
+ col++;
- GtkWidget *sw6=gtk_button_new_with_label(sw_string[sw_action[SW6]]);
- GtkWidget *sw6_label=gtk_bin_get_child(GTK_BIN(sw6));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW6]]);
- gtk_label_set_markup (GTK_LABEL(sw6_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw6,col,row,1,1);
- g_signal_connect (sw6, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW6));
- col++;
+ GtkWidget *sw6=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW6]]);
+ GtkWidget *sw6_label=gtk_bin_get_child(GTK_BIN(sw6));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW6]]);
+ gtk_label_set_markup (GTK_LABEL(sw6_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw6,col,row,1,1);
+ g_signal_connect (sw6, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW6));
+ col++;
- GtkWidget *sw14=gtk_button_new_with_label(sw_string[sw_action[SW14]]);
- GtkWidget *sw14_label=gtk_bin_get_child(GTK_BIN(sw14));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW14]]);
- gtk_label_set_markup (GTK_LABEL(sw14_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw14,col,row,1,1);
- g_signal_connect (sw14, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW14));
- col++;
+ GtkWidget *sw14=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW14]]);
+ GtkWidget *sw14_label=gtk_bin_get_child(GTK_BIN(sw14));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW14]]);
+ gtk_label_set_markup (GTK_LABEL(sw14_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw14,col,row,1,1);
+ g_signal_connect (sw14, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW14));
+ col++;
- GtkWidget *sw15=gtk_button_new_with_label(sw_string[sw_action[SW15]]);
- GtkWidget *sw15_label=gtk_bin_get_child(GTK_BIN(sw15));
- sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[SW15]]);
- gtk_label_set_markup (GTK_LABEL(sw15_label), label);
- gtk_grid_attach(GTK_GRID(grid),sw15,col,row,1,1);
- g_signal_connect (sw15, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(SW15));
- col++;
-
-
-
-#endif
+ GtkWidget *sw15=gtk_button_new_with_label(sw_string[sw_action[CONTROLLER2_SW15]]);
+ GtkWidget *sw15_label=gtk_bin_get_child(GTK_BIN(sw15));
+ sprintf(label,"<span size=\"smaller\">%s</span>",sw_string[sw_action[CONTROLLER2_SW15]]);
+ gtk_label_set_markup (GTK_LABEL(sw15_label), label);
+ gtk_grid_attach(GTK_GRID(grid),sw15,col,row,1,1);
+ g_signal_connect (sw15, "button_press_event", G_CALLBACK(sw_cb), GINT_TO_POINTER(CONTROLLER2_SW15));
+ col++;
+ }
+ break;
+ }
gtk_container_add(GTK_CONTAINER(content),grid);
gtk_widget_show_all(dialog);
}
-#endif
#include "toolbar.h"
#include "mode.h"
#include "filter.h"
-#include "frequency.h"
#include "bandstack.h"
#include "band.h"
#include "discovered.h"
}
static void split_cb (GtkWidget *widget, gpointer data) {
- g_idle_add(ext_split_toggle, NULL);
+ g_idle_add(ext_split_toggle,NULL);
}
static void duplex_cb (GtkWidget *widget, gpointer data) {
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
-#ifdef FREEDV
-#include "freedv.h"
-#endif
-#include "audio_waterfall.h"
#include "audio.h"
#include "ext.h"
sprintf(name,"transmitter.%d.am_carrier_level",tx->id);
sprintf(value,"%f",tx->am_carrier_level);
setProperty(name,value);
-#ifdef FREEDV
- if(strlen(tx->freedv_text_data)>0) {
- sprintf(name,"transmitter.%d.freedv_text_data",tx->id);
- sprintf(value,"%s",tx->freedv_text_data);
- setProperty(name,value);
- }
-#endif
sprintf(name,"transmitter.%d.drive",tx->id);
sprintf(value,"%d",tx->drive);
setProperty(name,value);
sprintf(name,"transmitter.%d.am_carrier_level",tx->id);
value=getProperty(name);
if(value) tx->am_carrier_level=atof(value);
-#ifdef FREEDV
- sprintf(name,"transmitter.%d.freedv_text_data",tx->id);
- value=getProperty(name);
- if(value) strcpy(tx->freedv_text_data,value);
-#endif
sprintf(name,"transmitter.%d.drive",tx->id);
value=getProperty(name);
if(value) tx->drive=atoi(value);
if(value) tx->xit=atoll(value);
}
+static double compute_power(double p) {
+ double interval=10.0;
+ switch(pa_power) {
+ case PA_1W:
+ interval=100.0; // mW
+ break;
+ case PA_10W:
+ interval=1.0; // W
+ break;
+ case PA_30W:
+ interval=3.0; // W
+ break;
+ case PA_50W:
+ interval=5.0; // W
+ break;
+ case PA_100W:
+ interval=10.0; // W
+ break;
+ case PA_200W:
+ interval=20.0; // W
+ break;
+ case PA_500W:
+ interval=50.0; // W
+ break;
+ }
+ int i=0;
+ if(p>(double)pa_trim[10]) {
+ i=9;
+ } else {
+ while(p>(double)pa_trim[i]) {
+ i++;
+ }
+ if(i>0) i--;
+ }
+
+ double frac = (p - (double)pa_trim[i]) / ((double)pa_trim[i + 1] - (double)pa_trim[i]);
+ return interval * ((1.0 - frac) * (double)i + frac * (double)(i + 1));
+}
+
static gboolean update_display(gpointer data) {
TRANSMITTER *tx=(TRANSMITTER *)data;
int rc;
//fprintf(stderr,"update_display: tx id=%d\n",tx->id);
if(tx->displaying) {
-#ifdef AUDIO_SAMPLES
- if(audio_samples!=NULL) {
- GetPixels(CHANNEL_AUDIO,0,audio_samples,&rc);
- if(rc) {
- audio_waterfall_update();
- }
- }
-#endif
// if "MON" button is active (tx->feedback is TRUE),
// then obtain spectrum pixels from PS_RX_FEEDBACK,
// that is, display the (attenuated) TX signal from the "antenna"
transmitter->alc=GetTXAMeter(tx->id, alc);
double constant1=3.3;
double constant2=0.095;
+ int fwd_cal_offset=6;
- int power;
+ int fwd_power;
+ int rev_power;
+ int ex_power;
double v1;
+ fwd_power=alex_forward_power;
+ rev_power=alex_reverse_power;
+ if(device==DEVICE_HERMES_LITE || device==DEVICE_HERMES_LITE2) {
+ ex_power=0;
+ } else {
+ ex_power=exciter_power;
+ }
switch(protocol) {
case ORIGINAL_PROTOCOL:
switch(device) {
case DEVICE_ORION:
constant1=5.0;
constant2=0.108;
+ fwd_cal_offset=4;
break;
case DEVICE_ORION2:
constant1=5.0;
- constant2=0.108;
+ constant2=0.08;
+ fwd_cal_offset=18;
break;
case DEVICE_HERMES_LITE:
case DEVICE_HERMES_LITE2:
+ // possible reversed depending polarity of current sense transformer
+ if(rev_power>fwd_power) {
+ fwd_power=alex_reverse_power;
+ rev_power=alex_forward_power;
+ }
+ constant1=3.3;
+ constant2=1.4;
+ fwd_cal_offset=6;
break;
}
- power=alex_forward_power;
- if(power==0) {
- power=exciter_power;
+ if(fwd_power==0) {
+ fwd_power=ex_power;
}
- v1=((double)power/4095.0)*constant1;
+ fwd_power=fwd_power-fwd_cal_offset;
+ v1=((double)fwd_power/4095.0)*constant1;
transmitter->fwd=(v1*v1)/constant2;
- power=exciter_power;
- v1=((double)power/4095.0)*constant1;
- transmitter->exciter=(v1*v1)/constant2;
+ if(device==DEVICE_HERMES_LITE || device==DEVICE_HERMES_LITE2) {
+ transmitter->exciter=0.0;
+ } else {
+ ex_power=ex_power-fwd_cal_offset;
+ v1=((double)ex_power/4095.0)*constant1;
+ transmitter->exciter=(v1*v1)/constant2;
+ }
transmitter->rev=0.0;
- if(alex_forward_power!=0) {
- power=alex_reverse_power;
- v1=((double)power/4095.0)*constant1;
+ if(fwd_power!=0) {
+ v1=((double)rev_power/4095.0)*constant1;
transmitter->rev=(v1*v1)/constant2;
}
break;
case NEW_DEVICE_ORION:
constant1=5.0;
constant2=0.108;
+ fwd_cal_offset=4;
break;
case NEW_DEVICE_ORION2:
constant1=5.0;
- constant2=0.108;
+ constant2=0.08;
+ fwd_cal_offset=18;
break;
case NEW_DEVICE_HERMES_LITE:
case NEW_DEVICE_HERMES_LITE2:
break;
}
- power=alex_forward_power;
- if(power==0) {
- power=exciter_power;
+ fwd_power=alex_forward_power;
+ if(fwd_power==0) {
+ fwd_power=exciter_power;
}
- v1=((double)power/4095.0)*constant1;
+ fwd_power=fwd_power-fwd_cal_offset;
+ v1=((double)fwd_power/4095.0)*constant1;
transmitter->fwd=(v1*v1)/constant2;
- power=exciter_power;
- v1=((double)power/4095.0)*constant1;
+ ex_power=exciter_power;
+ ex_power=ex_power-fwd_cal_offset;
+ v1=((double)ex_power/4095.0)*constant1;
transmitter->exciter=(v1*v1)/constant2;
transmitter->rev=0.0;
if(alex_forward_power!=0) {
- power=alex_reverse_power;
- v1=((double)power/4095.0)*constant1;
+ rev_power=alex_reverse_power;
+ v1=((double)rev_power/4095.0)*constant1;
transmitter->rev=(v1*v1)/constant2;
}
break;
#endif
}
+ double fwd=compute_power(transmitter->fwd);
+
+//g_print("transmitter: meter_update: fwd:%f->%f rev:%f ex_fwd=%d alex_fwd=%d alex_rev=%d\n",transmitter->fwd,fwd,transmitter->rev,exciter_power,alex_forward_power,alex_reverse_power);
+
if(!duplex) {
- meter_update(active_receiver,POWER,transmitter->fwd,transmitter->rev,transmitter->exciter,transmitter->alc);
+ meter_update(active_receiver,POWER,/*transmitter->*/fwd,transmitter->rev,transmitter->exciter,transmitter->alc);
}
return TRUE; // keep going
SetDisplayDetectorMode(tx->id, 0, DETECTOR_MODE_PEAK);
SetDisplayAverageMode(tx->id, 0, AVERAGE_MODE_NONE);
-
}
void create_dialog(TRANSMITTER *tx) {
tx->panadapter_high=0;
tx->panadapter_low=-60;
+ tx->panadapter_step=10;
tx->displaying=0;
tx->deviation=2500;
tx->am_carrier_level=0.5;
-#ifdef FREEDV
- strcpy(tx->freedv_text_data,"Call, Name and Location");
- tx->freedv_samples=0;
-#endif
-
tx->drive=50;
tx->tune_percent=10;
tx->tune_use_drive=0;
#endif
}
-#ifdef FREEDV
-void add_freedv_mic_sample(TRANSMITTER *tx, float mic_sample) {
- int i,s;
-
- //if(active_receiver->freedv && isTransmitting() && !tune) {
- if(!tune) {
- if(tx->freedv_samples==0) {
- //int modem_samples=mod_sample_freedv(mic_sample);
- short vs=(short)((double)mic_sample*pow(10.0, mic_gain / 20.0));
- int modem_samples=mod_sample_freedv(vs);
- if(modem_samples!=0) {
- for(s=0;s<modem_samples;s++) {
- for(i=0;i<freedv_resample;i++) { // 8K to 48K
- add_mic_sample(tx,mod_out[s]);
- }
- }
- }
- }
- tx->freedv_samples++;
- if(tx->freedv_samples>=freedv_resample) {
- tx->freedv_samples=0;
- }
- }
-}
-#endif
-
void tx_set_displaying(TRANSMITTER *tx,int state) {
tx->displaying=state;
if(state) {
int panadapter_low;
int panadapter_high;
+ int panadapter_step;
cairo_surface_t *panadapter_surface;
int drive_level;
-#ifdef FREEDV
- char freedv_text_data[64];
- int freedv_text_index;
- int freedv_samples;
-#endif
-
int compressor;
double compressor_level;
transmitter->panadapter_low=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
+static void panadapter_step_value_changed_cb(GtkWidget *widget, gpointer data) {
+ transmitter->panadapter_step=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+}
+
static void am_carrier_level_value_changed_cb(GtkWidget *widget, gpointer data) {
transmitter->am_carrier_level=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
transmitter_set_am_carrier_level(transmitter);
row++;
col=0;
- if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
- micin_b=gtk_radio_button_new_with_label_from_widget(NULL,"Mic In");
+ if(n_input_devices>0) {
+ GtkWidget *local_microphone_b=gtk_check_button_new_with_label("Local Microphone");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (local_microphone_b), transmitter->local_microphone);
+ gtk_widget_show(local_microphone_b);
+ gtk_grid_attach(GTK_GRID(grid),local_microphone_b,col,row,1,1);
+ g_signal_connect(local_microphone_b,"toggled",G_CALLBACK(local_microphone_cb),NULL);
+ col++;
+
+ input=gtk_combo_box_text_new();
+ for(i=0;i<n_input_devices;i++) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(input),NULL,input_devices[i].name);
+ if(transmitter->microphone_name!=NULL) {
+ if(strcmp(transmitter->microphone_name,input_devices[i].name)==0) {
+ gtk_combo_box_set_active(GTK_COMBO_BOX(input),i);
+ }
+ }
+ }
+
+ // If the combo box shows no device, take the first one
+ i=gtk_combo_box_get_active(GTK_COMBO_BOX(input));
+ if (i < 0) {
+ gtk_combo_box_set_active(GTK_COMBO_BOX(input),0);
+ }
+
+ gtk_grid_attach(GTK_GRID(grid),input,col,row,3,1);
+ g_signal_connect(input,"changed",G_CALLBACK(local_input_changed_cb),NULL);
+ }
+
+ row++;
+ col=0;
+
+ gboolean device_has_microphone_input=FALSE;
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch(device) {
+ case DEVICE_METIS:
+ case DEVICE_HERMES:
+ case DEVICE_GRIFFIN:
+ case DEVICE_ANGELIA:
+ case DEVICE_ORION:
+ case DEVICE_ORION2:
+ device_has_microphone_input=TRUE;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch(device) {
+ case NEW_DEVICE_ATLAS:
+ case NEW_DEVICE_HERMES:
+ case NEW_DEVICE_HERMES2:
+ case NEW_DEVICE_ANGELIA:
+ case NEW_DEVICE_ORION:
+ case NEW_DEVICE_ORION2:
+ device_has_microphone_input=TRUE;
+ break;
+ }
+ break;
+ }
+
+ if(device_has_microphone_input) {
+ micboost_b=gtk_check_button_new_with_label("Radio Mic Boost");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (micboost_b), mic_boost);
+ gtk_grid_attach(GTK_GRID(grid),micboost_b,col,row,1,1);
+ g_signal_connect(micboost_b,"toggled",G_CALLBACK(micboost_cb),NULL);
+
+ col++;
+
+ micin_b=gtk_radio_button_new_with_label_from_widget(NULL,"Radio Mic In");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (micin_b), mic_linein==0);
gtk_widget_show(micin_b);
gtk_grid_attach(GTK_GRID(grid),micin_b,col,row,1,1);
col++;
- linein_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(micin_b),"Line In");
+ linein_b=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(micin_b),"Radio Line In");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (linein_b), mic_linein==1);
gtk_widget_show(linein_b);
gtk_grid_attach(GTK_GRID(grid),linein_b,col,row,1,1);
row++;
col=0;
- micboost_b=gtk_check_button_new_with_label("Mic Boost (radio only)");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (micboost_b), mic_boost);
- gtk_grid_attach(GTK_GRID(grid),micboost_b,col,row,2,1);
- g_signal_connect(micboost_b,"toggled",G_CALLBACK(micboost_cb),NULL);
-
- row++;
- col=0;
-
}
gtk_grid_attach(GTK_GRID(grid),comp,col,row,1,1);
g_signal_connect(comp,"value-changed",G_CALLBACK(comp_cb),NULL);
+
row++;
col=0;
- GtkWidget *label=gtk_label_new("TX Filter: ");
-#ifdef GTK316
- gtk_label_set_xalign(GTK_LABEL(label),0);
-#endif
- gtk_grid_attach(GTK_GRID(grid),label,col,row,1,1);
-
- col++;
- GtkWidget *use_rx_filter_b=gtk_check_button_new_with_label("Use RX filter");
+ GtkWidget *use_rx_filter_b=gtk_check_button_new_with_label("Use RX Filter");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_rx_filter_b), transmitter->use_rx_filter);
gtk_widget_show(use_rx_filter_b);
gtk_grid_attach(GTK_GRID(grid),use_rx_filter_b,col,row,1,1);
col++;
+ GtkWidget *label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>TX Filter: </b>");
+#ifdef GTK316
+ gtk_label_set_xalign(GTK_LABEL(label),0);
+#endif
+ gtk_grid_attach(GTK_GRID(grid),label,col,row,1,1);
+
+ col++;
tx_spin_low=gtk_spin_button_new_with_range(0.0,8000.0,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(tx_spin_low),(double)tx_filter_low);
gtk_grid_attach(GTK_GRID(grid),tx_spin_low,col,row,1,1);
int saved_row=row;
- if(n_input_devices>0) {
- GtkWidget *local_microphone_b=gtk_check_button_new_with_label("Local Microphone Input");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (local_microphone_b), transmitter->local_microphone);
- gtk_widget_show(local_microphone_b);
- gtk_grid_attach(GTK_GRID(grid),local_microphone_b,col,row++,2,1);
- g_signal_connect(local_microphone_b,"toggled",G_CALLBACK(local_microphone_cb),NULL);
-
- input=gtk_combo_box_text_new();
- for(i=0;i<n_input_devices;i++) {
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(input),NULL,input_devices[i].name);
- if(transmitter->microphone_name!=NULL) {
- if(strcmp(transmitter->microphone_name,input_devices[i].name)==0) {
- gtk_combo_box_set_active(GTK_COMBO_BOX(input),i);
- }
- }
- }
-
- // If the combo box shows no device, take the first one
- i=gtk_combo_box_get_active(GTK_COMBO_BOX(input));
- if (i < 0) {
- gtk_combo_box_set_active(GTK_COMBO_BOX(input),0);
- }
-
- gtk_grid_attach(GTK_GRID(grid),input,col,row++,1,1);
- g_signal_connect(input,"changed",G_CALLBACK(local_input_changed_cb),NULL);
-
-
- }
-
- row=saved_row;
- col=3;
-
- GtkWidget *panadapter_high_label=gtk_label_new("Panadapter High: ");
+ GtkWidget *panadapter_high_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(panadapter_high_label), "<b>Panadapter High: </b>");
#ifdef GTK316
gtk_label_set_xalign(GTK_LABEL(panadapter_high_label),0);
#endif
col++;
- GtkWidget *panadapter_high_r=gtk_spin_button_new_with_range(-220.0,100.0,1.0);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(panadapter_high_r),(double)transmitter->panadapter_high);
- gtk_widget_show(panadapter_high_r);
- gtk_grid_attach(GTK_GRID(grid),panadapter_high_r,col,row,1,1);
- g_signal_connect(panadapter_high_r,"value_changed",G_CALLBACK(panadapter_high_value_changed_cb),NULL);
-
- row++;
- col=3;
-
- GtkWidget *panadapter_low_label=gtk_label_new("Panadapter Low: ");
+ GtkWidget *panadapter_low_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(panadapter_low_label), "<b>Panadapter Low: </b>");
#ifdef GTK316
gtk_label_set_xalign(GTK_LABEL(panadapter_low_label),0);
#endif
col++;
+ GtkWidget *panadapter_step_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(panadapter_step_label), "<b>Panadapter Step: </b>");
+#ifdef GTK316
+ gtk_label_set_xalign(GTK_LABEL(panadapter_step_label),0);
+#endif
+ gtk_widget_show(panadapter_step_label);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_step_label,col,row,1,1);
+
+ row++;
+ col=0;
+
+ GtkWidget *panadapter_high_r=gtk_spin_button_new_with_range(-220.0,100.0,1.0);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(panadapter_high_r),(double)transmitter->panadapter_high);
+ gtk_widget_show(panadapter_high_r);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_high_r,col,row,1,1);
+ g_signal_connect(panadapter_high_r,"value_changed",G_CALLBACK(panadapter_high_value_changed_cb),NULL);
+
+ col++;
+
GtkWidget *panadapter_low_r=gtk_spin_button_new_with_range(-400.0,100.0,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(panadapter_low_r),(double)transmitter->panadapter_low);
gtk_widget_show(panadapter_low_r);
gtk_grid_attach(GTK_GRID(grid),panadapter_low_r,col,row,1,1);
g_signal_connect(panadapter_low_r,"value_changed",G_CALLBACK(panadapter_low_value_changed_cb),NULL);
+ col++;
+
+ GtkWidget *panadapter_step_r=gtk_spin_button_new_with_range(-400.0,100.0,1.0);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(panadapter_step_r),(double)transmitter->panadapter_step);
+ gtk_widget_show(panadapter_step_r);
+ gtk_grid_attach(GTK_GRID(grid),panadapter_step_r,col,row,1,1);
+ g_signal_connect(panadapter_step_r,"value_changed",G_CALLBACK(panadapter_step_value_changed_cb),NULL);
+
row++;
- col=3;
+ col=0;
- GtkWidget *am_carrier_level_label=gtk_label_new("AM Carrier Level: ");
+ GtkWidget *am_carrier_level_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(am_carrier_level_label), "<b>AM Carrier Level:</b>");
#ifdef GTK316
gtk_label_set_xalign(GTK_LABEL(am_carrier_level_label),0);
#endif
g_signal_connect(am_carrier_level,"value_changed",G_CALLBACK(am_carrier_level_value_changed_cb),NULL);
row++;
- col=3;
+ col=0;
GtkWidget *emp_b=gtk_check_button_new_with_label("FM TX Pre-emphasize before limiting");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (emp_b), pre_emphasize);
g_signal_connect(emp_b,"toggled",G_CALLBACK(emp_cb),NULL);
row++;
- col=3;
+ col=0;
GtkWidget *ctcss_b=gtk_check_button_new_with_label("CTCSS Enable");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctcss_b), transmitter->ctcss);
g_signal_connect(ctcss_spin,"value-changed",G_CALLBACK(ctcss_spin_cb),NULL);
row++;
- col=3;
+ col=0;
GtkWidget *tune_use_drive_b=gtk_check_button_new_with_label("Tune use drive");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tune_use_drive_b), transmitter->tune_use_drive);
g_signal_connect(tune_use_drive_b,"toggled",G_CALLBACK(tune_use_drive_cb),NULL);
row++;
- col=3;
+ col=0;
- GtkWidget *tune_percent_label=gtk_label_new("Tune Percent: ");
+ GtkWidget *tune_percent_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(tune_percent_label), "<b>Tune Percent:</b>");
#ifdef GTK316
gtk_label_set_xalign(GTK_LABEL(tune_percent_label),0);
#endif
#include "tx_panadapter.h"
#include "vfo.h"
#include "mode.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
#ifdef GPIO
#include "gpio.h"
#endif
int display_width=gtk_widget_get_allocated_width (tx->panadapter);
int display_height=gtk_widget_get_allocated_height (tx->panadapter);
+
int txvfo = get_tx_vfo();
int txmode = get_tx_mode();
for(i=tx->panadapter_high;i>=tx->panadapter_low;i--) {
char v[32];
- if((abs(i)%10) ==0) {
+ if((abs(i)%tx->panadapter_step) ==0) {
double y = (double)(tx->panadapter_high-i)*dbm_per_line;
if ((abs(i) % 20) == 0) {
cairo_set_source_rgb (cr, 0.00, 1.00, 1.00);
cairo_set_line_width(cr, 1.0);
cairo_stroke(cr);
-#ifdef FREEDV
- if(active_receiver->freedv) {
- cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
- cairo_set_font_size(cr, 16);
- cairo_text_extents(cr, transmitter->freedv_text_data, &extents);
- cairo_move_to(cr, (double)display_width/2.0-(extents.width/2.0),(double)display_height-2.0);
- cairo_show_text(cr, transmitter->freedv_text_data);
- }
-#endif
+#ifdef GPIO
+ if(controller==CONTROLLER1 && !duplex) {
+ char text[64];
-#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) && defined (GPIO)
- cairo_set_source_rgb(cr,1.0,1.0,0.0);
- cairo_set_font_size(cr,16);
- if(ENABLE_E2_ENCODER) {
- cairo_move_to(cr, display_width-150,30);
- cairo_show_text(cr, encoder_string[e2_encoder_action]);
- }
+ cairo_set_source_rgb(cr,1.0,1.0,0.0);
+ cairo_set_font_size(cr,16);
+ if(ENABLE_E2_ENCODER) {
+ cairo_move_to(cr, display_width-200,30);
+ sprintf(text,"%s (%s)",encoder_string[e2_encoder_action],sw_string[e2_sw_action]);
+ cairo_show_text(cr, text);
+ }
- if(ENABLE_E3_ENCODER) {
- cairo_move_to(cr, display_width-150,50);
- cairo_show_text(cr, encoder_string[e3_encoder_action]);
- }
+ if(ENABLE_E3_ENCODER) {
+ cairo_move_to(cr, display_width-200,50);
+ sprintf(text,"%s (%s)",encoder_string[e3_encoder_action],sw_string[e3_sw_action]);
+ cairo_show_text(cr, text);
+ }
- if(ENABLE_E4_ENCODER) {
- cairo_move_to(cr, display_width-150,70);
- cairo_show_text(cr, encoder_string[e4_encoder_action]);
+ if(ENABLE_E4_ENCODER) {
+ cairo_move_to(cr, display_width-200,70);
+ sprintf(text,"%s (%s)",encoder_string[e4_encoder_action],sw_string[e4_sw_action]);
+ cairo_show_text(cr, text);
+ }
}
#endif
+
#ifdef PURESIGNAL
if(tx->puresignal) {
cairo_set_source_rgb(cr,0.0,1.0,0.0);
cairo_set_source_rgb(cr,1.0,0.0,0.0);
cairo_set_font_size(cr, 16);
- sprintf(text,"FWD: %0.3f",transmitter->fwd);
+ if(transmitter->fwd<0.0001) {
+ sprintf(text,"FWD: %0.3f",transmitter->exciter);
+ } else {
+ sprintf(text,"FWD: %0.3f",transmitter->fwd);
+ }
cairo_move_to(cr,10,15);
cairo_show_text(cr, text);
sprintf(text,"ALC: %0.3f",transmitter->alc);
cairo_move_to(cr,10,45);
cairo_show_text(cr, text);
+
+/*
+ sprintf(text,"FWD: %0.8f",transmitter->fwd);
+ cairo_move_to(cr,10,60);
+ cairo_show_text(cr, text);
+
+ sprintf(text,"EXC: %0.3f",transmitter->exciter);
+ cairo_move_to(cr,10,75);
+ cairo_show_text(cr, text);
+*/
}
cairo_destroy (cr);
char build_date[]=GIT_DATE;
char build_version[]=GIT_VERSION;
-#if defined (CONTROLLER2_V1)
-char version[]="2.0.7-beta (Controller2 V1)";
-#elif defined (CONTROLLER2_V2)
-char version[]="2.0.7-beta (Controller2 V2)";
-#elif defined (GPIO)
-char version[]="2.0.7-beta (Controller1)";
-#else
-char version[]="2.0.7-beta";
+char version[]="2.0.0-RC1"
+#if defined(GPIO) || defined(PURESIGNAL) || defined(SOAPYSDR) || defined(MIDI)
+" includes"
#endif
+#ifdef GPIO
+" GPIO"
+#endif
+#ifdef PURESIGNAL
+" PURESIGNAL"
+#endif
+#ifdef SOAPYSDR
+" SOAPYSDR"
+#endif
+#ifdef MIDI
+" MIDI"
+#endif
+
+;
#include "filter.h"
#include "bandstack.h"
#include "band.h"
-#include "frequency.h"
#include "new_protocol.h"
#include "property.h"
#include "radio.h"
#include "new_menu.h"
#include "rigctl.h"
#include "ext.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
static GtkWidget *parent_window;
static int my_width;
char *value;
for(i=0;i<MAX_VFOS;i++) {
+g_print("vfo_restore_state: %d\n",i);
vfo[i].band=band20;
vfo[i].bandstack=0;
vfo[i].frequency=14010000;
#ifdef SOAPYSDR
if(radio->protocol==SOAPYSDR_PROTOCOL) {
+ vfo[i].band=band144;
+ vfo[i].bandstack=0;
vfo[i].frequency=144010000;
}
#endif
vfo[i].mode=modeCWU;
- vfo[i].filter=6;
+ vfo[i].filter=filterF6;
vfo[i].lo=0;
vfo[i].offset=0;
vfo[i].rit_enabled=0;
vfo[i].rit=0;
vfo[i].ctun=0;
+g_print("vfo_restore_state: band=%d frequency=%lld\n",vfo[i].band,vfo[i].frequency);
+
sprintf(name,"vfo.%d.band",i);
value=getProperty(name);
if(value) vfo[i].band=atoi(value);
}
if(can_transmit) {
- tx_set_mode(transmitter,get_tx_mode());
+ tx_set_mode(transmitter,get_tx_mode());
}
//
// I do not think the band can change within this function.
break;
}
if(can_transmit) {
- tx_set_mode(transmitter,get_tx_mode());
+ tx_set_mode(transmitter,get_tx_mode());
}
//
// changing modes may change BFO frequency
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
- char dv[32];
- strcpy(dv,"");
-#ifdef FREEDV
- if(active_receiver->freedv) {
- sprintf(dv,"FreeDV %s", freedv_get_mode_string());
- }
-#endif
- cairo_set_font_size(cr, 12);
- cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
- cairo_move_to(cr, 5, 15);
-
switch(vfo[id].mode) {
case modeFMN:
if(active_receiver->deviation==2500) {
- sprintf(temp_text,"%s 8k %s",mode_string[vfo[id].mode],dv);
+ sprintf(temp_text,"%s 8k",mode_string[vfo[id].mode]);
} else {
- sprintf(temp_text,"%s 16k %s",mode_string[vfo[id].mode],dv);
+ sprintf(temp_text,"%s 16k",mode_string[vfo[id].mode]);
}
break;
case modeCWL:
case modeUSB:
case modeDSB:
case modeAM:
- sprintf(temp_text,"%s %s %s",mode_string[vfo[id].mode],band_filter->title,dv);
+ sprintf(temp_text,"%s %s",mode_string[vfo[id].mode],band_filter->title);
break;
default:
sprintf(temp_text,"%s %s",mode_string[vfo[id].mode],band_filter->title);
// In what follows, we want to display the VFO frequency
// on which we currently transmit a signal with red colour.
- // If it is out-of-band, we display "Out of band" in red.
- // Frequencies we are not transmitting on are displayed in green
- // (dimmed if the freq. does not belong to the active receiver).
// Frequencies of VFO A and B
int oob=0;
if (can_transmit) oob=transmitter->out_of_band;
-
sprintf(temp_text,"VFO A: %0lld.%06lld",af/(long long)1000000,af%(long long)1000000);
-
if(txvfo == 0 && (isTransmitting() || oob)) {
if (oob) sprintf(temp_text,"VFO A: Out of band");
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
#include "vfo.h"
#include "button_text.h"
#include "ext.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
static GtkWidget *parent_window=NULL;
static GtkWidget *dialog=NULL;
g_idle_add(ext_vfo_update,NULL);
}
-#ifdef FREEDV
-static void enable_freedv_cb(GtkWidget *widget, gpointer data) {
- set_freedv(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
-}
-#endif
-
#ifdef PURESIGNAL
static void enable_ps_cb(GtkWidget *widget, gpointer data) {
tx_set_ps(transmitter,gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
gtk_grid_attach(GTK_GRID(grid),enable_squelch,3,5,1,1);
g_signal_connect(enable_squelch,"toggled",G_CALLBACK(squelch_enable_cb),NULL);
-#ifdef FREEDV
- GtkWidget *enable_freedv=gtk_check_button_new_with_label("Enable FreeDV");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable_freedv), active_receiver->freedv);
- gtk_grid_attach(GTK_GRID(grid),enable_freedv,3,6,1,1);
- g_signal_connect(enable_freedv,"toggled",G_CALLBACK(enable_freedv_cb),NULL);
-#endif
-
#ifdef PURESIGNAL
if(can_transmit) {
GtkWidget *enable_ps=gtk_check_button_new_with_label("Enable Pure Signal");
g_signal_connect (enable_b, "pressed", G_CALLBACK(enable_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),enable_b,3,0,1,1);
- GtkWidget *level_label=gtk_label_new("Mic Level:");
+ GtkWidget *level_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(level_label), "<b>Mic Level:</b>");
gtk_misc_set_alignment (GTK_MISC(level_label), 0, 0);
gtk_widget_show(level_label);
gtk_grid_attach(GTK_GRID(grid),level_label,0,1,1,1);
gtk_widget_show(level);
gtk_grid_attach(GTK_GRID(grid),level,1,1,3,1);
- GtkWidget *threshold_label=gtk_label_new("VOX Threshold:");
+ GtkWidget *threshold_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(threshold_label), "<b>VOX Threshold:</b>");
gtk_misc_set_alignment (GTK_MISC(threshold_label), 0, 0);
gtk_widget_show(threshold_label);
gtk_grid_attach(GTK_GRID(grid),threshold_label,0,2,1,1);
GtkWidget *vox_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0,1000.0,1.0);
// gtk_widget_set_size_request (vox_scale, 300, 25);
+ gtk_range_set_increments (GTK_RANGE(vox_scale),1.0,1.0);
gtk_range_set_value(GTK_RANGE(vox_scale),vox_threshold*1000.0);
gtk_widget_show(vox_scale);
gtk_grid_attach(GTK_GRID(grid),vox_scale,1,2,3,1);
g_signal_connect(G_OBJECT(vox_scale),"value_changed",G_CALLBACK(vox_value_changed_cb),NULL);
- GtkWidget *hang_label=gtk_label_new("VOX Hang (ms):");
+ GtkWidget *hang_label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(hang_label), "<b>VOX Hand (ms):</b>");
gtk_misc_set_alignment (GTK_MISC(hang_label), 0, 0);
gtk_widget_show(hang_label);
gtk_grid_attach(GTK_GRID(grid),hang_label,0,4,1,1);
GtkWidget *vox_hang_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0,1000.0,1.0);
+ gtk_range_set_increments (GTK_RANGE(vox_hang_scale),1.0,1.0);
gtk_range_set_value(GTK_RANGE(vox_hang_scale),vox_hang);
gtk_widget_show(vox_hang_scale);
gtk_grid_attach(GTK_GRID(grid),vox_hang_scale,1,4,3,1);
g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
- GtkWidget *label=gtk_label_new("Title");
+ GtkWidget *label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Title</b>");
gtk_grid_attach(GTK_GRID(grid),label,0,1,1,1);
- label=gtk_label_new("Min Freq(MHz)");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Min Freq(MHz)</b>");
gtk_grid_attach(GTK_GRID(grid),label,1,1,1,1);
- label=gtk_label_new("Max Freq(MHz)");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Max Freq(MHz)</b>");
gtk_grid_attach(GTK_GRID(grid),label,2,1,1,1);
- label=gtk_label_new("LO Freq(MHz)");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>LO Freq(MHz)</b>");
gtk_grid_attach(GTK_GRID(grid),label,3,1,1,1);
- label=gtk_label_new("LO Err(Hz)");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>LO Err(MHz)</b>");
gtk_grid_attach(GTK_GRID(grid),label,4,1,1,1);
-/*
- label=gtk_label_new("TX LO Freq(MHz)");
- gtk_grid_attach(GTK_GRID(grid),label,5,1,1,1);
- label=gtk_label_new("TX LO Err(Hz)");
- gtk_grid_attach(GTK_GRID(grid),label,6,1,1,1);
-*/
- label=gtk_label_new("Disable PA");
+ label=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(label), "<b>Disable PA</b>");
gtk_grid_attach(GTK_GRID(grid),label,7,1,1,1);
gtk_grid_attach(GTK_GRID(grid),lo_error[i],4,i+2,1,1);
g_signal_connect(lo_error[i],"changed",G_CALLBACK(lo_error_cb),GINT_TO_POINTER(i));
-/*
- tx_lo_frequency[i]=gtk_entry_new();
- gtk_entry_set_width_chars(GTK_ENTRY(tx_lo_frequency[i]),7);
- sprintf(f,"%5.3f",(double)xvtr->txFrequencyLO/1000000.0);
- gtk_entry_set_text(GTK_ENTRY(tx_lo_frequency[i]),f);
- gtk_grid_attach(GTK_GRID(grid),tx_lo_frequency[i],5,i+2,1,1);
- g_signal_connect(tx_lo_frequency[i],"changed",G_CALLBACK(tx_lo_frequency_cb),GINT_TO_POINTER(i));
-
- tx_lo_error[i]=gtk_entry_new();
- gtk_entry_set_width_chars(GTK_ENTRY(tx_lo_error[i]),9);
- sprintf(f,"%lld",xvtr->txErrorLO);
- gtk_entry_set_text(GTK_ENTRY(tx_lo_error[i]),f);
- gtk_grid_attach(GTK_GRID(grid),tx_lo_error[i],6,i+2,1,1);
- g_signal_connect(tx_lo_error[i],"changed",G_CALLBACK(tx_lo_error_cb),GINT_TO_POINTER(i));
-*/
-
disable_pa[i]=gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_pa[i]),xvtr->disablePA);
gtk_grid_attach(GTK_GRID(grid),disable_pa[i],7,i+2,1,1);