]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Cleanup of all menus.
authorJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 26 Jan 2020 16:39:42 +0000 (16:39 +0000)
committerJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 26 Jan 2020 16:39:42 +0000 (16:39 +0000)
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.

114 files changed:
Makefile
Makefile.mac
about_menu.c
ant_menu.c
audio.c
audio_waterfall.c [deleted file]
audio_waterfall.h [deleted file]
band.c
band.h
channel.h
discovery.c
display_menu.c
diversity_menu.c
dsp_menu.c
encoder_menu.c
equalizer_menu.c
exit_menu.c
ext.c
ext.h
fft_menu.c
filter.c
filter.h
freedv.c [deleted file]
freedv.h [deleted file]
freedv_menu.c [deleted file]
freedv_menu.h [deleted file]
gpio.c
gpio.h
i2c.c
main.c
meter.c
meter.h
meter_menu.c
mode.c
mode.h
new_discovery.c
new_menu.c
new_menu.h
new_protocol.c
oc_menu.c
old_discovery.c
old_protocol.c
pa_menu.c
property.c
property.h
ps_menu.c
psk.c [deleted file]
psk.h [deleted file]
psk_waterfall.c [deleted file]
psk_waterfall.h [deleted file]
radio.c
radio.h
radio_menu.c
receiver.c
receiver.h
release/pihpsdr-controller1.v2.0.0-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.1-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.2-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.3-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.4-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.5-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.6-beta.tar [deleted file]
release/pihpsdr-controller1.v2.0.7-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.0-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.1-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.2-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.3-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.4-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.5-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.6-beta.tar [deleted file]
release/pihpsdr-controller2-v1.v2.0.7-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.0-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.1-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.2-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.3-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.4-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.5-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.6-beta.tar [deleted file]
release/pihpsdr-controller2-v2.v2.0.7-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.0-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.1-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.2-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.3-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.4-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.5-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.6-beta.tar [deleted file]
release/pihpsdr-nocontroller.v2.0.7-beta.tar [deleted file]
release/pihpsdr-v2.0.0-beta.tar [deleted file]
release/pihpsdr.tar [deleted file]
release/pihpsdr_up.tar [deleted file]
release/pihpsdr_v1.1.0-beta.tar [deleted file]
release/pihpsdr_v1.1.1-beta.tar [deleted file]
release/pihpsdr_v1.1.2-beta.tar [deleted file]
release/pihpsdr_v1.1.3-beta.tar [deleted file]
release/tinker.tar [deleted file]
rigctl_menu.c
rx_menu.c
rx_panadapter.c
sliders.c
sliders.h
soapy_discovery.c
soapy_protocol.c
soundio.c
switch_menu.c
toolbar.c
transmitter.c
transmitter.h
tx_menu.c
tx_panadapter.c
version.c
vfo.c
vfo_menu.c
vox_menu.c
xvtr_menu.c

index a52f6fc07c0cf0c55f3fe9b84f5b5c889e0927cc..a2db8440c22c40e3ea418a9808b6252281d1d337 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,15 +5,6 @@ GIT_VERSION := $(shell git describe --abbrev=0 --tags)
 # 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
 
@@ -24,13 +15,7 @@ PURESIGNAL_INCLUDE=PURESIGNAL
 #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
@@ -44,22 +29,12 @@ PURESIGNAL_INCLUDE=PURESIGNAL
 # 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
@@ -103,10 +78,6 @@ ozyio.o
 endif
 
 
-ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY)
-RADIOBERRY_OPTIONS=-D RADIOBERRY
-endif
-
 ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR)
 SOAPYSDR_OPTIONS=-D SOAPYSDR
 SOAPYSDRLIBS=-lSoapySDR
@@ -122,35 +93,6 @@ 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
@@ -160,29 +102,27 @@ endif
 
 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
@@ -215,11 +155,11 @@ AUDIO_LIBS=-lasound
 
 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)
@@ -231,10 +171,7 @@ PROGRAM=pihpsdr
 
 SOURCES= \
 audio.c \
-audio_waterfall.c \
 band.c \
-configure.c \
-frequency.c \
 discovered.c \
 discovery.c \
 filter.c \
@@ -300,12 +237,9 @@ cwramp.c
 
 HEADERS= \
 audio.h \
-audio_waterfall.h \
 agc.h \
 alex.h \
 band.h \
-configure.h \
-frequency.h \
 bandstack.h \
 channel.h \
 discovered.h \
@@ -370,10 +304,7 @@ error_handler.h
 
 OBJS= \
 audio.o \
-audio_waterfall.o \
 band.o \
-configure.o \
-frequency.o \
 discovered.o \
 discovery.o \
 filter.o \
@@ -436,19 +367,19 @@ ext.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:
@@ -466,8 +397,8 @@ CPPINCLUDES:=$(shell echo $(INCLUDES) | sed -e "s/-pthread / /" )
 .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:
@@ -522,3 +453,13 @@ newhpsdrsim.o:     newhpsdrsim.c hpsdrsim.h
 
 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
+
index 63f38933140c3032cd08f0835fbbeb3352446206..d6a23290299e0a1da10d476a90af9dc12cac373e 100644 (file)
@@ -5,15 +5,6 @@ GIT_VERSION := $(shell git describe --abbrev=0 --tags)
 # 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
 
@@ -26,12 +17,6 @@ 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
-
 # uncomment the line to below include support for sx1509 i2c expander
 #SX1509_INCLUDE=sx1509
 
@@ -44,9 +29,6 @@ STEMLAB_DISCOVERY=STEMLAB_DISCOVERY_NOAVAHI
 # 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
 
@@ -102,11 +84,6 @@ USBOZY_OBJS= \
 ozyio.o
 endif
 
-
-ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY)
-RADIOBERRY_OPTIONS=-D RADIOBERRY
-endif
-
 ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR)
 SOAPYSDR_OPTIONS=-D SOAPYSDR
 SOAPYSDRLIBS=-lSoapySDR
@@ -121,36 +98,6 @@ soapy_discovery.o \
 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
@@ -175,13 +122,6 @@ ifeq ($(GPIO_INCLUDE),GPIO)
   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
@@ -214,12 +154,12 @@ AUDIO_LIBS=-lportaudio -O3
 
 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)
@@ -231,10 +171,8 @@ PROGRAM=pihpsdr
 
 SOURCES= \
 audio.c \
-audio_waterfall.c \
 band.c \
 configure.c \
-frequency.c \
 discovered.c \
 discovery.c \
 filter.c \
@@ -301,12 +239,10 @@ cwramp.c
 
 HEADERS= \
 audio.h \
-audio_waterfall.h \
 agc.h \
 alex.h \
 band.h \
 configure.h \
-frequency.h \
 bandstack.h \
 channel.h \
 discovered.h \
@@ -372,10 +308,8 @@ error_handler.h
 OBJS= \
 audio.o \
 portaudio.o \
-audio_waterfall.o \
 band.o \
 configure.o \
-frequency.o \
 discovered.o \
 discovery.o \
 filter.o \
@@ -438,18 +372,18 @@ ext.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
@@ -466,8 +400,8 @@ CPPINCLUDES:=$(shell echo $(INCLUDES) | sed -e "s/-pthread / /" )
 .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
@@ -543,12 +477,12 @@ hpsdrsim:       hpsdrsim.o newhpsdrsim.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
index 8c4e9ee5497f9d75d2916e29b9e8e63b9a755287..d25b21cdd3db61e83cff4118f644f74da2279d40 100644 (file)
@@ -144,10 +144,6 @@ void about_menu(GtkWidget *parent) {
       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);
index b0cec5bc8f07224b46110f8ba11ed42941bbc3e3..be686d78bed504db220a85161459b45e9ddbe9ff 100644 (file)
@@ -109,11 +109,37 @@ static void tx_ant_cb(GtkToggleButton *widget, gpointer data) {
 
 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);
 
@@ -184,8 +210,9 @@ static void show_xvtr() {
     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);
 
@@ -335,57 +362,68 @@ void ant_menu(GtkWidget *parent) {
 
 
   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);
@@ -399,7 +437,8 @@ void ant_menu(GtkWidget *parent) {
 
 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();
 
@@ -415,7 +454,8 @@ g_print("rx_antennas=%ld\n",radio->info.soapy.rx_antennas);
     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();
   
diff --git a/audio.c b/audio.c
index ba5b3aaf792e7b968775a8af2609b2a3312dfafc..cce7a16d6aba259b5b8227ed191ed300935ea2ee 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -524,6 +524,9 @@ g_print("mic_read_thread: snd_pcm_start\n");
         switch(protocol) {
           case ORIGINAL_PROTOCOL:
           case NEW_PROTOCOL:
+#ifdef SOAPYSDR
+          case SOAPYSDR_PROTOCOL:
+#endif
            //
            // put sample into ring buffer
            //
@@ -540,12 +543,6 @@ g_print("mic_read_thread: snd_pcm_start\n");
              }
             }
             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;
         }
diff --git a/audio_waterfall.c b/audio_waterfall.c
deleted file mode 100644 (file)
index 3bbf6a7..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-/* 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;
-}
diff --git a/audio_waterfall.h b/audio_waterfall.h
deleted file mode 100644 (file)
index 75388e2..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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
-
diff --git a/band.c b/band.c
index ca073d52ffb87f3bb3b196696044207f94c1dc37..92543d2caa3ee7548879d36a9af2d885dc4c7b60 100644 (file)
--- a/band.c
+++ b/band.c
 #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
@@ -265,7 +270,9 @@ BANDSTACK bandstack_xvtr_7={3,0,bandstack_entries_xvtr_7};
 
 
 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},
@@ -289,8 +296,6 @@ BAND bands[BANDS+XVTRS] =
 #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},
@@ -644,3 +649,146 @@ int get_band_from_frequency(long long f) {
 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;
+}
+*/
diff --git a/band.h b/band.h
index 026f3183493128523f7dcc5639728e340fa80151..7d2de4d606d3b564a41dc30254a11c8334243078 100644 (file)
--- a/band.h
+++ b/band.h
 #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
 
