From df1071ff69750410ef67dd5feb3edd1e5a458baf Mon Sep 17 00:00:00 2001 From: John Melton - G0ORX/N6LYT Date: Sat, 10 Dec 2016 11:39:03 +0000 Subject: [PATCH] Added Binaural setting. Fixed new protocol bypass HPF setting. --- alex.h | 2 +- audio_menu.c | 12 ++++++++++++ new_protocol.c | 22 +++++++++++----------- radio.c | 7 +++++++ radio.h | 1 + wdsp_init.c | 1 + 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/alex.h b/alex.h index ee1ce66..b2e0af6 100644 --- a/alex.h +++ b/alex.h @@ -48,7 +48,7 @@ #define ALEX_9_5MHZ_HPF 0x00000010 #define ALEX_6_5MHZ_HPF 0x00000020 #define ALEX_1_5MHZ_HPF 0x00000040 -#define ALEX_BYPASS_HPF 0x00000800 +#define ALEX_BYPASS_HPF 0x00001000 #define ALEX_6M_PREAMP 0x00000008 diff --git a/audio_menu.c b/audio_menu.c index bda85d3..684bba2 100644 --- a/audio_menu.c +++ b/audio_menu.c @@ -25,7 +25,9 @@ #include "new_menu.h" #include "audio_menu.h" #include "audio.h" +#include "channel.h" #include "radio.h" +#include "wdsp.h" static GtkWidget *parent_window=NULL; @@ -45,6 +47,11 @@ static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer dat return TRUE; } +static void binaural_cb(GtkWidget *widget, gpointer data) { + binaural=gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); + SetRXAPanelBinaural(CHANNEL_RX0, binaural); +} + static void micboost_cb(GtkWidget *widget, gpointer data) { mic_boost=mic_boost==1?0:1; } @@ -144,6 +151,11 @@ void audio_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 *binaural_b=gtk_check_button_new_with_label("Binaural"); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (binaural_b), binaural); + gtk_grid_attach(GTK_GRID(grid),binaural_b,1,0,1,1); + g_signal_connect(binaural_b,"toggled",G_CALLBACK(binaural_cb),NULL); + int row=0; if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) { diff --git a/new_protocol.c b/new_protocol.c index e4c4f01..f108d94 100644 --- a/new_protocol.c +++ b/new_protocol.c @@ -378,7 +378,15 @@ static void new_protocol_high_priority(int run) { } else { buffer[1401]=band->OCrx; } -// alex HPF filters + + + long filters=0x00000000; + + if(isTransmitting()) { + filters=0x08000000; + } + +// Alex RX HPF filters /* if (frequency < 1800000) HPF <= 6'b100000; // bypass else if (frequency < 6500000) HPF <= 6'b010000; // 1.5MHz HPF @@ -388,15 +396,6 @@ else if (frequency < 20000000) HPF <= 6'b000001; // 13MHz HPF else HPF <= 6'b000010; // 20MHz HPF */ - - - long filters=0x00000000; - - if(isTransmitting()) { - filters=0x08000000; - } - -// set HPF if(ddsFrequency<1800000L) { filters|=ALEX_BYPASS_HPF; } else if(ddsFrequency<6500000L) { @@ -410,7 +409,8 @@ else HPF <= 6'b000010; // 20MHz } else { filters|=ALEX_20MHZ_HPF; } -// alex LPF filters + +// Alex TX LPF filters /* if (frequency > 32000000) LPF <= 7'b0010000; // > 10m so use 6m LPF^M else if (frequency > 22000000) LPF <= 7'b0100000; // > 15m so use 12/10m LPF^M diff --git a/radio.c b/radio.c index a476129..c442e75 100644 --- a/radio.c +++ b/radio.c @@ -93,6 +93,7 @@ int toolbar_dialog_buttons=1; double volume=0.2; double mic_gain=0.0; +int binaural=0; int rx_dither=0; int rx_random=0; @@ -697,6 +698,9 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path); value=getProperty("vox_hang"); if(value) vox_hang=atof(value); + value=getProperty("binaural"); + if(value) binaural=atoi(value); + bandRestoreState(); sem_post(&property_sem); @@ -892,6 +896,9 @@ void radioSaveState() { sprintf(value,"%f",vox_hang); setProperty("vox_hang",value); + sprintf(value,"%d",binaural); + setProperty("binaural",value); + bandSaveState(); saveProperties(property_path); diff --git a/radio.h b/radio.h index 6961fa9..af02e6a 100644 --- a/radio.h +++ b/radio.h @@ -111,6 +111,7 @@ extern int toolbar_dialog_buttons; extern double volume; extern double mic_gain; +extern int binaural; extern int agc; extern double agc_gain; extern double agc_slope; diff --git a/wdsp_init.c b/wdsp_init.c index 1b356d5..6fafe3c 100644 --- a/wdsp_init.c +++ b/wdsp_init.c @@ -243,6 +243,7 @@ static void setupRX(int rx) { SetRXASNBARun(rx, snb); SetRXAPanelGain1(rx, volume); + SetRXAPanelBinaural(rx, binaural); if(enable_rx_equalizer) { SetRXAGrphEQ(rx, rx_equalizer); -- 2.45.2