From: John Melton G0ORX Date: Fri, 25 Oct 2019 16:43:07 +0000 (+0100) Subject: Changed button debounce for original controller. Changed band menu display to only... X-Git-Url: https://git.rkrishnan.org/Site/listings/$sch_link?a=commitdiff_plain;h=00536e8a702c73bd3a3cdeac90d7e2287edbb384;p=pihpsdr.git Changed button debounce for original controller. Changed band menu display to only display valid bands for device. Cleaneup depending on the different controllers. Updated Makefile. Included built libraries for SoapySDR and files for LimeSDR and RTL-SDR. Created tar files for installing binary for version of code on Raspberry Pi with no controller, original controller, controller 2 v1 (single encoders), controller2 v2 (dual encoders). --- diff --git a/Makefile b/Makefile index f7f7a39..1d17bb3 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,40 @@ # Get git commit version and date -#GIT_VERSION := $(shell git --no-pager describe --tags --always --dirty) GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only)) GIT_VERSION := $(shell git describe --abbrev=0 --tags) -# uncomment the line below to include CONTROLLER2 (Also include GPIO and I2C) -#CONTROLLER2_INCLUDE=CONTROLLER2 - -# uncomment the line below to include GPIO +# uncomment the line below to include GPIO (For original piHPSDR Controller and Controller2) GPIO_INCLUDE=GPIO -# uncomment the line below to include MCP23017 I2C +# uncomment the line below to include MCP23017 I2C (required for Controller2) #I2C_INCLUDE=I2C +# uncomment the line below to include CONTROLLER2_V1 (single encoders) (Also uncomment GPIO and I2C) +#CONTROLLER2_V1_INCLUDE=CONTROLLER2_V1 + +# uncomment the line below to include CONTROLLER2_V2 (dual encoders) (Also uncomment GPIO and I2C) +#CONTROLLER2_V2_INCLUDE=CONTROLLER2_V2 + # uncomment the line below to include USB Ozy support # USBOZY_INCLUDE=USBOZY +# uncomment the line below to include Pure Signal support +PURESIGNAL_INCLUDE=PURESIGNAL + +# uncomment the line to below include support local CW keyer +#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 below to include Pure Signal support -PURESIGNAL_INCLUDE=PURESIGNAL - # uncomment the line to below include support for sx1509 i2c expander #SX1509_INCLUDE=sx1509 -# uncomment the line to below include support local CW keyer -#LOCALCW_INCLUDE=LOCALCW - # uncomment the line below to include support for STEMlab discovery (WITH AVAHI) #STEMLAB_DISCOVERY=STEMLAB_DISCOVERY @@ -42,21 +47,20 @@ PURESIGNAL_INCLUDE=PURESIGNAL # uncomment the line below to include MIDI support MIDI_INCLUDE=MIDI -#uncomment the line below for the platform being compiled on (actually not used) -UNAME_N=raspberrypi -#UNAME_N=odroid -#UNAME_N=up -#UNAME_N=pine64 -#UNAME_N=jetsen - -CC=gcc -LINK=gcc +# 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 -ifeq ($(CONTROLLER2_INCLUDE),CONTROLLER2) -CONTROLLER2_OPTIONS=-D CONTROLLER2 +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) @@ -102,15 +106,10 @@ ozyio.o endif -# uncomment the line below when Radioberry radio cape is plugged in (for now use emulator and old protocol) -#RADIOBERRY_INCLUDE=RADIOBERRY ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY) RADIOBERRY_OPTIONS=-D RADIOBERRY endif -# uncomment the line below for SoapySDR -#SOAPYSDR_INCLUDE=SOAPYSDR - ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR) SOAPYSDR_OPTIONS=-D SOAPYSDR SOAPYSDRLIBS=-lSoapySDR @@ -471,6 +470,23 @@ release: $(PROGRAM) cd release; tar cvf pihpsdr.tar pihpsdr cd release; tar cvf pihpsdr-$(GIT_VERSION).tar pihpsdr +nocontroller: clean controller1 $(PROGRAM) + cp $(PROGRAM) release/pihpsdr + cd release; tar cvf pihpsdr-nocontroller.$(GIT_VERSION).tar pihpsdr + +controller1: clean $(PROGRAM) + cp $(PROGRAM) release/pihpsdr + cd release; tar cvf pihpsdr-controller1.$(GIT_VERSION).tar pihpsdr + +controller2v1: clean $(PROGRAM) + cp $(PROGRAM) release/pihpsdr + cd release; tar cvf pihpsdr-controller2-v1.$(GIT_VERSION).tar pihpsdr + +controller2v2: clean $(PROGRAM) + cp $(PROGRAM) release/pihpsdr + cd release; tar cvf pihpsdr-controller2-v2.$(GIT_VERSION).tar pihpsdr + + ############################################################################# # # hpsdrsim is a cool program that emulates an SDR board with UDP and TCP diff --git a/band.c b/band.c index 3c0eeef..2d6eb8e 100644 --- a/band.c +++ b/band.c @@ -277,7 +277,7 @@ BAND bands[BANDS+XVTRS] = {"10",&bandstack10,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,28000000LL,29700000LL,0LL,0LL,0}, {"6",&bandstack6,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,50000000LL,54000000LL,0LL,0LL,0}, #ifdef SOAPYSDR - {"70",&bandstack70,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0}, + {"4",&bandstack144,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,70000000LL,70500000LL,0LL,0LL,0}, {"144",&bandstack144,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,144000000LL,148000000LL,0LL,0LL,0}, {"220",&bandstack144,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,222000000LL,224980000LL,0LL,0LL,0}, {"430",&bandstack430,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,420000000LL,450000000LL,0LL,0LL,0}, @@ -285,7 +285,7 @@ BAND bands[BANDS+XVTRS] = {"1240",&bandstack1240,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,1240000000LL,1300000000LL,0LL,0LL,0}, {"2300",&bandstack2300,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,2300000000LL,2450000000LL,0LL,0LL,0}, {"3400",&bandstack3400,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,3400000000LL,3410000000LL,0LL,0LL,0}, - {"AIR",&bandstackAIR,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0}, + {"AIR",&bandstack3400,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,108000000LL,137000000LL,0LL,0LL,0}, #endif {"GEN",&bandstackGEN,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0}, {"WWV",&bandstackWWV,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0}, diff --git a/band_menu.c b/band_menu.c index bde4957..0b61a8b 100644 --- a/band_menu.c +++ b/band_menu.c @@ -69,7 +69,7 @@ gboolean band_select_cb (GtkWidget *widget, gpointer data) { void band_menu(GtkWidget *parent) { GtkWidget *b; - int i; + int i,j; BAND *band; parent_window=parent; @@ -102,27 +102,30 @@ void band_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); - for(i=0;i=band70 && i<=band3400) { - continue; - } - } -#endif + long long frequency_min=radio->frequency_min; + long long frequency_max=radio->frequency_max; + j=0; + for(i=0;ititle)>0) { + if(ifrequencyMin==0.0 && band->frequencyMax==0.0)) { + if(band->frequencyMinfrequencyMax>frequency_max) { + continue; + } + } + } GtkWidget *b=gtk_button_new_with_label(band->title); set_button_text_color(b,"black"); - //if(i==band_get_current()) { if(i==vfo[active_receiver->id].band) { set_button_text_color(b,"orange"); last_band=b; } gtk_widget_show(b); - gtk_grid_attach(GTK_GRID(grid),b,i%5,1+(i/5),1,1); + gtk_grid_attach(GTK_GRID(grid),b,j%5,1+(j/5),1,1); g_signal_connect(b,"clicked",G_CALLBACK(band_select_cb),(gpointer)(long)i); + j++; } } diff --git a/configure.c b/configure.c index 9ac48f1..e0d0462 100644 --- a/configure.c +++ b/configure.c @@ -62,7 +62,7 @@ static GtkWidget *E4_a; static GtkWidget *E4_b_label; static GtkWidget *E4_b; static GtkWidget *b_enable_E4_pullup; -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1) static GtkWidget *b_enable_E5_encoder; static GtkWidget *E5_a_label; static GtkWidget *E5_a; @@ -316,7 +316,7 @@ void configure_gpio(GtkWidget *parent) { gtk_widget_show(b_enable_E4_pullup); gtk_grid_attach(GTK_GRID(grid),b_enable_E4_pullup,5,y,1,1); -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1) y++; b_enable_E5_encoder=gtk_check_button_new_with_label("Enable E5"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_enable_E5_encoder), ENABLE_E5_ENCODER); @@ -348,7 +348,7 @@ void configure_gpio(GtkWidget *parent) { #endif -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V2) && !defined(CONTROLLER2_V1) y++; b_enable_mox=gtk_check_button_new_with_label("Enable MOX/TUN"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_enable_mox), ENABLE_MOX_BUTTON); @@ -403,7 +403,7 @@ void configure_gpio(GtkWidget *parent) { y++; -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) b_enable_S2=gtk_check_button_new_with_label("Enable S2"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_enable_S2), ENABLE_S2_BUTTON); gtk_widget_show(b_enable_S2); @@ -437,7 +437,7 @@ void configure_gpio(GtkWidget *parent) { y++; -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) b_enable_S3=gtk_check_button_new_with_label("Enable S3"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_enable_S3), ENABLE_S3_BUTTON); gtk_widget_show(b_enable_S3); @@ -470,7 +470,7 @@ void configure_gpio(GtkWidget *parent) { #endif y++; -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) b_enable_S4=gtk_check_button_new_with_label("Enable S4"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_enable_S4), ENABLE_S4_BUTTON); gtk_widget_show(b_enable_S4); diff --git a/encoder_menu.c b/encoder_menu.c index 83d89ba..acf99a7 100644 --- a/encoder_menu.c +++ b/encoder_menu.c @@ -32,7 +32,7 @@ #include "vfo.h" #include "button_text.h" #include "gpio.h" -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER_V1) #include "i2c.h" #endif @@ -58,7 +58,7 @@ static GtkWidget *b_panadapter_low; static GtkWidget *b_squelch; static GtkWidget *b_compression; -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 static GtkWidget *b_top_af_gain_rx1; static GtkWidget *b_top_af_gain_rx2; static GtkWidget *b_top_agc_gain_rx1; @@ -80,23 +80,25 @@ static GtkWidget *b_top_compression; enum { ENC2, -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 ENC2_TOP, #endif ENC2_SW, ENC3, -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 ENC3_TOP, #endif ENC3_SW, ENC4, -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 ENC4_TOP, #endif ENC4_SW, -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1) ENC5, +#if defined (CONTROLLER2_V2) ENC5_TOP, +#endif ENC5_SW, #endif }; @@ -134,7 +136,7 @@ static void enc_select_cb(GtkWidget *widget,gpointer data) { case ENC2: e2_encoder_action=choice->action; break; -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 case ENC2_TOP: e2_top_encoder_action=choice->action; break; @@ -142,7 +144,7 @@ static void enc_select_cb(GtkWidget *widget,gpointer data) { case ENC3: e3_encoder_action=choice->action; break; -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 case ENC3_TOP: e3_top_encoder_action=choice->action; break; @@ -150,15 +152,17 @@ static void enc_select_cb(GtkWidget *widget,gpointer data) { case ENC4: e4_encoder_action=choice->action; break; -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 case ENC4_TOP: e4_top_encoder_action=choice->action; break; #endif -#ifdef CONTROLLER2 +#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; @@ -205,7 +209,7 @@ static void sw_select_cb(GtkWidget *widget,gpointer data) { case ENC4_SW: e4_sw_action=choice->action; break; -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 case ENC5_SW: e5_sw_action=choice->action; break; @@ -297,7 +301,7 @@ GtkWidget* getRadioButton(int action) { return button; } -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 GtkWidget* getTopRadioButton(int action) { GtkWidget* button; switch(action) { @@ -379,7 +383,7 @@ static gboolean select_cb (GtkWidget *widget, gpointer data) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); } -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 static gboolean top_select_cb (GtkWidget *widget, gpointer data) { GtkWidget *button; int action; @@ -456,7 +460,7 @@ void encoder_select(int pos) { } -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 void top_encoder_select(int pos) { int action; GtkWidget *button; @@ -543,7 +547,7 @@ void top_encoder_select(int pos) { } } -#ifdef CONTROLLER2 +#ifdef CONTROLLER2_V2 static gboolean top_action_select_cb (GtkWidget *widget, gpointer data) { int action=(int)data; switch(encoder) { @@ -599,7 +603,7 @@ void top_encoder_select(int pos) { return TRUE; } -#ifdef CONTROLLER2 +#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; @@ -665,13 +669,19 @@ void encoder_menu(GtkWidget *parent) { row++; col=1; -#ifdef CONTROLLER2 +#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"); gtk_grid_attach(GTK_GRID(grid),label_encoder,col,row,1,1); @@ -693,7 +703,7 @@ void encoder_menu(GtkWidget *parent) { g_signal_connect(enc2,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC2)); col++; -#ifdef CONTROLLER2 +#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)); @@ -716,7 +726,7 @@ void encoder_menu(GtkWidget *parent) { g_signal_connect(enc3,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC3)); col++; -#ifdef CONTROLLER2 +#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)); @@ -739,7 +749,7 @@ void encoder_menu(GtkWidget *parent) { g_signal_connect(enc4,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC4)); col++; -#ifdef CONTROLLER2 +#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)); @@ -753,7 +763,7 @@ void encoder_menu(GtkWidget *parent) { row++; col=0; -#ifdef CONTROLLER2 +#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++; @@ -763,10 +773,12 @@ void encoder_menu(GtkWidget *parent) { g_signal_connect(enc5,"button_press_event",G_CALLBACK(enc_cb),GINT_TO_POINTER(ENC5)); col++; +#ifdef CONTROLLER2 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 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); @@ -779,229 +791,3 @@ void encoder_menu(GtkWidget *parent) { gtk_widget_show_all(dialog); } - -/* -void encoder_menu(GtkWidget *parent,int e) { - GtkWidget *b; - int i; - BAND *band; - - encoder=e; - - int encoder_action; -#ifdef CONTROLLER2 - int top_encoder_action; -#endif - switch(encoder) { - case 2: - encoder_action=e2_encoder_action; - break; - case 3: - encoder_action=e3_encoder_action; - break; - case 4: - encoder_action=e4_encoder_action; - break; -#ifdef CONTROLLER2 - case 5: - encoder_action=e5_encoder_action; - break; -#endif - } -#ifdef CONTROLLER2 - switch(encoder) { - case 2: - top_encoder_action=e2_top_encoder_action; - break; - case 3: - top_encoder_action=e3_top_encoder_action; - break; - case 4: - top_encoder_action=e4_top_encoder_action; - break; - case 5: - top_encoder_action=e5_top_encoder_action; - break; - } -#endif - - parent_window=parent; - - dialog=gtk_dialog_new(); - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window)); - //gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE); - char title[32]; - sprintf(title,"piHPSDR - Encoder E%d Action:",encoder); - gtk_window_set_title(GTK_WINDOW(dialog),title); - g_signal_connect (dialog, "delete_event", G_CALLBACK (delete_event), NULL); - - GdkRGBA color; - color.red = 1.0; - color.green = 1.0; - color.blue = 1.0; - color.alpha = 1.0; - gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color); - - GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - - GtkWidget *grid=gtk_grid_new(); - - gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); - gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE); - gtk_grid_set_column_spacing (GTK_GRID(grid),5); - gtk_grid_set_row_spacing (GTK_GRID(grid),5); - - int row=0; - int col=0; - - 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,col,row,1,1); - - row++; - col=0; - -#ifdef CONTROLLER2 - GtkWidget *bottom_title=gtk_label_new("Bottom"); - gtk_grid_attach(GTK_GRID(grid),bottom_title,col,row,4,1); - - row++; - col=0; -#endif - - b_af_gain_rx1=gtk_radio_button_new_with_label(NULL,"AF Gain RX1"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_af_gain_rx1), encoder_action==ENCODER_AF_GAIN_RX1); - gtk_widget_show(b_af_gain_rx1); - gtk_grid_attach(GTK_GRID(grid),b_af_gain_rx1,col,row,2,1); - g_signal_connect(b_af_gain_rx1,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_AF_GAIN_RX1); - - row++; - - b_af_gain_rx2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_af_gain_rx1),"AF Gain RX2"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_af_gain_rx2), encoder_action==ENCODER_AF_GAIN_RX2); - gtk_widget_show(b_af_gain_rx2); - gtk_grid_attach(GTK_GRID(grid),b_af_gain_rx2,col,row,2,1); - g_signal_connect(b_af_gain_rx2,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_AF_GAIN_RX2); - - row++; - - b_agc_gain_rx1=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_af_gain_rx2),"AGC Gain RX1"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_agc_gain_rx1), encoder_action==ENCODER_AGC_GAIN_RX1); - gtk_widget_show(b_agc_gain_rx1); - gtk_grid_attach(GTK_GRID(grid),b_agc_gain_rx1,col,row,2,1); - g_signal_connect(b_agc_gain_rx1,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_AGC_GAIN_RX1); - - row++; - - b_agc_gain_rx2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_agc_gain_rx1),"AGC Gain RX2"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_agc_gain_rx2), encoder_action==ENCODER_AGC_GAIN_RX2); - gtk_widget_show(b_agc_gain_rx2); - gtk_grid_attach(GTK_GRID(grid),b_agc_gain_rx2,col,row,2,1); - g_signal_connect(b_agc_gain_rx2,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_AGC_GAIN_RX2); - - row++; -#ifdef RADIOBERRY - b_attenuation=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_agc_gain_rx2),"RX GAIN"); -#else - b_attenuation=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_agc_gain_rx2),"Attenuation"); -#endif - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_attenuation), encoder_action==ENCODER_ATTENUATION); - gtk_widget_show(b_attenuation); - gtk_grid_attach(GTK_GRID(grid),b_attenuation,col,row,2,1); - g_signal_connect(b_attenuation,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_ATTENUATION); - - row++; - - b_mic_gain=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_attenuation),"Mic Gain"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_mic_gain), encoder_action==ENCODER_MIC_GAIN); - gtk_widget_show(b_mic_gain); - gtk_grid_attach(GTK_GRID(grid),b_mic_gain,col,row,2,1); - g_signal_connect(b_mic_gain,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_MIC_GAIN); - - row++; - - b_drive=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_mic_gain),"Drive"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_drive), encoder_action==ENCODER_DRIVE); - gtk_widget_show(b_drive); - gtk_grid_attach(GTK_GRID(grid),b_drive,col,row,2,1); - g_signal_connect(b_drive,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_DRIVE); - - b_xit=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_drive),"XIT"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_xit), encoder_action==ENCODER_XIT); - gtk_widget_show(b_xit); - gtk_grid_attach(GTK_GRID(grid),b_xit,col,row,2,1); - g_signal_connect(b_xit,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_XIT); - - col++; - row=1; - - b_rit_rx1=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_drive),"RIT RX1"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_rit_rx1), encoder_action==ENCODER_RIT_RX1); - gtk_widget_show(b_rit_rx1); - gtk_grid_attach(GTK_GRID(grid),b_rit_rx1,col,row,2,1); - g_signal_connect(b_rit_rx1,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_RIT_RX1); - - row++; - - b_rit_rx2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_rit_rx1),"RIT RX2"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_rit_rx2), encoder_action==ENCODER_RIT_RX2); - gtk_widget_show(b_rit_rx2); - gtk_grid_attach(GTK_GRID(grid),b_rit_rx2,col,row,2,1); - g_signal_connect(b_rit_rx2,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_RIT_RX2); - - row++; - - b_cw_speed=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_rit_rx2),"CW Speed"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_cw_speed), encoder_action==ENCODER_CW_SPEED); - gtk_widget_show(b_cw_speed); - gtk_grid_attach(GTK_GRID(grid),b_cw_speed,col,row,2,1); - g_signal_connect(b_cw_speed,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_CW_SPEED); - - row++; - - b_cw_frequency=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_cw_speed),"CW Freq"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_cw_frequency), encoder_action==ENCODER_CW_FREQUENCY); - gtk_widget_show(b_cw_frequency); - gtk_grid_attach(GTK_GRID(grid),b_cw_frequency,col,row,2,1); - g_signal_connect(b_cw_frequency,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_CW_FREQUENCY); - - row++; - - b_panadapter_high=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_cw_frequency),"Panadapter High"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_panadapter_high), encoder_action==ENCODER_PANADAPTER_HIGH); - gtk_widget_show(b_panadapter_high); - gtk_grid_attach(GTK_GRID(grid),b_panadapter_high,col,row,2,1); - g_signal_connect(b_panadapter_high,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_PANADAPTER_HIGH); - - row++; - - b_panadapter_low=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_panadapter_high),"Panadapter Low"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_panadapter_low), encoder_action==ENCODER_PANADAPTER_LOW); - gtk_widget_show(b_panadapter_low); - gtk_grid_attach(GTK_GRID(grid),b_panadapter_low,col,row,2,1); - g_signal_connect(b_panadapter_low,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_PANADAPTER_LOW); - - row++; - - b_squelch=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_panadapter_low),"Squelch"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_squelch), encoder_action==ENCODER_SQUELCH); - gtk_widget_show(b_squelch); - gtk_grid_attach(GTK_GRID(grid),b_squelch,col,row,2,1); - g_signal_connect(b_squelch,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_SQUELCH); - - row++; - - b_compression=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_squelch),"COMP"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_compression), encoder_action==ENCODER_COMP); - gtk_widget_show(b_compression); - gtk_grid_attach(GTK_GRID(grid),b_compression,col,row,2,1); - g_signal_connect(b_compression,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_COMP); - - gtk_container_add(GTK_CONTAINER(content),grid); - - sub_menu=dialog; - - gtk_widget_show_all(dialog); - -} -*/ diff --git a/ext.c b/ext.c index 0d68f25..972e8da 100644 --- a/ext.c +++ b/ext.c @@ -343,21 +343,53 @@ int ext_snb_update(void *data) { } int ext_band_plus(void *data) { + long long frequency_min=radio->frequency_min; + long long frequency_max=radio->frequency_max; int id=active_receiver->id; int b=vfo[id].band; - b++; - if(b>=BANDS) b=0; - vfo_band_changed(b); + BAND *band; + int found=0; + while(!found) { + b++; + if(b>=BANDS+XVTRS) b=0; + band=(BAND*)band_get_band(b); + if(strlen(band->title)>0) { + if(bfrequencyMin==0.0 && band->frequencyMax==0.0)) { + if(band->frequencyMinfrequencyMax>frequency_max) { + continue; + } + } + } + vfo_band_changed(b); + found=1; + } + } return 0; } int ext_band_minus(void *data) { + long long frequency_min=radio->frequency_min; + long long frequency_max=radio->frequency_max; int id=active_receiver->id; int b=vfo[id].band; - b--; - if(b<0) b=BANDS-1; - vfo_band_changed(b); + BAND *band; + int found=0; + while(!found) { + b--; + if(b<0) b=BANDS+XVTRS-1; + band=(BAND*)band_get_band(b); + if(strlen(band->title)>0) { + if(bfrequencyMinfrequencyMax>frequency_max) { + continue; + } + } + vfo_band_changed(b); + found=1; + } + } return 0; } diff --git a/gpio.c b/gpio.c index 040a1c4..2f17b94 100644 --- a/gpio.c +++ b/gpio.c @@ -52,7 +52,7 @@ #include "encoder_menu.h" #include "diversity_menu.h" #include "gpio.h" -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined(CONTROLLER2_V1) #include "i2c.h" #endif #include "ext.h" @@ -63,20 +63,51 @@ #endif // debounce settle time in ms -#define DEFAULT_SETTLE_TIME 150 +#define DEFAULT_SETTLE_TIME 50 int settle_time=DEFAULT_SETTLE_TIME; static gint release_timer=-1; -#ifdef CONTROLLER2 +#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 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; -#ifdef VFO_HAS_FUNCTION -int VFO_FUNCTION=12; -#endif int ENABLE_E2_ENCODER=1; int ENABLE_E2_PULLUP=1; int E2_ENCODER_A=21; @@ -112,8 +143,9 @@ int ENABLE_E4_BUTTON=1; int ENABLE_E5_BUTTON=1; int I2C_INTERRUPT=16; +#endif -#else +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) // uses wiringpi pin numbers int ENABLE_VFO_ENCODER=1; int ENABLE_VFO_PULLUP=1; @@ -167,7 +199,22 @@ int CW_ACTIVE_LOW=1; int vfoEncoderPos; int vfoFunction; -#ifdef CONTROLLER2 +#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; @@ -177,19 +224,23 @@ int e3_encoder_action=ENCODER_AGC_GAIN_RX2; int e4EncoderPos; int e4_sw_action=MENU_FILTER; int e4_encoder_action=ENCODER_IF_WIDTH_RX2; +int e5EncoderPos; +int e5_sw_action=MENU_FREQUENCY; +int e5_encoder_action=ENCODER_DRIVE; +#endif + +#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 e3TopEncoderPos; int e4TopEncoderPos; - -int e5_encoder_action=ENCODER_DRIVE; -int e5_top_encoder_action=ENCODER_TUNE_DRIVE; -int e5EncoderPos; int e5TopEncoderPos; -int e5_sw_action=MENU_FREQUENCY; -#else +#endif + +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) int e2EncoderPos; int e2_sw_action=RIT; int e2_encoder_action=ENCODER_AF_GAIN_RX1; @@ -293,12 +344,12 @@ char *sw_string[SWITCH_ACTIONS] = { "FREQUENCY MENU", "MEMORY MENU", "DIVERSITY MENU", -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) "FUNCTION", #endif }; -#ifdef CONTROLLER2 +#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 @@ -500,7 +551,7 @@ fprintf(stderr,"e_function_pressed: %d\n",action); case MENU_DIVERSITY: g_idle_add(ext_diversity_update,GINT_TO_POINTER(1)); break; -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V1) && !defined (CONTROLLER2_V2) case FUNCTION: g_idle_add(ext_function_update,NULL); break; @@ -536,7 +587,7 @@ static void e4FunctionAlert() { } } -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1) static unsigned long e5debounce=0; static void e5FunctionAlert() { @@ -547,216 +598,160 @@ static void e5FunctionAlert() { } #endif -#ifndef CONTROLLER2 +#if !defined (CONTROLLER2_V2) && !defined (CONTROLLER2_V1) +static int function_level=1; static unsigned long function_debounce=0; static void functionAlert() { int t=millis(); - if(t-function_debounce > settle_time) { - int level=digitalRead(FUNCTION_BUTTON); + if(millis() settle_time) { - int level=digitalRead(S1_BUTTON); + if(millis() settle_time) { - int level=digitalRead(S2_BUTTON); + if(millis() settle_time) { - int level=digitalRead(S3_BUTTON); + if(millis() settle_time) { - int level=digitalRead(S4_BUTTON); + if(millis() settle_time) { - int level=digitalRead(S5_BUTTON); + if(millis() settle_time) { - int level=digitalRead(S6_BUTTON); + if(millis() settle_time) { - int level=digitalRead(MOX_BUTTON); + if(millis()device==SOAPYSDR_USB_DEVICE) { adc[0].rx_gain=malloc(radio->info.soapy.rx_gains*sizeof(gint)); for (size_t i = 0; i < radio->info.soapy.rx_gains; i++) { @@ -692,9 +711,9 @@ void start_radio() { //fprintf(stderr,"meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration); -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1) display_sliders=0; - display_toolbar=1; + display_toolbar=0; #else display_sliders=1; display_toolbar=1; @@ -836,12 +855,6 @@ void start_radio() { #endif } - - -//#ifdef I2C -// i2c_init(); -//#endif - if(display_sliders) { //fprintf(stderr,"create sliders\n"); sliders = sliders_init(display_width,SLIDERS_HEIGHT); diff --git a/release/pihpsdr-controller1.v2.0.0-beta.tar b/release/pihpsdr-controller1.v2.0.0-beta.tar new file mode 100644 index 0000000..0ce5acb Binary files /dev/null and b/release/pihpsdr-controller1.v2.0.0-beta.tar differ diff --git a/release/pihpsdr-controller2-v1.v2.0.0-beta.tar b/release/pihpsdr-controller2-v1.v2.0.0-beta.tar new file mode 100644 index 0000000..77b4d10 Binary files /dev/null and b/release/pihpsdr-controller2-v1.v2.0.0-beta.tar differ diff --git a/release/pihpsdr-controller2-v2.v2.0.0-beta.tar b/release/pihpsdr-controller2-v2.v2.0.0-beta.tar new file mode 100644 index 0000000..98c0b40 Binary files /dev/null and b/release/pihpsdr-controller2-v2.v2.0.0-beta.tar differ diff --git a/release/pihpsdr-nocontroller.v2.0.0-beta.tar b/release/pihpsdr-nocontroller.v2.0.0-beta.tar new file mode 100644 index 0000000..e4bfd19 Binary files /dev/null and b/release/pihpsdr-nocontroller.v2.0.0-beta.tar differ diff --git a/release/pihpsdr-v2.0.0-beta.tar b/release/pihpsdr-v2.0.0-beta.tar index b622ef8..0ce5acb 100644 Binary files a/release/pihpsdr-v2.0.0-beta.tar and b/release/pihpsdr-v2.0.0-beta.tar differ diff --git a/release/pihpsdr.tar b/release/pihpsdr.tar index b622ef8..0ce5acb 100644 Binary files a/release/pihpsdr.tar and b/release/pihpsdr.tar differ diff --git a/release/pihpsdr/64-limesuite.rules b/release/pihpsdr/64-limesuite.rules new file mode 100644 index 0000000..9093aa6 --- /dev/null +++ b/release/pihpsdr/64-limesuite.rules @@ -0,0 +1,5 @@ +SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="8613", SYMLINK+="stream-%k", MODE="666" +SUBSYSTEM=="usb", ATTR{idVendor}=="04b4", ATTR{idProduct}=="00f1", SYMLINK+="stream-%k", MODE="666" +SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="601f", SYMLINK+="stream-%k", MODE="666" +SUBSYSTEM=="usb", ATTR{idVendor}=="1d50", ATTR{idProduct}=="6108", SYMLINK+="stream-%k", MODE="666" +SUBSYSTEM=="xillybus", MODE="666", OPTIONS="last_rule" diff --git a/release/pihpsdr/README.MIDI b/release/pihpsdr/README.MIDI new file mode 100644 index 0000000..05d3e6a --- /dev/null +++ b/release/pihpsdr/README.MIDI @@ -0,0 +1,188 @@ +MIDI support in piHPSDR - Manual for Users +========================================== + + +To use MIDI devices in piHPSDR, you must provide a file "midi.inp" that resides +in the current working dir of piHPSDR (that is, where the "*.props" file and +the WDSP wisdom files also reside). + +A sample midi.inp file for the popular Behringer "CMD PL-1" MIDI console is +provided as an example. The basic rules for the file are + +- the file is line-oriented. Each line contains a directive + +- in each line, a "#" sign denotes a comment, that is: + a line beginning with a "#" is skipped + in all other lines, the "#" and all following characters are skipped. + +- the first non-comment line specifies the MIDI device (just in case, when + several MIDI controllers are connected to the computer). This line MUST + contain the string "DEVICE=", and everything following is treated as the + device name (without trailing blanks). Only MIDI devices are accepted whose + name starts with the given device name. for example, the line + + DEVICE=CMD PL + + will accept the "CMD PL-1" MIDI controller. + +- The following lines all must contain one of the strings + "KEY=", "CTRL=", or "PITCH=". The syntax is as follows: + + KEY: buttons which generate Note-On/Note-Off MIDI events + ======================================================== + + The syntay is + + KEY= CHAN= ACTION= + + where is the Number of the Midi Note, is the MIDI + channel where the event is expected. + + The key words with the line can be given in any order. If + CHAN= is omitted, MIDI events from any channel are accepted. + + is the key-word for a SDR "action" (see below) + and can be omitted, or can be the string "ONOFF". + If the "ONOFF" modifier is there, an action is taken both upon + Note-On and Note-Off events (usually: when pressing and releasing + the button), while otherwise actions are only take upon "Note-on" + events. + Example without "ONOFF": + When using a button for the "TUNE" function, the + radio will go "tune" state when hitting the button, and return + to normal operation when hitting the button a second time. + Example with "ONOFF": + When using the same button for the "TUNE" function with the "ONOFF" + modifier, the radion will go to "tune" state when pressing the + button and return to normal operation when releasing it. + + For example, in the sample file midi.inp you find the line + + KEY=34 ACTION=MOX + + and this means that the "Cue" button of the Behringer controller, + whiche generates Note on/off message for Note 34, is used to + switch MOX. + + CTRL: MIDI controllers + ====================== + + Here we must distinguish between controllers that give a value in a + fixed range (0-127), and controller that only encode the direction and + speed of turning a knob. We will name the first kind of controllers + (usually expression pedals, etc.) "knobs" and the second kind "wheels". + + For example, the line + + CTRL=20 ACTION=RFPOWER + + will set the TX drive power, with value 0 for the minimum controller + position and the maximum value (100) for the maximum controller + position. Note that the Behringer controller has no "knobs", only + "wheels". + + Wheels generate values which indicate the direction (left/right) and + speed of the rotation. A typical use would be to control the VFO + frequency. The description of wheel must contain the key-word "WHEEL" + and the critical values for normal/fast/very-fast left/right turns. + For example, the line + + CTRL=31 WHEEL THR=59 61 63 65 67 69 ACTION=VFO + + in the sample midi.inp file indicates that the VFO is controlled + by a MIDI controller with "note" 31 (this is the big knob for the + Behringer controller). The controller values sent by the MIDI + hardware are <64 for left turns and >64 for right turns, and the + larger the speed of rotation the larger the deviation from 64. + The sample line means that the frequency is reduced by 100 VFO-steps + if the controller value sent is <= 59, the frequency is reduced by + 10 VFO-steps for controller values 59 and 60, and the VFO frequency + is reduced by one VFO-step is the controller sends the values 62 + and 63. Likewise, the thresholds for an increase of the VFO frequency + by 1/10/100 VFO-steps are 65, 67, 69. + This allows to move from one band edge to the other easily. + + If fast or very-fast motions are not wanted, set the threshold + accordingly. For example, + + CTRL=4 WHEEL THR=-1 -1 63 65 128 128 ACTION=AGC + + changes the AGC value by a constant amount for each MIDI message + generated, since the controller values are always in the range + 0-127 and the threshold for fast and very-fast are never reached. + + For wheels, there can be an additional directive DELAY=, + if this is given, it specifies a delay time (in msec) in which no + further WHEEL event is processed. If a wheel is used, for example, + to cycle through the filter settings, a delay takes care that this + does not go too fast. + + PITCH: MIDI PITCH sliders + ========================= + + Sometimes a MIDI controller features a "pitch" controller. This + controller sends values between 0 and 16385. It can be used to + control all sorts of "sliders", e.g. TX drive level, AF level, + etc. Since there can only be a single pitch controller, the + line in file midi.inp is simply + + PITCH ACTION=AFGAIN + + and this means that with the pitch controller, the AF volume + is controlled. MIDI pitch controllers are treated as "KNOBS", + that is, the same way as MIDI controllers that generate values + in a fixed range. + + +LIST OF ACTIONS +=============== + +Here is a list of actions implemented. Note that not all actions +can be used with all sorts of MIDI events. For example, activating +MOX makes only sense with a button (KEY), while setting the TX +drive could be used with a knob (CTRL but no WHEEL), with a wheel +(CTRL with WHEEL), or even with a pitch controller. + +Here is a list of actions currently implemented, in alphabetical +order. We also give for which types of MIDI events (KEY, KNOB, +WHEEL) this action is defined. We further have a "dummy" action +NONE which means that there is nothing to do. + + +Action Event Explanation +---------------------------------------------------------------------------------------------- +AFGAIN KNOB,WHEEL AF audio volume +AGC KNOB,WHEEL AGC level +AGCATTACK KEY cycle through AGC settings (fast/slow, etc.) +ATT KEY cycle through "ALEX attenuator" settings +ATT KNOB,WHEEL set RX attenuation (0-31dB) +BANDUP KEY,WHEEL cycle through the bands (upwards) +BANDDOWN KEY,WHEEL cycle through the bands (downwards) +COMPRESS KNOB,WHEEL set TX compression level +CTUN KEY toggle CTUN mode +FILTERUP KEY,WHEEL cycle through the filters (upwards) +FILTERDOWN KEY,WHEEL cycle through the filster (downwards) +LOCK KEY lock VFO(s) +MICGAIN KNOB,WHEEL MIC gain +MODEUP KEY,WHEEL cycle through the modes (upwards) +MODEDOWN KEY,WHEEL cycle through the modes (downwards) +MOX KEY MOX on/off +NB KEY cycle through NoiseBlanker settings +NR KEY cycle through NoiseReduction settings +PANHIGH WHEEL change "high" level of current pan-adapter +PANLOW WHEEL change "bottom" level of current pan-adapter +PREAMP KEY cycle through preamp settings (only available for CHARLY25 filter boards) +PURESIGNAL KEY toggle PURESIGNAL (on/off) +RITCLEAR KEY clear RIT frequency +RITVAL WHEEL change RIT frequency offset +RFPOWER KNOB,WHEEL TX power +SPLIT KEY toggle Split mode +SWAPVFO KEY Swap VFO-A/VFO-B +TUNE KEY Tune on/off +VFO WHEEL change VFO frequency +VFOA2B KEY frequency VFO A -> VFO B +VFOB2A KEY frequency VFO B -> VFO A +VOX KEY toggle VOX (on/off) + + +If you need more or different type of actions, the implementation should be straightforward. diff --git a/release/pihpsdr/install.sh b/release/pihpsdr/install.sh index 757fd4b..77cb1e1 100755 --- a/release/pihpsdr/install.sh +++ b/release/pihpsdr/install.sh @@ -1,11 +1,13 @@ echo "installing fftw" sudo apt-get -y install libfftw3-3 +echo "installing librtlsdr0" +sudo apt-get -y install librtlsdr0 echo "removing old versions of pihpsdr" sudo rm -rf /usr/local/bin/pihpsdr echo "creating start script" cat < start_pihpsdr.sh cd `pwd` -sudo /usr/local/bin/pihpsdr +/usr/local/bin/pihpsdr >log 2>&1 EOT chmod +x start_pihpsdr.sh echo "creating desktop shortcut" @@ -33,6 +35,14 @@ fi cp pihpsdr.desktop ~/.local/share/applications echo "removing old versions of shared libraries" sudo rm -rf /usr/local/lib/libwdsp.so +sudo rm -rf /usr/local/lib/libLimeSuite* +sudo rm -rf /usr/local/lib/libSoapySDR* +sudo rm -rf /usr/local/lib/SoapySDR +echo "copying udev rules" +sudo cp 64-limesuite.rules /etc/udev/rules.d/ +sudo cp 90-ozy.rules /etc/udev/rules.d/ +sudo udevadm control --reload-rules +sudo udevadm trigger echo "installing pihpsdr" sudo cp pihpsdr /usr/local/bin echo "installing shared libraries" @@ -44,6 +54,6 @@ cd /usr/local/lib sudo ln -s libLimeSuite.so.19.04.1 libLimeSuite.so.19.04-1 sudo ln -s libLimeSuite.so.19.04-1 libLimeSuite.so sudo ln -s libSoapySDR.so.0.8.0 libSoapySDR.so.0.8 -sudo ln -s libSoapySDR.so.0.8 libLimeSuite.so -sudo apt-get install librtlsdr-dev +sudo ln -s libSoapySDR.so.0.8 libSoapySDR.so sudo ldconfig + diff --git a/release/pihpsdr/midi.inp b/release/pihpsdr/midi.inp new file mode 100644 index 0000000..cb0ddce --- /dev/null +++ b/release/pihpsdr/midi.inp @@ -0,0 +1,74 @@ +# +# Sample midi.inp file, suitable for a Behringer CMD PL-1 MIDI controller +# +# Note that the Attenuator is implemented twice, as a key and as a wheel +# The key is suitable for radios with a step (ALEX) attenuator, the wheel +# fits best for radios with a programmable attenuator (0-31 dB). +# The button (Key 2) also works for STEMlab and CHARLY25 +# +# The preamp button (Key 1) only has function with STEMlab and CHARLY25 +# +# Do not assign the "Key" with number 31. You will unintentionally +# "push" it most of the times you change the VFO frequency. +# +# NOTE: we could just leave out all lines with ACTION=NONE. In this case +# a diagnostic message ("unknown MIDI event") is printed to stderr. +# +DEVICE=CMD PL-1 +# +# Big Wheel and Big Slider +# +CTRL=31 WHEEL THR=59 61 63 65 67 69 ACTION=VFO # Big wheel: : main VFO knob +KEY=31 ACTION=NONE # Button integrated in the big wheel (do not assign) +PITCH ACTION=AFGAIN # Big slider : AF gain +# +# 8 Knobs (top left). +# Note that you can push each knob and this generates +# Note On/Off messages for KEY=0...8 which we do not +# assign: we want to glue labels on the Controller and therefore +# we do not have two labels per knob. +# +CTRL=0 WHEEL THR=-1 -1 63 65 128 128 ACTION=ATT # Knob 1 : RX att +KEY=0 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=1 WHEEL THR=-1 -1 63 65 128 128 ACTION=COMPRESS # Knob 2 : TX compression +KEY=1 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=2 WHEEL THR=-1 -1 63 65 128 128 ACTION=RITVAL # Knob 3 : RIT value +KEY=2 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=3 WHEEL THR=-1 -1 63 65 128 128 ACTION=PANLOW # Knob 4 : Panadapter low +KEY=4 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=4 WHEEL THR=-1 -1 63 65 128 128 ACTION=AGC # Knob 5 : AGC +KEY=4 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=5 WHEEL THR=-1 -1 63 65 128 128 ACTION=MICGAIN # Knob 6 : MIC gain +KEY=5 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=6 WHEEL THR=-1 -1 63 65 128 128 ACTION=RFPOWER # Knob 7 : TX drive +KEY=6 ACTION=NONE # Push Knob 1 : (unassigned) +CTRL=7 WHEEL THR=-1 -1 63 65 128 128 ACTION=FILTERUP # Knob 8 : cycle through the filters +KEY=7 ACTION=NONE # Push Knob 1 : (unassigned) +# +# 8 Keys (below the 8 Knobs) +# +KEY=16 ACTION=PREAMP # Key 1 : Cycle through Preamp settings +KEY=17 ACTION=ATT # Key 2 : Cycle through ATT (Alex ATT) settings +KEY=18 ACTION=RITCLEAR # Key 3 : Clear RIT value and disable RIT +KEY=19 ACTION=CTUN # Key 4 : toggle CTUN +KEY=20 ACTION=NOISEBLANKER # Key 5 : cycle through NB settings +KEY=21 ACTION=NOISEREDUCTION # Key 6 : cycle through NR settings +KEY=22 ACTION=VOX # Key 7 : toggle VOX +KEY=23 ACTION=AGCATTACK # Key 8 : cycle AGC fast/medium/slow +# +# "other" keys +# Note that the "DECK" key switches the MIDI channel of the device. +# +KEY=24 ACTION=TUNE # LOAD button: TUNE on/off +KEY=25 ACTION=LOCK # LOCK button: Lock VFO(s) +KEY=26 ACTION=PURESIGNAL # DECK button: toggle PURESIGNAL +KEY=27 ACTION=SWAPVFO # SCRATCH button: Swap VFOs A and B +KEY=31 ACTION=NONE # Button integrated in the big wheel (do not assign) +KEY=32 ACTION=VFOA2B # SYNC button: Frequency VFO A -> VFO B +KEY=33 ACTION=VFOB2A # TAP button: Frequency VFO B -> VFO A +KEY=34 ACTION=MOX # CUE button: MOX on/off +KEY=35 ACTION=SPLIT # >|| button: toggle Split +KEY=36 ACTION=MODEDOWN # << button: Mode down +KEY=37 ACTION=MODEUP # >> button: Mode up +KEY=38 ACTION=BANDDOWN # - button: Band down +KEY=39 ACTION=BANDUP # + button: Band up diff --git a/release/pihpsdr/pihpsdr b/release/pihpsdr/pihpsdr index d9877df..7cfe052 100755 Binary files a/release/pihpsdr/pihpsdr and b/release/pihpsdr/pihpsdr differ diff --git a/rx_panadapter.c b/rx_panadapter.c index 076024d..7ba22ac 100644 --- a/rx_panadapter.c +++ b/rx_panadapter.c @@ -431,8 +431,7 @@ void rx_panadapter_update(RECEIVER *rx) { } #endif -#ifdef GPIO -#ifndef CONTROLLER2 +#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); @@ -452,7 +451,6 @@ void rx_panadapter_update(RECEIVER *rx) { } } #endif -#endif cairo_destroy (cr); diff --git a/switch_menu.c b/switch_menu.c index fd5a40c..f15cd72 100644 --- a/switch_menu.c +++ b/switch_menu.c @@ -17,7 +17,7 @@ * */ -#ifdef CONTROLLER2 +#if defined (CONTROLLER2_V2) || defined (CONTROLLER2_V1) #include #include #include @@ -33,9 +33,7 @@ #include "vfo.h" #include "button_text.h" #include "gpio.h" -#ifdef CONTROLLER2 #include "i2c.h" -#endif typedef struct _choice { int sw; @@ -136,7 +134,7 @@ void switch_menu(GtkWidget *parent) { row++; col=0; -#ifndef CONTROLLER2 +#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); diff --git a/tx_panadapter.c b/tx_panadapter.c index 1bc63b9..efa8a84 100644 --- a/tx_panadapter.c +++ b/tx_panadapter.c @@ -38,7 +38,9 @@ #ifdef FREEDV #include "freedv.h" #endif +#ifdef GPIO #include "gpio.h" +#endif static gint last_x; @@ -367,8 +369,7 @@ void tx_panadapter_update(TRANSMITTER *tx) { } #endif -#ifdef GPIO -#ifndef CONTROLLER2 +#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) { @@ -386,7 +387,6 @@ void tx_panadapter_update(TRANSMITTER *tx) { cairo_show_text(cr, encoder_string[e4_encoder_action]); } #endif -#endif #ifdef PURESIGNAL if(tx->puresignal) { diff --git a/version.c b/version.c index 2b9e706..06ccee0 100644 --- a/version.c +++ b/version.c @@ -20,8 +20,12 @@ char build_date[]=GIT_DATE; char build_version[]=GIT_VERSION; -#ifdef CONTROLLER2 -char version[]="2.0.0 (Controller2)"; +#if defined (CONTROLLER2_V1) +char version[]="2.0.0 (Controller2 V1)"; +#elif defined (CONTROLLER2_V2) +char version[]="2.0.0 (Controller2 V2)"; +#elif defined (GPIO) +char version[]="2.0.0 (Controller1)"; #else char version[]="2.0.0"; #endif