@@ -127,4 +124,7 @@ extern BANDSTACK_ENTRY *bandstack_entry_get_current();
 extern void bandSaveState();
 extern void bandRestoreState();
 
+char* getFrequencyInfo(long long frequency,int filter_low,int filter_high);
+int canTransmit();
+
 #endif
index 43b2dff461d57f4a23e7db97f50cac17603fa320..9a64bcd5b0cacee448bd6b13d4a1282e068ea70a 100644 (file)
--- a/channel.h
+++ b/channel.h
@@ -32,9 +32,6 @@
 #define CHANNEL_BS 9
 #define CHANNEL_SUBRX 10
 #define CHANNEL_AUDIO 11
-#ifdef PSK
-#define CHANNEL_PSK 12
-#endif
 
 #endif
 
index d0829834aedaee0ac60c47c901e6307897ea788f..0e8eb01ff26a4371c115da2ddda0a479d57c60dd 100644 (file)
@@ -49,6 +49,7 @@
 #include "stemlab_discovery.h"
 #endif
 #include "ext.h"
+#include "gpio.h"
 #include "configure.h"
 
 static GtkWidget *discovery_dialog;
@@ -63,6 +64,10 @@ GtkWidget *tcpaddr;
 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
@@ -198,10 +203,18 @@ static gboolean midi_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
 #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) {
@@ -304,6 +317,7 @@ void discovery() {
     //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;
@@ -352,6 +366,7 @@ void discovery() {
     //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;
@@ -497,9 +512,26 @@ fprintf(stderr,"%p Protocol=%d name=%s\n",d,d->protocol,d->name);
 
     }
 #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");
index 63ec35f8fd99423acc79ce4da6cf3b4dd9ceae83..7155bb2202d600e06385a8c191d2f02c524e0f03 100644 (file)
@@ -171,7 +171,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -188,7 +189,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -205,7 +207,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -222,7 +225,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -239,7 +243,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -256,7 +261,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -273,7 +279,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -290,7 +297,8 @@ void display_menu(GtkWidget *parent) {
   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);
@@ -332,6 +340,7 @@ void display_menu(GtkWidget *parent) {
   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);
index 527a44974621a6ca2136d4f69040295ff56198bb..8f89d9483ab5f05c2a420cbe67f140db2a06d32f 100644 (file)
@@ -179,6 +179,7 @@ void diversity_menu(GtkWidget *parent) {
   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);
@@ -191,6 +192,7 @@ void diversity_menu(GtkWidget *parent) {
   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);
index e0780bb0bdd084d86727574edde519da3415be7c..c02b631e7ff1e4927286fe2ca689186241b9b3e0 100644 (file)
@@ -121,16 +121,19 @@ void dsp_menu(GtkWidget *parent) {
   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);
@@ -147,7 +150,8 @@ void dsp_menu(GtkWidget *parent) {
   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);
@@ -171,6 +175,7 @@ void dsp_menu(GtkWidget *parent) {
   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);
index 71dd31b81247d2e66a7de6daf5d03bcb4b0eb9a5..da4f775c356f13a42c4b9b5d0f42215fe4655137 100644 (file)
@@ -32,9 +32,7 @@
 #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;
 
@@ -58,7 +56,6 @@ static GtkWidget *b_panadapter_low;
 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;
@@ -76,31 +73,20 @@ static GtkWidget *b_top_panadapter_high;
 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 {
@@ -136,37 +122,27 @@ static void enc_select_cb(GtkWidget *widget,gpointer data) {
     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]);
 }
@@ -209,11 +185,9 @@ static void sw_select_cb(GtkWidget *widget,gpointer data) {
     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]);
 }
@@ -268,11 +242,9 @@ GtkWidget* getRadioButton(int 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;
@@ -304,7 +276,6 @@ GtkWidget* getRadioButton(int action) {
   return button;
 }
 
-#ifdef CONTROLLER2_V2
 GtkWidget* getTopRadioButton(int action) {
   GtkWidget* button;
   switch(action) {
@@ -364,8 +335,6 @@ GtkWidget* getTopRadioButton(int action) {
   }
   return button;
 }
-#endif
-
 
 static gboolean select_cb (GtkWidget *widget, gpointer data) {
   GtkWidget *button;
@@ -389,7 +358,6 @@ static gboolean select_cb (GtkWidget *widget, gpointer data) {
   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;
@@ -411,7 +379,6 @@ static gboolean top_select_cb (GtkWidget *widget, gpointer data) {
   button=getTopRadioButton(action);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 }
-#endif
 
 void encoder_select(int pos) {
   int action;
@@ -466,7 +433,6 @@ void encoder_select(int pos) {
 
 }
 
-#ifdef CONTROLLER2_V2
 void top_encoder_select(int pos) {
   int action;
   GtkWidget *button;
@@ -533,7 +499,6 @@ void top_encoder_select(int pos) {
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
 }
-#endif
 
   static gboolean action_select_cb (GtkWidget *widget, gpointer data) {
     int action=(int)data;
@@ -553,7 +518,6 @@ void top_encoder_select(int pos) {
     }
   }
 
-#ifdef CONTROLLER2_V2
   static gboolean top_action_select_cb (GtkWidget *widget, gpointer data) {
     int action=(int)data;
     switch(encoder) {
@@ -571,7 +535,6 @@ void top_encoder_select(int pos) {
         break;
     }
   }
-#endif
 
   static gboolean enc2_cb(GtkWidget *widget, gpointer data) {
     int i=gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
@@ -609,7 +572,6 @@ void top_encoder_select(int pos) {
     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;
@@ -645,7 +607,6 @@ void top_encoder_select(int pos) {
     e5_top_encoder_action=i;
     return TRUE;
   }
-#endif
 
 void encoder_menu(GtkWidget *parent) {
   int row=0;
@@ -673,33 +634,36 @@ void encoder_menu(GtkWidget *parent) {
   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++;
 
@@ -708,12 +672,12 @@ void encoder_menu(GtkWidget *parent) {
   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);
@@ -722,7 +686,8 @@ void encoder_menu(GtkWidget *parent) {
   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++;
 
@@ -731,12 +696,12 @@ void encoder_menu(GtkWidget *parent) {
   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);
@@ -745,7 +710,8 @@ void encoder_menu(GtkWidget *parent) {
   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++;
 
@@ -754,12 +720,12 @@ void encoder_menu(GtkWidget *parent) {
   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);
@@ -768,27 +734,28 @@ void encoder_menu(GtkWidget *parent) {
   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);
 
index 3880e6da8d369c8c50fb1cc48b8b03fd2c971e76..1d6faa32b924b80d6693acac6312e350af2df141 100644 (file)
@@ -167,19 +167,24 @@ void equalizer_menu(GtkWidget *parent) {
   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 {
@@ -199,6 +204,7 @@ void equalizer_menu(GtkWidget *parent) {
   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 {
@@ -218,6 +224,7 @@ void equalizer_menu(GtkWidget *parent) {
   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 {
@@ -237,6 +244,7 @@ void equalizer_menu(GtkWidget *parent) {
   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 {
index d7b58778e62b634fa57e82cae782f69d5aeab7cf..d74597ffcb853b804659cefff51244255e5bc0e4 100644 (file)
@@ -181,7 +181,7 @@ void exit_menu(GtkWidget *parent) {
   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);
 
diff --git a/ext.c b/ext.c
index 7c8a5cbbccfe320d4e3640f29ae46d2e29d7edc2..ed6339d50bcafcdeb2cd9d426335dbb10104ed88 100644 (file)
--- a/ext.c
+++ b/ext.c
@@ -180,7 +180,7 @@ int ext_radio_change_sample_rate(void *data) {
 }
 
 int ext_update_squelch(void *data) {
-  set_squelch();
+  set_squelch(active_receiver);
   return 0;
 }
 
@@ -574,6 +574,13 @@ int ext_diversity_update(void *data) {
   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:
diff --git a/ext.h b/ext.h
index 5a365f54d4f639ba1dc81d87929e0cbd421f8241..6442dc5a857a693d1acf9a3dd9e8be488dc68317 100644 (file)
--- a/ext.h
+++ b/ext.h
@@ -109,3 +109,6 @@ int ext_set_rf_gain(void *data);
 int ext_set_duplex(void *data);
 
 int ext_update_noise(void *data);
+#ifdef PURESIGNAL
+int ext_start_ps(void *data);
+#endif
index 76c2d3c8bf6cb70d3b4379a5da6a4ce777c87a5b..9f9c082db9394a8f5eeda490b9d13498e48616f7 100644 (file)
@@ -97,7 +97,8 @@ void fft_menu(GtkWidget *parent) {
   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++;
index 28043afb43cfa6a7a4eb2223aa883c136b6a4985..af0160a9e77e8a2c3429bb7d36a859609bbebb21 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -207,24 +207,6 @@ FILTER filterDRM[FILTERS]={
     {-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
@@ -238,12 +220,10 @@ FILTER *filters[]={
     ,filterDIGL
     ,filterSAM
     ,filterDRM
-#ifdef PSK
-    ,filterPSK
-#endif
-
 };
 
+gint filter_step=5;
+
 void filterSaveState() {
     char value[128];
 
@@ -443,18 +423,57 @@ void filter_width_changed(int rx,int increment) {
 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);
   }
+
 }
index 1e1b4634f011cf04cea19d3409b045079d3ef7cf..97c2f8b845ae0b9042ff69f642393055aece102d 100644 (file)
--- a/filter.h
+++ b/filter.h
@@ -47,17 +47,20 @@ typedef struct _FILTER 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
diff --git a/freedv.c b/freedv.c
deleted file mode 100644 (file)
index 1c0627e..0000000
--- a/freedv.c
+++ /dev/null
@@ -1,310 +0,0 @@
-#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);
-  }
-}
diff --git a/freedv.h b/freedv.h
deleted file mode 100644 (file)
index 26fe515..0000000
--- a/freedv.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* 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
diff --git a/freedv_menu.c b/freedv_menu.c
deleted file mode 100644 (file)
index f3cfbfb..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
-* 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);
-
-}
-
diff --git a/freedv_menu.h b/freedv_menu.h
deleted file mode 100644 (file)
index 3aa8186..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* 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);
diff --git a/gpio.c b/gpio.c
index 1b21c1ed603945852392d2f03bcb60b1a12a9a34..afca5df07b7e0b1cac9735cad4fcfa069ea782e5 100644 (file)
--- a/gpio.c
+++ b/gpio.c
 #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;
@@ -199,58 +143,27 @@ int CW_ACTIVE_LOW=1;
 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;
@@ -284,6 +197,12 @@ static int previous_mox_button=0;
 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",
@@ -292,10 +211,13 @@ char *encoder_string[ENCODER_ACTIONS] = {
   "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",
@@ -303,13 +225,18 @@ char *encoder_string[ENCODER_ACTIONS] = {
   "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",
@@ -318,17 +245,17 @@ char *sw_string[SWITCH_ACTIONS] = {
   "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",
@@ -336,23 +263,20 @@ char *sw_string[SWITCH_ACTIONS] = {
   "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);
@@ -555,11 +479,14 @@ static int e_function_pressed(void *data) {
     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;
 }
@@ -591,7 +518,6 @@ static void e4FunctionAlert() {
     }
 }
 
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
 static unsigned long e5debounce=0;
 
 static void e5FunctionAlert() {
@@ -600,9 +526,7 @@ 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;
 
@@ -758,7 +682,7 @@ static void moxAlert() {
       mox_debounce=t+settle_time;
     }
 }
-#endif
+
 
 
 #ifdef VFO_HAS_FUNCTION
@@ -801,7 +725,6 @@ static void e2EncoderInt() {
   }
 }
 
-#if defined (CONTROLLER2_V2)
 static void e2TopEncoderInt() {
   static int e2TopCurrentA=1;
   int levelA=digitalRead(E2_TOP_ENCODER_A);
@@ -813,7 +736,6 @@ static void e2TopEncoderInt() {
     e2TopCurrentA=levelA;
   }
 }
-#endif
 
 static void e3EncoderInt() {
   static int e3CurrentA=1;
@@ -827,7 +749,6 @@ static void e3EncoderInt() {
   }
 }
 
-#if defined (CONTROLLER2_V2)
 static void e3TopEncoderInt() {
   static int e3TopCurrentA=1;
   int levelA=digitalRead(E3_TOP_ENCODER_A);
@@ -840,7 +761,6 @@ static void e3TopEncoderInt() {
     e3TopCurrentA=levelA;
   }
 }
-#endif
 
 static void e4EncoderInt() {
   static int e4CurrentA=1;
@@ -854,7 +774,6 @@ static void e4EncoderInt() {
   }
 }
 
-#if defined (CONTROLLER2_V2)
 static void e4TopEncoderInt() {
   static int e4TopCurrentA=1;
   int levelA=digitalRead(E4_TOP_ENCODER_A);
@@ -866,10 +785,7 @@ static void e4TopEncoderInt() {
     e4TopCurrentA=levelA;
   }
 }
-#endif
-
 
-#if defined (CONTROLLER2_V2)  || defined (CONTROLLER2_V1)
 static void e5EncoderInt() {
   static int e5CurrentA=1;
   int levelA=digitalRead(E5_ENCODER_A);
@@ -882,9 +798,7 @@ static void e5EncoderInt() {
     e5CurrentA=levelA;
   }
 }
-#endif
 
-#if defined (CONTROLLER2_V2)
 static void e5TopEncoderInt() {
   static int e5TopCurrentA=1;
   int levelA=digitalRead(E5_TOP_ENCODER_A);
@@ -896,25 +810,273 @@ static void e5TopEncoderInt() {
     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");
@@ -927,38 +1089,48 @@ void gpio_restore_actions() {
   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");
@@ -991,7 +1163,6 @@ void gpio_restore_state() {
   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");
@@ -1000,8 +1171,6 @@ void gpio_restore_state() {
   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");
@@ -1034,18 +1203,24 @@ void gpio_restore_state() {
   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);              
@@ -1068,6 +1243,7 @@ void gpio_save_actions() {
   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);
@@ -1082,13 +1258,10 @@ void gpio_save_actions() {
   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);
@@ -1097,20 +1270,36 @@ void gpio_save_actions() {
   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);
@@ -1143,7 +1332,6 @@ void gpio_save_state() {
   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);
@@ -1152,8 +1340,6 @@ void gpio_save_state() {
   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);
@@ -1186,18 +1372,23 @@ void gpio_save_state() {
   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);              
@@ -1311,17 +1502,12 @@ int gpio_init() {
   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;
   }
 
@@ -1333,11 +1519,11 @@ int gpio_init() {
     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) {
@@ -1347,11 +1533,11 @@ int gpio_init() {
     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) {
@@ -1361,62 +1547,62 @@ int gpio_init() {
     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 )
@@ -1426,19 +1612,17 @@ int gpio_init() {
   }
   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);
@@ -1498,19 +1682,16 @@ int e4_encoder_get_pos() {
     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;
@@ -1534,7 +1715,6 @@ int e5_top_encoder_get_pos() {
     e5TopEncoderPos=0;
     return pos;
 }
-#endif
 
 int function_get_state() {
     return function_state;
@@ -1592,6 +1772,16 @@ static void encoder_changed(int action,int pos) {
   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;
@@ -1612,6 +1802,16 @@ static void encoder_changed(int action,int pos) {
       }
       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;
@@ -1632,6 +1832,16 @@ static void encoder_changed(int action,int 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;
@@ -1652,26 +1862,40 @@ static void encoder_changed(int action,int 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:
@@ -1694,6 +1918,18 @@ static void encoder_changed(int action,int pos) {
       }
       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);
@@ -1764,6 +2000,21 @@ static void encoder_changed(int action,int pos) {
       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;
@@ -1773,7 +2024,29 @@ static void encoder_changed(int action,int 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;
@@ -1825,7 +2098,6 @@ static int e4_encoder_changed(void *data) {
   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) {
@@ -1835,10 +2107,8 @@ static int e5_encoder_changed(void *data) {
   }
   return 0;
 }
-#endif
 
 
-#ifdef CONTROLLER2_V2
 static int e2_top_encoder_changed(void *data) {
   int pos=(int)data;
   if(active_menu==E2_MENU) {
@@ -1878,7 +2148,6 @@ static int e5_top_encoder_changed(void *data) {
   }
   return 0;
 }
-#endif
 
 static gpointer rotary_encoder_thread(gpointer data) {
     int pos;
@@ -1908,34 +2177,35 @@ static gpointer rotary_encoder_thread(gpointer data) {
             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
diff --git a/gpio.h b/gpio.h
index c14657901b0e5f7b70d49a5b75a7aba4609900b7..a0fec5182be3a21c26434be2d00b5c4145061277 100644 (file)
--- a/gpio.h
+++ b/gpio.h
 #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,
@@ -29,10 +45,13 @@ enum {
   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,
@@ -40,7 +59,12 @@ enum {
   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,
@@ -86,6 +110,7 @@ enum {
   MENU_FREQUENCY,
   MENU_MEMORY,
   MENU_DIVERSITY,
+  MENU_PS,
   FUNCTION,
   SWITCH_ACTIONS
 };
@@ -93,44 +118,39 @@ enum {
 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;
 
@@ -150,30 +170,49 @@ extern int e3_sw_action;
 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;
@@ -186,6 +225,7 @@ extern int ENABLE_S5_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;
@@ -197,28 +237,29 @@ extern int SIDETONE_GPIO;
 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
diff --git a/i2c.c b/i2c.c
index 67f52ee8b55d93778c7b46feac4c8b9bd1f823a1..1dc7b1eaaa32796ae4ad474994a388824d90f4e2 100644 (file)
--- a/i2c.c
+++ b/i2c.c
@@ -133,55 +133,53 @@ void i2c_interrupt() {
         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]) {
diff --git a/main.c b/main.c
index 37a5807363e29e8d1dfda0453666b54bda38d2e9..6fa9c1357206a25de97bbf328754fe8f0d54bcf4 100644 (file)
--- a/main.c
+++ b/main.c
@@ -57,7 +57,6 @@
 #ifdef SOAPYSDR
 #include "soapy_protocol.h"
 #endif
-#include "frequency.h"   // for canTransmit
 #include "ext.h"
 
 struct utsname unameData;
diff --git a/meter.c b/meter.c
index f0d5305a9f168a249b7740118a6044f97a21ab9b..01f365d19cb6a4607090a9886c60ad5f5b8c1b55 100644 (file)
--- a/meter.c
+++ b/meter.c
 
 #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;
@@ -48,7 +42,7 @@ static cairo_surface_t *meter_surface = NULL;
 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;
 
@@ -116,68 +110,6 @@ meter_press_event_cb (GtkWidget *widget,
                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;
 }
 
@@ -210,11 +142,54 @@ fprintf(stderr,"meter_init: width=%d height=%d\n",width,height);
 
 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);
@@ -224,7 +199,11 @@ if(analog_meter) {
   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;
@@ -329,25 +308,10 @@ if(analog_meter) {
       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;
@@ -367,6 +331,65 @@ if(analog_meter) {
       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;
@@ -404,17 +427,19 @@ if(analog_meter) {
         }
         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);
@@ -422,7 +447,7 @@ if(analog_meter) {
 
 
       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);
 
@@ -544,7 +569,11 @@ if(analog_meter) {
       // 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;
@@ -632,69 +661,22 @@ if(analog_meter) {
 
       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);
 
@@ -715,12 +697,6 @@ if(analog_meter) {
       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;
   }
 
diff --git a/meter.h b/meter.h
index 720a49a5dcb3ff2b4162ff59a95e2b16efa3f930..7c3bfd285f5de592c2a4743e5584adbf3c332a37 100644 (file)
--- a/meter.h
+++ b/meter.h
 
 #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);
index 7552e39c908cd83f21bf34a2fbf61876b34f586d..bb98f6989ba63f070afce1200564c5682ce25d1b 100644 (file)
@@ -66,7 +66,6 @@ static void analog_cb(GtkToggleButton *widget, gpointer data) {
   analog_meter=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 }
 
-
 void meter_menu (GtkWidget *parent) {
   parent_window=parent;
 
@@ -86,47 +85,65 @@ void meter_menu (GtkWidget *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);
 
diff --git a/mode.c b/mode.c
index 349d7cafe3d046418770b7b785e34c061d07454c..3497d1a8bf078457d5ae4f8882cad49f22bcb892 100644 (file)
--- a/mode.c
+++ b/mode.c
@@ -30,8 +30,5 @@ char *mode_string[]={
   ,"DIGL"
   ,"SAM"
   ,"DRM"
-#ifdef PSK
-  ,"PSK"
-#endif
 };
 
diff --git a/mode.h b/mode.h
index 22ca810915bc1694ce5bd7d07d3defe4f8a403cc..e566eee5638f23f99e801e8f94dfb617fe53c945 100644 (file)
--- a/mode.h
+++ b/mode.h
 #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];
 
index 4d7a4975d362f7394ae034ce5b19fa54e7b35bf5..8548b0d5218f87d6d30565691919039b50c6ca01 100644 (file)
@@ -251,14 +251,12 @@ gpointer new_discover_receive_thread(gpointer data) {
                             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");
index 9ce2c773630c442fd2b2083d79d759739668f287..d354574775f631a8352e5002cf29af696b3c3b23 100644 (file)
@@ -36,9 +36,6 @@
 #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;
@@ -157,7 +153,6 @@ static gboolean rigctl_cb (GtkWidget *widget, GdkEventButton *event, gpointer da
   return TRUE;
 }
 
-#ifdef GPIO
 static gboolean encoder_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
   cleanup();
   fprintf(stderr, "new_menu: calling encoder_menu\n");
@@ -165,15 +160,12 @@ static gboolean encoder_cb (GtkWidget *widget, GdkEventButton *event, gpointer d
   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();
@@ -187,14 +179,6 @@ static gboolean oc_cb (GtkWidget *widget, GdkEventButton *event, gpointer data)
   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);
@@ -531,13 +515,6 @@ void new_menu()
     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);
@@ -586,12 +563,12 @@ void new_menu()
     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
 
 //
index 39835310d2396264620ca3370cfcd086cec98b23..0d8bdc01758d723a448e6bde12422a1bf9d1cecc 100644 (file)
@@ -19,6 +19,9 @@ extern void start_store();
 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);
 
index 6be450cd650c379de8f4eee4f6deae2d44b4908a..ccad0fd30c8aea0fcb0b04b0a1e2c17a73c1ff8a 100644 (file)
@@ -56,9 +56,6 @@
 #include "signal.h"
 #include "vfo.h"
 #include "toolbar.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
 #include "vox.h"
 #include "ext.h"
 #include "iambic.h"
@@ -201,11 +198,6 @@ static long audiosequence;
 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);
@@ -375,7 +367,7 @@ void new_protocol_init(int pixels) {
     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));
@@ -390,7 +382,7 @@ void new_protocol_init(int pixels) {
 #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;
       }
     }
@@ -398,7 +390,7 @@ void new_protocol_init(int pixels) {
 
     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;
       }
     }
@@ -430,10 +422,10 @@ void new_protocol_init(int pixels) {
 #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);
@@ -447,10 +439,10 @@ void new_protocol_init(int pixels) {
 #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);
@@ -464,10 +456,10 @@ void new_protocol_init(int pixels) {
 #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
@@ -481,14 +473,14 @@ void new_protocol_init(int pixels) {
       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
@@ -500,7 +492,7 @@ void new_protocol_init(int pixels) {
 
     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);
     }
 
@@ -510,44 +502,44 @@ void new_protocol_init(int pixels) {
 
     // 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++) {
@@ -559,10 +551,10 @@ g_print("iq_addr=%s\n",inet_ntoa(radio->info.network.address.sin_addr));
     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();
@@ -594,7 +586,7 @@ static void new_protocol_general() {
       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
@@ -608,16 +600,16 @@ static void new_protocol_general() {
       }
     }
 
-//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++;
@@ -645,7 +637,6 @@ static void new_protocol_high_priority() {
     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
@@ -1002,7 +993,7 @@ static void new_protocol_high_priority() {
       // 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;
       }
@@ -1030,7 +1021,7 @@ static void new_protocol_high_priority() {
     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
@@ -1074,7 +1065,7 @@ static void new_protocol_high_priority() {
 
         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);
     }
 
 
@@ -1098,13 +1089,13 @@ static void new_protocol_high_priority() {
 //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++;
@@ -1182,7 +1173,7 @@ static void new_protocol_transmit_specific() {
 
     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
@@ -1194,12 +1185,12 @@ static void new_protocol_transmit_specific() {
 //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++;
@@ -1290,12 +1281,12 @@ static void new_protocol_receive_specific() {
 //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++;
@@ -1309,10 +1300,10 @@ static void new_protocol_start() {
     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);
 
 }
 
@@ -1342,7 +1333,7 @@ static gpointer new_protocol_thread(gpointer data) {
     unsigned char *buffer;
     int bytesread;
 
-fprintf(stderr,"new_protocol_thread\n");
+g_print("new_protocol_thread\n");
 
     micsamples=0;
     iqindex=4;
@@ -1357,7 +1348,7 @@ fprintf(stderr,"new_protocol_thread\n");
         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);
         }
 
@@ -1377,7 +1368,7 @@ fprintf(stderr,"new_protocol_thread\n");
               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]);
@@ -1435,7 +1426,7 @@ fprintf(stderr,"new_protocol_thread\n");
 #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;
         }
@@ -1445,7 +1436,7 @@ fprintf(stderr,"new_protocol_thread: Unknown port %d\n",sourceport);
 }
 
 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);
@@ -1460,7 +1451,7 @@ static gpointer command_response_thread(gpointer data) {
 }
 
 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);
@@ -1475,7 +1466,7 @@ fprintf(stderr,"high_priority_thread\n");
 }
 
 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);
@@ -1497,7 +1488,7 @@ static gpointer iq_thread(gpointer data) {
   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]);
@@ -1513,7 +1504,7 @@ static gpointer iq_thread(gpointer data) {
 //
     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]++;
@@ -1669,7 +1660,7 @@ static void process_ps_iq_data(unsigned char *buffer) {
   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) {
@@ -1695,7 +1686,7 @@ static void process_ps_iq_data(unsigned char *buffer) {
 
     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);
   }
 }
 
@@ -1704,12 +1695,12 @@ static void process_command_response() {
     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
@@ -1725,7 +1716,7 @@ static void process_high_priority(unsigned char *buffer) {
 
     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++;
@@ -1758,7 +1749,7 @@ static void process_high_priority(unsigned char *buffer) {
     }
 
     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));
     }
 }
 
@@ -1771,7 +1762,7 @@ static void process_mic_data(int bytes) {
 
   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++;
@@ -1780,15 +1771,7 @@ static void process_mic_data(int bytes) {
     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);
   }
 }
 
@@ -1817,7 +1800,7 @@ void new_protocol_cw_audio_samples(short left_audio_sample,short right_audio_sam
 
     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++;
@@ -1851,7 +1834,7 @@ void new_protocol_audio_samples(RECEIVER *rx,short left_audio_sample,short right
 
     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++;
@@ -1874,7 +1857,7 @@ void new_protocol_flush_iq_samples() {
 
   // 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;
@@ -1897,7 +1880,7 @@ void new_protocol_iq_samples(int isample,int qsample) {
 
     // 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;
index 2cbb610e481426a3c6314f53c1ce241a0b715a1c..6ae650d3c5dc42832b75fd922c8d302d1785b326 100644 (file)
--- a/oc_menu.c
+++ b/oc_menu.c
@@ -140,30 +140,35 @@ void oc_menu(GtkWidget *parent) {
   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);
@@ -173,33 +178,95 @@ void oc_menu(GtkWidget *parent) {
     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;
@@ -220,7 +287,8 @@ void oc_menu(GtkWidget *parent) {
     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);
@@ -234,7 +302,8 @@ void oc_menu(GtkWidget *parent) {
   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);
index 70f458ed15aae74cd2a95fc98cefff3191f91fe5..f28e313fcde763c309fd2acc4f66e26b466960d3 100644 (file)
@@ -518,18 +518,11 @@ fprintf(stderr,"old_discovery\n");
     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;
     }
index b5b0fdb684c1c1191a9ede0e76c7f2c93c9e097b..fa05f371fca79c4917eca05ef1db6c0a4ec4a29c 100644 (file)
 #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"
@@ -165,13 +159,6 @@ static int current_rx=0;
 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;
@@ -266,13 +253,13 @@ void old_protocol_set_mic_sample_rate(int rate) {
 
 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;
     }
   }
@@ -284,14 +271,14 @@ void old_protocol_init(int rx,int pixels,int rate) {
 // 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  {
@@ -300,14 +287,14 @@ void old_protocol_init(int rx,int pixels,int rate) {
     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;
   }
@@ -324,12 +311,12 @@ void old_protocol_init(int rx,int pixels,int rate) {
 //
 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 );
   }
 }
@@ -350,7 +337,7 @@ static gpointer ozy_ep4_rx_thread(gpointer arg)
 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)
@@ -359,12 +346,12 @@ static gpointer ozy_ep6_rx_thread(gpointer arg) {
 
     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);
     }
@@ -411,6 +398,7 @@ static void open_udp_socket() {
     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
@@ -425,6 +413,7 @@ static void open_udp_socket() {
     }
 
     // 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);
@@ -433,7 +422,7 @@ static void open_udp_socket() {
     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() {
@@ -448,7 +437,7 @@ 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) {
@@ -473,7 +462,7 @@ static void open_tcp_socket() {
       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) {
@@ -485,7 +474,7 @@ 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);
@@ -542,7 +531,7 @@ static gpointer receive_thread(gpointer arg) {
              // 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) {
@@ -567,19 +556,19 @@ static gpointer receive_thread(gpointer arg) {
 */
                   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;
     }
@@ -699,7 +688,6 @@ static long long channel_freq(int chan) {
       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())) {
@@ -778,7 +766,7 @@ static int how_many_receivers() {
     }
   }
 #endif
-  return ret;
+    return ret;
 }
 
 static void process_ozy_input_buffer(unsigned char  *buffer) {
@@ -852,15 +840,15 @@ 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:
@@ -949,15 +937,7 @@ static void process_ozy_input_buffer(unsigned char  *buffer) {
       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;
       }
 
@@ -968,7 +948,7 @@ static void process_ozy_input_buffer(unsigned char  *buffer) {
     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));
 
 
@@ -1212,7 +1192,7 @@ void ozy_send_buffer() {
       // 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;
       }
@@ -1278,6 +1258,7 @@ void ozy_send_buffer() {
         {
         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.
@@ -1295,6 +1276,13 @@ void ozy_send_buffer() {
             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;
@@ -1307,12 +1295,15 @@ void ozy_send_buffer() {
         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
         }
@@ -1400,7 +1391,7 @@ void ozy_send_buffer() {
          // 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
@@ -1537,7 +1528,7 @@ void ozy_send_buffer() {
  * 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;
@@ -1555,7 +1546,7 @@ void ozy_send_buffer() {
 #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]);
 }
 
@@ -1668,7 +1659,7 @@ static void metis_restart() {
     ozy_send_buffer();
   }
 
-  usleep(250000L);
+  usleep(250000);
 
   // start the data flowing
   metis_start_stop(1);
@@ -1721,7 +1712,7 @@ static void metis_start_stop(int command) {
     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
@@ -1737,19 +1728,20 @@ static void metis_send_buffer(unsigned char* buffer,int length) {
 
   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);
   }
 }
index f9601ed974a32711cc77793a299225509353dddd..868ec193c9a5f94f750a170a2862a7252aaac188 100644 (file)
--- a/pa_menu.c
+++ b/pa_menu.c
@@ -34,6 +34,8 @@ static GtkWidget *menu_b=NULL;
 
 static GtkWidget *dialog=NULL;
 
+static GtkWidget *grid2;
+
 static void cleanup() {
   if(dialog!=NULL) {
     gtk_widget_destroy(dialog);
@@ -67,6 +69,94 @@ static void tx_out_of_band_cb(GtkWidget *widget, gpointer data) {
   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;
 
@@ -87,41 +177,120 @@ void pa_menu(GtkWidget *parent) {
 
   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;
 
index 0b95c6948c1bfd1d85392eff8261935e0385520c..923daba31f3e3691da018fd9f5f8e56905965bee 100644 (file)
 *
 */
 
+#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
@@ -37,11 +52,10 @@ void loadProperties(char* filename) {
     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]!='#') {
index 89c8ceacb51cf15b7634c2a09e24d02162678fbb..ae419799b5057a11d570246896c251bfa18067ef 100644 (file)
@@ -34,10 +34,10 @@ struct _PROPERTY {
     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
index a303497aa9f7893d85b47083688bd9bc990e6c8c..5cbf8e711e42d75ef43fd01eb203d479f65c3c4e 100644 (file)
--- a/ps_menu.c
+++ b/ps_menu.c
@@ -43,7 +43,7 @@ static GtkWidget *tx_att;
  * 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
@@ -219,7 +219,7 @@ static int info_thread(gpointer arg) {
       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
          //
diff --git a/psk.c b/psk.c
deleted file mode 100644 (file)
index a2b8280..0000000
--- a/psk.c
+++ /dev/null
@@ -1,157 +0,0 @@
-#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;
-    }
-  }
-}
diff --git a/psk.h b/psk.h
deleted file mode 100644 (file)
index eba9555..0000000
--- a/psk.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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
diff --git a/psk_waterfall.c b/psk_waterfall.c
deleted file mode 100644 (file)
index ba03e50..0000000
+++ /dev/null
@@ -1,310 +0,0 @@
-/* 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;
-}
diff --git a/psk_waterfall.h b/psk_waterfall.h
deleted file mode 100644 (file)
index 648ef34..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 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
diff --git a/radio.c b/radio.c
index 852b11d1bef5114d5fc9324a6a2d0d47e7142d4d..fddced7e810201d5d20eab0484b7b446ca5be0f6 100644 (file)
--- a/radio.c
+++ b/radio.c
 #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;
@@ -105,39 +93,30 @@ static GtkWidget *sliders;
 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];
@@ -164,8 +143,9 @@ int alc=TXA_ALC_AV;
 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;
 
@@ -341,7 +321,7 @@ g_print("radio_stop: RX1: CloseChannel: %d\n",receiver[1]->id);
 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;
@@ -416,7 +396,7 @@ static gboolean menu_cb (GtkWidget *widget, GdkEventButton *event, gpointer data
 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;
@@ -424,6 +404,113 @@ void start_radio() {
   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)
@@ -488,7 +575,7 @@ void start_radio() {
   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__
@@ -725,6 +812,11 @@ void start_radio() {
   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;
@@ -775,22 +867,27 @@ void start_radio() {
   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.
@@ -828,11 +925,11 @@ void start_radio() {
   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);
 
@@ -888,7 +985,7 @@ void start_radio() {
 
   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);
@@ -901,6 +998,8 @@ void start_radio() {
     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);
@@ -916,14 +1015,16 @@ void start_radio() {
 #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
@@ -943,7 +1044,7 @@ void start_radio() {
   }
 
   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;
@@ -969,25 +1070,11 @@ void start_radio() {
   }
 
   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();
   }
@@ -1060,7 +1147,7 @@ void start_radio() {
 }
 
 void disable_rigctl() {
-   fprintf(stderr,"RIGCTL: disable_rigctl()\n");
+   g_print("RIGCTL: disable_rigctl()\n");
    close_rigctl_ports();
 }
  
@@ -1069,7 +1156,7 @@ void radio_change_receivers(int r) {
   // 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
@@ -1123,6 +1210,7 @@ void radio_change_sample_rate(int rate) {
 #ifdef SOAPYSDR
     case SOAPYSDR_PROTOCOL:
       soapy_protocol_change_sample_rate(receiver[0],rate);
+      soapy_protocol_set_mic_sample_rate(rate);
       break;
 #endif
   }
@@ -1133,11 +1221,6 @@ static void rxtx(int state) {
 
   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];
@@ -1163,11 +1246,6 @@ static void rxtx(int state) {
         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);
@@ -1201,11 +1279,6 @@ static void rxtx(int state) {
     } 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);
@@ -1213,11 +1286,6 @@ static void rxtx(int state) {
         set_displaying(receiver[i],1);
       }
     }
-//#ifdef FREEDV
-//    if(active_receiver->freedv) {
-//      gtk_widget_show(audio_waterfall);
-//    }
-//#endif
   }
 
 #ifdef PURESIGNAL
@@ -1265,7 +1333,7 @@ void vox_changed(int state) {
 }
 
 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);
@@ -1486,7 +1554,6 @@ static int calcLevel(double d) {
 
   level=(int)(actual_volts*255.0);
 
-//fprintf(stderr,"calcLevel: %f calib=%f level=%d\n",d, gbb, level);
   return level;
 }
 
@@ -1495,7 +1562,7 @@ void calcDriveLevel() {
     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) {
@@ -1533,11 +1600,6 @@ void set_attenuation(int value) {
       case NEW_PROTOCOL:
         schedule_high_priority();
         break;
-#ifdef SOAPYSDR
-      case SOAPYSDR_PROTOCOL:
-        //soapy_protocol_set_attenuation(value);
-        break;
-#endif
     }
 }
 
@@ -1581,16 +1643,18 @@ void set_alex_attenuation(int v) {
 }
 
 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");
@@ -1617,12 +1681,15 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path);
     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");
@@ -1781,9 +1848,6 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path);
     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);
@@ -1826,7 +1890,7 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path);
 #endif
 
        
-//fprintf(stderr,"sem_post\n");
+//g_print("sem_post\n");
 #ifdef __APPLE__
     sem_post(property_sem);
 #else
@@ -1837,15 +1901,15 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path);
 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);
@@ -1910,6 +1974,15 @@ fprintf(stderr,"radioSaveState: %s\n",property_path);
     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);
@@ -2089,16 +2162,14 @@ fprintf(stderr,"radioSaveState: %s\n",property_path);
     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);
@@ -2107,7 +2178,7 @@ fprintf(stderr,"radioSaveState: %s\n",property_path);
     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
@@ -2129,7 +2200,7 @@ void calculate_display_average(RECEIVER *rx) {
 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);
@@ -2141,7 +2212,7 @@ void set_filter_type(int 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);
@@ -2150,24 +2221,6 @@ void set_filter_size(int 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) {
diff --git a/radio.h b/radio.h
index b91dd5e3c8cc7fc0e12688eca07cd54b64027861..cf79f01ada01cb7c1c98ee03cba874be5d2eebe1 100644 (file)
--- a/radio.h
+++ b/radio.h
 #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;
@@ -81,12 +91,10 @@ extern RECEIVER *active_receiver;
 
 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
@@ -125,7 +133,9 @@ extern int tx_leveler;
 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;
@@ -319,10 +329,6 @@ extern void calculate_display_average();
 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();
index 1c73ce04e8b24a65557c8595078487fd2dc8fcf6..d517c06b68deab40f58c430d907bd60092221aa3 100644 (file)
@@ -157,6 +157,10 @@ static void dac0_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
 */
 #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));
 }
@@ -397,7 +401,8 @@ void radio_menu(GtkWidget *parent) {
 
   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++;
@@ -416,19 +421,21 @@ void radio_menu(GtkWidget *parent) {
   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);
@@ -441,7 +448,8 @@ void radio_menu(GtkWidget *parent) {
   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++;
 
@@ -494,7 +502,8 @@ void radio_menu(GtkWidget *parent) {
 #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++;
 
@@ -555,8 +564,9 @@ void radio_menu(GtkWidget *parent) {
 
     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");
@@ -596,7 +606,8 @@ void radio_menu(GtkWidget *parent) {
 
   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++;
 
@@ -622,7 +633,8 @@ void radio_menu(GtkWidget *parent) {
   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++;
 
@@ -649,7 +661,8 @@ void radio_menu(GtkWidget *parent) {
 #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++;
 
@@ -702,7 +715,7 @@ void radio_menu(GtkWidget *parent) {
 
   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);
@@ -719,6 +732,22 @@ void radio_menu(GtkWidget *parent) {
   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
@@ -726,14 +755,17 @@ void radio_menu(GtkWidget *parent) {
   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);
       }
     }
index 717f15eb811e22a749db381fefc6c06f55f7a634..1f244d3ec7b6df5c0e7ccc66d662d41f110dc977 100644 (file)
 #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;
@@ -104,6 +95,8 @@ gboolean receiver_button_release_event(GtkWidget *widget, GdkEventButton *event,
     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);
@@ -315,11 +308,6 @@ void receiver_save_state(RECEIVER *rx) {
   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) {
@@ -500,11 +488,6 @@ fprintf(stderr,"receiver_restore_state: id=%d\n",rx->id);
   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) {
@@ -574,32 +557,13 @@ static gint update_display(gpointer data) {
     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);
@@ -619,15 +583,6 @@ void set_displaying(RECEIVER *rx,int state) {
 }
 
 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);
 }
@@ -1034,13 +989,6 @@ fprintf(stderr,"create_receiver: id=%d default adc=%d\n",rx->id, rx->adc);
 
   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;
 
@@ -1113,15 +1061,7 @@ fprintf(stderr,"RXASetMP %d\n",rx->low_latency);
 
   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);
@@ -1144,12 +1084,6 @@ fprintf(stderr,"RXASetMP %d\n",rx->low_latency);
   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);
@@ -1215,6 +1149,7 @@ g_print("receiver_change_sample_rate: id=%d rate=%d scale=%d buffer_size=%d outp
   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
 
@@ -1289,78 +1224,6 @@ void receiver_vfo_changed(RECEIVER *rx) {
   //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;
@@ -1376,17 +1239,6 @@ static void process_rx_buffer(RECEIVER *rx) {
       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) {
@@ -1475,18 +1327,8 @@ void full_rx_buffer(RECEIVER *rx) {
     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);
 }
 
index 2a5bd4fbbcc9e4b3e2b6564f10ae8ea2d6e7b547..220fec1e757f5d742ba5027133a036754996df84 100644 (file)
@@ -139,14 +139,6 @@ typedef struct _receiver {
   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;
diff --git a/release/pihpsdr-controller1.v2.0.0-beta.tar b/release/pihpsdr-controller1.v2.0.0-beta.tar
deleted file mode 100644 (file)
index dce9019..0000000
Binary files a/release/pihpsdr-controller1.v2.0.0-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.1-beta.tar b/release/pihpsdr-controller1.v2.0.1-beta.tar
deleted file mode 100644 (file)
index c9b2335..0000000
Binary files a/release/pihpsdr-controller1.v2.0.1-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.2-beta.tar b/release/pihpsdr-controller1.v2.0.2-beta.tar
deleted file mode 100644 (file)
index e99326b..0000000
Binary files a/release/pihpsdr-controller1.v2.0.2-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.3-beta.tar b/release/pihpsdr-controller1.v2.0.3-beta.tar
deleted file mode 100644 (file)
index 3c92636..0000000
Binary files a/release/pihpsdr-controller1.v2.0.3-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.4-beta.tar b/release/pihpsdr-controller1.v2.0.4-beta.tar
deleted file mode 100644 (file)
index 6d393d7..0000000
Binary files a/release/pihpsdr-controller1.v2.0.4-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.5-beta.tar b/release/pihpsdr-controller1.v2.0.5-beta.tar
deleted file mode 100644 (file)
index 19fa14f..0000000
Binary files a/release/pihpsdr-controller1.v2.0.5-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.6-beta.tar b/release/pihpsdr-controller1.v2.0.6-beta.tar
deleted file mode 100644 (file)
index 1b70bbf..0000000
Binary files a/release/pihpsdr-controller1.v2.0.6-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller1.v2.0.7-beta.tar b/release/pihpsdr-controller1.v2.0.7-beta.tar
deleted file mode 100644 (file)
index 748c646..0000000
Binary files a/release/pihpsdr-controller1.v2.0.7-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.0-beta.tar b/release/pihpsdr-controller2-v1.v2.0.0-beta.tar
deleted file mode 100644 (file)
index 4306ffa..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.0-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.1-beta.tar b/release/pihpsdr-controller2-v1.v2.0.1-beta.tar
deleted file mode 100644 (file)
index 42c5970..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.1-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.2-beta.tar b/release/pihpsdr-controller2-v1.v2.0.2-beta.tar
deleted file mode 100644 (file)
index 1fbdbe8..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.2-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.3-beta.tar b/release/pihpsdr-controller2-v1.v2.0.3-beta.tar
deleted file mode 100644 (file)
index 926aa30..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.3-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.4-beta.tar b/release/pihpsdr-controller2-v1.v2.0.4-beta.tar
deleted file mode 100644 (file)
index 38dc603..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.4-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.5-beta.tar b/release/pihpsdr-controller2-v1.v2.0.5-beta.tar
deleted file mode 100644 (file)
index d505e9f..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.5-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.6-beta.tar b/release/pihpsdr-controller2-v1.v2.0.6-beta.tar
deleted file mode 100644 (file)
index 7af1f75..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.6-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v1.v2.0.7-beta.tar b/release/pihpsdr-controller2-v1.v2.0.7-beta.tar
deleted file mode 100644 (file)
index 67c485a..0000000
Binary files a/release/pihpsdr-controller2-v1.v2.0.7-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.0-beta.tar b/release/pihpsdr-controller2-v2.v2.0.0-beta.tar
deleted file mode 100644 (file)
index b8ec84a..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.0-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.1-beta.tar b/release/pihpsdr-controller2-v2.v2.0.1-beta.tar
deleted file mode 100644 (file)
index 6e1c279..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.1-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.2-beta.tar b/release/pihpsdr-controller2-v2.v2.0.2-beta.tar
deleted file mode 100644 (file)
index 876b48e..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.2-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.3-beta.tar b/release/pihpsdr-controller2-v2.v2.0.3-beta.tar
deleted file mode 100644 (file)
index 0f4d584..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.3-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.4-beta.tar b/release/pihpsdr-controller2-v2.v2.0.4-beta.tar
deleted file mode 100644 (file)
index 3d958e9..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.4-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.5-beta.tar b/release/pihpsdr-controller2-v2.v2.0.5-beta.tar
deleted file mode 100644 (file)
index 4929920..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.5-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.6-beta.tar b/release/pihpsdr-controller2-v2.v2.0.6-beta.tar
deleted file mode 100644 (file)
index d8c85c5..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.6-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-controller2-v2.v2.0.7-beta.tar b/release/pihpsdr-controller2-v2.v2.0.7-beta.tar
deleted file mode 100644 (file)
index 4969b8f..0000000
Binary files a/release/pihpsdr-controller2-v2.v2.0.7-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.0-beta.tar b/release/pihpsdr-nocontroller.v2.0.0-beta.tar
deleted file mode 100644 (file)
index fd22479..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.0-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.1-beta.tar b/release/pihpsdr-nocontroller.v2.0.1-beta.tar
deleted file mode 100644 (file)
index d40f2cb..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.1-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.2-beta.tar b/release/pihpsdr-nocontroller.v2.0.2-beta.tar
deleted file mode 100644 (file)
index 128dbda..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.2-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.3-beta.tar b/release/pihpsdr-nocontroller.v2.0.3-beta.tar
deleted file mode 100644 (file)
index 878f99e..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.3-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.4-beta.tar b/release/pihpsdr-nocontroller.v2.0.4-beta.tar
deleted file mode 100644 (file)
index bd2ac0d..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.4-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.5-beta.tar b/release/pihpsdr-nocontroller.v2.0.5-beta.tar
deleted file mode 100644 (file)
index da9fcfa..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.5-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.6-beta.tar b/release/pihpsdr-nocontroller.v2.0.6-beta.tar
deleted file mode 100644 (file)
index cdc109a..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.6-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-nocontroller.v2.0.7-beta.tar b/release/pihpsdr-nocontroller.v2.0.7-beta.tar
deleted file mode 100644 (file)
index e4e2daf..0000000
Binary files a/release/pihpsdr-nocontroller.v2.0.7-beta.tar and /dev/null differ
diff --git a/release/pihpsdr-v2.0.0-beta.tar b/release/pihpsdr-v2.0.0-beta.tar
deleted file mode 100644 (file)
index f46882e..0000000
Binary files a/release/pihpsdr-v2.0.0-beta.tar and /dev/null differ
diff --git a/release/pihpsdr.tar b/release/pihpsdr.tar
deleted file mode 100644 (file)
index f46882e..0000000
Binary files a/release/pihpsdr.tar and /dev/null differ
diff --git a/release/pihpsdr_up.tar b/release/pihpsdr_up.tar
deleted file mode 100644 (file)
index 104343b..0000000
Binary files a/release/pihpsdr_up.tar and /dev/null differ
diff --git a/release/pihpsdr_v1.1.0-beta.tar b/release/pihpsdr_v1.1.0-beta.tar
deleted file mode 100644 (file)
index 9f3d51d..0000000
Binary files a/release/pihpsdr_v1.1.0-beta.tar and /dev/null differ
diff --git a/release/pihpsdr_v1.1.1-beta.tar b/release/pihpsdr_v1.1.1-beta.tar
deleted file mode 100644 (file)
index ad033f6..0000000
Binary files a/release/pihpsdr_v1.1.1-beta.tar and /dev/null differ
diff --git a/release/pihpsdr_v1.1.2-beta.tar b/release/pihpsdr_v1.1.2-beta.tar
deleted file mode 100644 (file)
index 5b906c5..0000000
Binary files a/release/pihpsdr_v1.1.2-beta.tar and /dev/null differ
diff --git a/release/pihpsdr_v1.1.3-beta.tar b/release/pihpsdr_v1.1.3-beta.tar
deleted file mode 100644 (file)
index 5a39d72..0000000
Binary files a/release/pihpsdr_v1.1.3-beta.tar and /dev/null differ
diff --git a/release/tinker.tar b/release/tinker.tar
deleted file mode 100644 (file)
index 99e5ee1..0000000
Binary files a/release/tinker.tar and /dev/null differ
index 5bbf009a5df49a769a4404ef99e753cc7979bf6c..de45624e953ddebb662a5c412f01a80b7ffc02d5 100644 (file)
@@ -138,7 +138,8 @@ void rigctl_menu(GtkWidget *parent) {
   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);
@@ -157,7 +158,8 @@ void rigctl_menu(GtkWidget *parent) {
   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);
@@ -167,7 +169,8 @@ void rigctl_menu(GtkWidget *parent) {
   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);
   
index d6791df3acb4a6f446812fbe1f973e38369e5e87..84e937f5556fb66e8580b427b56250b719c2dc60 100644 (file)
--- a/rx_menu.c
+++ b/rx_menu.c
@@ -210,7 +210,8 @@ void rx_menu(GtkWidget *parent) {
   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");
@@ -252,7 +253,8 @@ void rx_menu(GtkWidget *parent) {
     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++;
       
@@ -306,7 +308,8 @@ void rx_menu(GtkWidget *parent) {
       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++) {
index ea68b99de947849b8d2089602191f5a83ba7cd3a..1b98b8672175e2925af4d7a74664c8dffcd32161 100644 (file)
@@ -37,9 +37,6 @@
 #include "rx_panadapter.h"
 #include "vfo.h"
 #include "mode.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
 #ifdef GPIO
 #include "gpio.h"
 #endif
@@ -123,11 +120,6 @@ void rx_panadapter_update(RECEIVER *rx) {
   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();
@@ -392,7 +384,11 @@ void rx_panadapter_update(RECEIVER *rx) {
 
   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) {
@@ -405,7 +401,11 @@ void rx_panadapter_update(RECEIVER *rx) {
                         / (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) {
@@ -435,36 +435,28 @@ void rx_panadapter_update(RECEIVER *rx) {
   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
index 963a517ed15ff93a7224a22ef869e8bc459db9ee..026cdfd13c1d7b5226c804be4f8029b805024161 100644 (file)
--- a/sliders.c
+++ b/sliders.c
@@ -39,7 +39,6 @@
 #include "sliders.h"
 #include "mode.h"
 #include "filter.h"
-#include "frequency.h"
 #include "bandstack.h"
 #include "band.h"
 #include "discovered.h"
@@ -63,22 +62,26 @@ static int height;
 
 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;
@@ -103,6 +106,7 @@ static GtkWidget *comp_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;
 
@@ -136,9 +140,9 @@ int sliders_active_receiver_changed(void *data) {
     }
     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();
@@ -148,7 +152,7 @@ int sliders_active_receiver_changed(void *data) {
 
 int scale_timeout_cb(gpointer data) {
   gtk_widget_destroy(scale_dialog);
-  scale_status=NONE;
+  scale_status=NO_FUNCTION;
   return FALSE;
 }
 
@@ -160,7 +164,7 @@ static void attenuation_value_changed_cb(GtkWidget *widget, gpointer data) {
     //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));
@@ -172,19 +176,19 @@ void set_attenuation_value(double value) {
   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);
@@ -194,7 +198,11 @@ void set_attenuation_value(double value) {
       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);
@@ -294,16 +302,19 @@ void set_agc_gain(int rx,double value) {
   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);
@@ -327,13 +338,7 @@ void update_agc_gain(double gain) {
 
 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() {
@@ -346,16 +351,19 @@ void set_af_gain(int rx,double value) {
   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);
@@ -396,16 +404,19 @@ void set_rf_gain(int rx,double value) {
   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);
@@ -424,16 +435,19 @@ void set_rf_gain(int rx,double value) {
 }
 
 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);
@@ -450,6 +464,35 @@ void set_filter_width(int rx,int width) {
     }
 }
 
+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) {
@@ -468,13 +511,13 @@ void set_mic_gain(double value) {
       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));
@@ -501,13 +544,13 @@ void set_linein_gain(int value) {
     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));
@@ -539,13 +582,13 @@ void set_drive(double value) {
     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));
@@ -618,15 +661,17 @@ void set_squelch() {
   } 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"));
@@ -653,13 +698,13 @@ void set_compression(TRANSMITTER* tx) {
   } 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));
@@ -685,13 +730,13 @@ void set_compression(TRANSMITTER* tx) {
 
 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));
@@ -712,13 +757,13 @@ void show_diversity_gain() {
 
 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));
@@ -756,6 +801,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
 
   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);
@@ -768,6 +814,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
 
   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);
@@ -775,9 +822,9 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
 
   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"));
@@ -785,12 +832,13 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
   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"));
   
@@ -828,6 +876,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
     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);
@@ -839,6 +888,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
   
     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);
@@ -853,6 +903,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
 
   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);
@@ -872,6 +923,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height);
 
     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);
index bf93e7abd711df5ea342d8d557d2dc25eae85586..f303db1ae899b7ff349a78eb514ca30848dc7471 100644 (file)
--- a/sliders.h
+++ b/sliders.h
@@ -40,6 +40,7 @@ extern void set_drive(double drive);
 //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();
index 4280a7ed6b1d3f01c4f30f609de6bd0e52fc5c5e..9633428ed1e44c3534a9d8ec50518ee4d6ca48ca 100644 (file)
@@ -252,6 +252,7 @@ void soapy_discovery() {
   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++) {
index c39227398b878b40cb3814323531d2c9d977ffb3..a6bd4ea5326fac1d57058a280e52016b6fb46fd8 100644 (file)
 #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"
 
@@ -79,9 +73,9 @@ static int rate_samples;
 
 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;
@@ -104,8 +98,9 @@ void soapy_protocol_create_receiver(RECEIVER *rx) {
   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));
@@ -271,6 +266,7 @@ static void *receive_thread(void *arg) {
   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) {
@@ -291,6 +287,14 @@ fprintf(stderr,"soapy_protocol: receive_thread\n");
         } 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++) {
@@ -301,6 +305,14 @@ fprintf(stderr,"soapy_protocol: receive_thread\n");
         } 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;
+          }
+        }
       }
     }
   }
@@ -314,15 +326,7 @@ fprintf(stderr,"soapy_protocol: receive_thread: SoapySDRDevice_unmake\n");
 }
 
 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) {
index d711fcf24c9f65b26973854d9d4f3697e209f1af..c6c8b36e1772655f228c7e81ae3fb9fa630b62d9 100644 (file)
--- a/soundio.c
+++ b/soundio.c
@@ -219,11 +219,6 @@ fprintf(stderr,"audio_open_input: %d\n",n_selected_input_device);
   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;
@@ -418,11 +413,6 @@ fprintf(stderr,"mic_read_thread: mic_buffer_size=%d\n",mic_buffer_size);
     } 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;
index 0e49c880f424fb54f1a9557718ba977f07a6dc62..14f722e86be48aabecdd731e99dc9fd45c46f77d 100644 (file)
@@ -17,7 +17,6 @@
 *
 */
 
-#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1)
 #include <gtk/gtk.h>
 #include <stdio.h>
 #include <string.h>
@@ -105,6 +104,7 @@ void switch_menu(GtkWidget *parent) {
   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));
@@ -133,255 +133,258 @@ void switch_menu(GtkWidget *parent) {
   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);
 
@@ -389,4 +392,3 @@ void switch_menu(GtkWidget *parent) {
 
   gtk_widget_show_all(dialog);
 }
-#endif
index 409a09425947192a5ba9f536d65a955cc3e29b7e..ecf0e2ec4faf144d7ed66b030b9ec47a7a8cc683 100644 (file)
--- a/toolbar.c
+++ b/toolbar.c
@@ -29,7 +29,6 @@
 #include "toolbar.h"
 #include "mode.h"
 #include "filter.h"
-#include "frequency.h"
 #include "bandstack.h"
 #include "band.h"
 #include "discovered.h"
@@ -276,7 +275,7 @@ static void aswapb_cb (GtkWidget *widget, gpointer data) {
 }
 
 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) {
index 604ed8dec75566cd0280582634b291e2de539f0a..0684dfed9182fbbdcd5ad25e401f2ce729679f33 100644 (file)
 #ifdef SOAPYSDR
 #include "soapy_protocol.h"
 #endif
-#ifdef FREEDV
-#include "freedv.h"
-#endif
-#include "audio_waterfall.h"
 #include "audio.h"
 #include "ext.h"
 
@@ -224,13 +220,6 @@ void transmitter_save_state(TRANSMITTER *tx) {
   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);
@@ -325,11 +314,6 @@ void transmitter_restore_state(TRANSMITTER *tx) {
   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);
@@ -356,20 +340,51 @@ void transmitter_restore_state(TRANSMITTER *tx) {
   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"
@@ -408,10 +423,20 @@ static gboolean update_display(gpointer data) {
     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) {
@@ -431,31 +456,44 @@ static gboolean update_display(gpointer data) {
           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;
@@ -480,10 +518,12 @@ static gboolean update_display(gpointer data) {
           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:
@@ -492,21 +532,23 @@ static gboolean update_display(gpointer data) {
             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;
@@ -520,8 +562,12 @@ static gboolean update_display(gpointer data) {
 #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
@@ -583,7 +629,6 @@ static void init_analyzer(TRANSMITTER *tx) {
    SetDisplayDetectorMode(tx->id, 0, DETECTOR_MODE_PEAK);
    SetDisplayAverageMode(tx->id, 0,  AVERAGE_MODE_NONE);
 
-
 }
 
 void create_dialog(TRANSMITTER *tx) {
@@ -666,6 +711,7 @@ TRANSMITTER *create_transmitter(int id, int buffer_size, int fft_size, int fps,
 
   tx->panadapter_high=0;
   tx->panadapter_low=-60;
+  tx->panadapter_step=10;
 
   tx->displaying=0;
   
@@ -694,11 +740,6 @@ fprintf(stderr,"create_transmitter: id=%d buffer_size=%d mic_sample_rate=%d mic_
   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;
@@ -1245,32 +1286,6 @@ void add_ps_iq_samples(TRANSMITTER *tx, double i_sample_tx,double q_sample_tx, d
 #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) {
index 20c62f38e92f0cdb22f1ff72cdf2f0165fcbc5ad..6b751468e15b0cbeb1ccdafb61a9e37e2aa866e0 100644 (file)
@@ -59,6 +59,7 @@ typedef struct _transmitter {
 
   int panadapter_low;
   int panadapter_high;
+  int panadapter_step;
 
   cairo_surface_t *panadapter_surface;
 
@@ -91,12 +92,6 @@ typedef struct _transmitter {
 
   int drive_level;
  
-#ifdef FREEDV
-  char freedv_text_data[64];
-  int freedv_text_index;
-  int freedv_samples;
-#endif
-
   int compressor;
   double compressor_level;
 
index 5b73ce2ab6a95728b080628b7ac72b40bfcf6e1c..f519912579c52175b736744132aa7fbe89045f84 100644 (file)
--- a/tx_menu.c
+++ b/tx_menu.c
@@ -92,6 +92,10 @@ static void panadapter_low_value_changed_cb(GtkWidget *widget, gpointer data) {
   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);
@@ -259,8 +263,74 @@ void tx_menu(GtkWidget *parent) {
   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);
@@ -268,7 +338,7 @@ void tx_menu(GtkWidget *parent) {
 
     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);
@@ -277,14 +347,6 @@ void tx_menu(GtkWidget *parent) {
     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;
-
   }
 
 
@@ -300,18 +362,12 @@ void tx_menu(GtkWidget *parent) {
   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);
@@ -319,6 +375,14 @@ void tx_menu(GtkWidget *parent) {
 
   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);
@@ -343,39 +407,8 @@ void tx_menu(GtkWidget *parent) {
 
   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
@@ -384,16 +417,8 @@ void tx_menu(GtkWidget *parent) {
 
   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
@@ -402,16 +427,44 @@ void tx_menu(GtkWidget *parent) {
 
   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
@@ -427,7 +480,7 @@ void tx_menu(GtkWidget *parent) {
   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);
@@ -436,7 +489,7 @@ void tx_menu(GtkWidget *parent) {
   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);
@@ -451,7 +504,7 @@ void tx_menu(GtkWidget *parent) {
   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);
@@ -460,9 +513,10 @@ void tx_menu(GtkWidget *parent) {
   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
index b7dae9904de120d6a5a347c2c16d72598e065902..c14f93c5e5b27840060df8e6083c562a47852e1a 100644 (file)
@@ -35,9 +35,6 @@
 #include "tx_panadapter.h"
 #include "vfo.h"
 #include "mode.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
 #ifdef GPIO
 #include "gpio.h"
 #endif
@@ -186,6 +183,7 @@ void tx_panadapter_update(TRANSMITTER *tx) {
   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();
 
@@ -220,7 +218,7 @@ void tx_panadapter_update(TRANSMITTER *tx) {
 
   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);
@@ -351,35 +349,33 @@ void tx_panadapter_update(TRANSMITTER *tx) {
   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);
@@ -403,7 +399,11 @@ void tx_panadapter_update(TRANSMITTER *tx) {
     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);
 
@@ -414,6 +414,16 @@ void tx_panadapter_update(TRANSMITTER *tx) {
     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);
index a6762d409026228a35706911a023b06f31686713..dab40955df69f2e2b29c0cc348ff3bc8d3ce5f84 100644 (file)
--- a/version.c
+++ b/version.c
 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
+
+;
diff --git a/vfo.c b/vfo.c
index 598900faba3d27c9650ffa5b5910da2760ba3b60..fd631fed2a61077e9a2ce9bea6a4e995c8af5ba9 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -38,7 +38,6 @@
 #include "filter.h"
 #include "bandstack.h"
 #include "band.h"
-#include "frequency.h"
 #include "new_protocol.h"
 #include "property.h"
 #include "radio.h"
@@ -50,9 +49,6 @@
 #include "new_menu.h"
 #include "rigctl.h"
 #include "ext.h"
-#ifdef FREEDV
-#include "freedv.h"
-#endif
 
 static GtkWidget *parent_window;
 static int my_width;
@@ -196,23 +192,28 @@ void vfo_restore_state() {
   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);
@@ -363,7 +364,7 @@ void vfo_bandstack_changed(int b) {
   }
 
   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.
@@ -406,7 +407,7 @@ void vfo_mode_changed(int m) {
       break;
   }
   if(can_transmit) {
-      tx_set_mode(transmitter,get_tx_mode());
+    tx_set_mode(transmitter,get_tx_mode());
   }
   //
   // changing modes may change BFO frequency
@@ -827,23 +828,12 @@ void vfo_update() {
             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:
@@ -854,7 +844,7 @@ void vfo_update() {
           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);
@@ -864,9 +854,6 @@ void vfo_update() {
 
        // 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
 
@@ -875,9 +862,7 @@ void vfo_update() {
 
         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);
index 8744a27f6ef9ac8b7a9577bece536add10f2181f..209873d7603269b4cd66860272ca07ac95204c73 100644 (file)
@@ -35,9 +35,6 @@
 #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;
@@ -183,12 +180,6 @@ static void vfo_cb(GtkComboBox *widget,gpointer data) {
   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)));
@@ -306,13 +297,6 @@ void vfo_menu(GtkWidget *parent) {
   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");
index 4b101147cf635aa15006e9084913590fdb060783..5bba3ee9542a0d2aab960b7e22f58fa200e39d04 100644 (file)
@@ -176,7 +176,8 @@ void vox_menu(GtkWidget *parent) {
   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);
@@ -186,24 +187,28 @@ void vox_menu(GtkWidget *parent) {
   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);
index c9ce2e6948d7de339b62ba708ffc38b753a5cbde..805ded78ca6672bcc18ce07cee2800c6855c72ae 100644 (file)
@@ -237,23 +237,23 @@ fprintf(stderr,"xvtr_menu\n");
   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);
 
 
@@ -293,22 +293,6 @@ fprintf(stderr,"xvtr_menu\n");
     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);