I2C_OBJS=i2c.o
endif
-#uncomment if build for SHORT FRAMES (MIC and Audio)
-SHORT_FRAMES=-D SHORT_FRAMES
-
GTKINCLUDES=`pkg-config --cflags gtk+-3.0`
GTKLIBS=`pkg-config --libs gtk+-3.0`
AUDIO_LIBS=-lasound
#AUDIO_LIBS=-lsoundio
-OPTIONS=-g -Wno-deprecated-declarations -D $(UNAME_N) $(RADIOBERRY_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(PSK_OPTIONS) $(SHORT_FRAMES) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3
+OPTIONS=-g -Wno-deprecated-declarations -D $(UNAME_N) $(RADIOBERRY_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(PSK_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3
LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS)
INCLUDES=$(GTKINCLUDES)
noise_menu.c \
agc_menu.c \
vox_menu.c \
+fft_menu.c \
diversity_menu.c \
freqent_menu.c \
tx_menu.c \
noise_menu.h \
agc_menu.h \
vox_menu.h \
+fft_menu.h \
diversity_menu.h \
freqent_menu.h \
tx_menu.h \
noise_menu.o \
agc_menu.o \
vox_menu.o \
+fft_menu.o \
diversity_menu.o \
freqent_menu.o \
tx_menu.o \
-rm -f $(PROGRAM)
install:
- cp pihpsdr ../pihpsdr
- cp pihpsdr ./release/pihpsdr
- cd release; echo $(GIT_VERSION) > pihpsdr/latest
- cd release; tar cvf pihpsdr_$(GIT_VERSION).tar pihpsdr
- cd release; tar cvf pihpsdr.tar pihpsdr
+ if [ ! -d ~/pihpsdr ];then \
+ mkdir ~/pihpsdr; \
+ if [ -d "./release/pihpsdr" ];then \
+ cp ./release/pihpsdr/* ~/pihpsdr; \
+ fi \
+ fi
+ cp pihpsdr ~/pihpsdr
+ if [ -d "./release" ];then \
+ cp pihpsdr ./release/pihpsdr; \
+ cd release; echo $(GIT_VERSION) > pihpsdr/latest; \
+ cd release; tar cvf pihpsdr_$(GIT_VERSION).tar pihpsdr; \
+ cd release; tar cvf pihpsdr.tar pihpsdr; \
+ fi
--- /dev/null
+/* Copyright (C)
+* 2017 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "fft_menu.h"
+#include "radio.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *menu_b=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+ return TRUE;
+}
+
+static void filter_type_cb(GtkWidget *widget, gpointer data) {
+ set_filter_type((int)data);
+}
+
+#ifdef SET_FILTER_SIZE
+static void filter_size_cb(GtkWidget *widget, gpointer data) {
+ set_filter_size((int)data);
+}
+#endif
+
+void fft_menu(GtkWidget *parent) {
+ 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);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+ gtk_grid_set_column_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
+ //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close");
+ g_signal_connect (close_b, "button_press_event", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ int x=0;
+
+ GtkWidget *filter_type_label=gtk_label_new("Filter Type: ");
+ gtk_grid_attach(GTK_GRID(grid),filter_type_label,x,1,1,1);
+
+ GtkWidget *linear_phase=gtk_radio_button_new_with_label(NULL,"Linear Phase");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (linear_phase), receiver[0]->low_latency==0);
+ gtk_grid_attach(GTK_GRID(grid),linear_phase,x,2,1,1);
+ g_signal_connect(linear_phase,"pressed",G_CALLBACK(filter_type_cb),(gpointer *)0);
+
+ GtkWidget *low_latency=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(linear_phase),"Low Latency");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (low_latency), receiver[0]->low_latency==1);
+ gtk_grid_attach(GTK_GRID(grid),low_latency,x,3,1,1);
+ g_signal_connect(low_latency,"pressed",G_CALLBACK(filter_type_cb),(gpointer *)1);
+
+ x++;
+
+#ifdef SET_FILTER_SIZE
+ GtkWidget *filter_size_label=gtk_label_new("Filter Size: ");
+ gtk_grid_attach(GTK_GRID(grid),filter_size_label,x,1,1,1);
+
+ GtkWidget *filter_1024=gtk_radio_button_new_with_label(NULL,"1024");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filter_1024), receiver[0]->fft_size==1024);
+ gtk_grid_attach(GTK_GRID(grid),filter_1024,x,2,1,1);
+ g_signal_connect(filter_1024,"pressed",G_CALLBACK(filter_size_cb),(gpointer *)1024);
+
+ GtkWidget *filter_2048=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(filter_1024),"2048");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filter_2048), receiver[0]->fft_size==2048);
+ gtk_grid_attach(GTK_GRID(grid),filter_2048,x,3,1,1);
+ g_signal_connect(filter_2048,"pressed",G_CALLBACK(filter_size_cb),(gpointer *)2048);
+
+ GtkWidget *filter_4096=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(filter_2048),"4096");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filter_4096), receiver[0]->fft_size==4096);
+ gtk_grid_attach(GTK_GRID(grid),filter_4096,x,4,1,1);
+ g_signal_connect(filter_4096,"pressed",G_CALLBACK(filter_size_cb),(gpointer *)4096);
+
+ GtkWidget *filter_8192=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(filter_4096),"8192");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filter_8192), receiver[0]->fft_size==8192);
+ gtk_grid_attach(GTK_GRID(grid),filter_8192,x,5,1,1);
+ g_signal_connect(filter_8192,"pressed",G_CALLBACK(filter_size_cb),(gpointer *)8192);
+
+ GtkWidget *filter_16384=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(filter_8192),"16384");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filter_16384), receiver[0]->fft_size==16384);
+ gtk_grid_attach(GTK_GRID(grid),filter_16384,x,6,1,1);
+ g_signal_connect(filter_16384,"pressed",G_CALLBACK(filter_size_cb),(gpointer *)16394);
+
+ x++;
+#endif
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
+
--- /dev/null
+/* Copyright (C)
+* 2017 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+void fft_menu(GtkWidget *parent);
#include "encoder_menu.h"
#endif
#include "vfo_menu.h"
+#include "fft_menu.h"
#include "main.h"
return TRUE;
}
+void start_fft() {
+ cleanup();
+ fft_menu(top_window);
+}
+
+static gboolean fft_b_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ start_fft();
+ return TRUE;
+}
+
void start_diversity() {
cleanup();
diversity_menu(top_window);
gtk_grid_attach(GTK_GRID(grid),vox_b,(i%5),i/5,1,1);
i++;
+ GtkWidget *fft_b=gtk_button_new_with_label("FFT");
+ g_signal_connect (fft_b, "button-press-event", G_CALLBACK(fft_b_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),fft_b,(i%5),i/5,1,1);
+ i++;
+
#ifdef DIVERSITY
if(RECEIVERS==2) {
GtkWidget *diversity_b=gtk_button_new_with_label("Diversity");
static int leftaudiosample;
static int rightaudiosample;
static long audiosequence;
-#ifdef SHORT_FRAMES
static unsigned char audiobuffer[260]; // was 1444
-#else
-static unsigned char audiobuffer[1444]; // was 1444
-#endif
static int audioindex;
#ifdef FREEDV
#define RX_IQ_TO_HOST_PORT_6 1041
#define RX_IQ_TO_HOST_PORT_7 1042
-//#define BUFFER_SIZE 1024
-#ifdef SHORT_FRAMES
#define MIC_SAMPLES 64
-#else
-#define MIC_SAMPLES 720
-#endif
extern int data_socket;
extern sem_t response_sem;
int b=0;
unsigned char ozy_samples[8*8];
int bytes;
- int last_ptt;
- int last_dot;
- int last_dash;
+ int previous_ptt;
+ int previous_dot;
+ int previous_dash;
int left_sample;
int right_sample;
short mic_sample;
control_in[3]=buffer[b++];
control_in[4]=buffer[b++];
- last_ptt=ptt;
- last_dot=dot;
- last_dash=dash;
+ previous_ptt=ptt;
+ previous_dot=dot;
+ previous_dash=dash;
ptt=(control_in[0]&0x01)==0x01;
dash=(control_in[0]&0x02)==0x02;
dot=(control_in[0]&0x04)==0x04;
- if(last_ptt!=ptt) {
- g_idle_add(ptt_update,(gpointer)ptt);
+if(ptt!=previous_ptt) {
+ fprintf(stderr,"ptt=%d\n",ptt);
+}
+if(dot!=previous_dot) {
+ fprintf(stderr,"dot=%d\n",dot);
+}
+if(dash!=previous_dash) {
+ fprintf(stderr,"dash=%d\n",dash);
+}
+
+ if(previous_ptt!=ptt || dot!=previous_dot || dash!=previous_dash) {
+ g_idle_add(ptt_update,(gpointer)(ptt | dot | dash));
}
switch((control_in[0]>>3)&0x1F) {
if(mode!=modeCWU && mode!=modeCWL) {
// output_buffer[C1]|=0x00;
} else {
- if((tune==1) || (mox==1) || (vox==1) || (cw_keyer_internal==0)) {
+ if((tune==1) || (vox==1) || (cw_keyer_internal==0)) {
output_buffer[C1]|=0x00;
- } else {
+ } else if(mox==1) {
output_buffer[C1]|=0x01;
}
}
}
// set mox
+ if(split) {
+ mode=vfo[1].mode;
+ } else {
+ mode=vfo[0].mode;
+ }
if(mode==modeCWU || mode==modeCWL) {
if(tune) {
output_buffer[C0]|=0x01;
SetDisplayAvBackmult(rx->id, 0, display_avb);
SetDisplayNumAverage(rx->id, 0, display_average);
}
+
+void set_filter_type(int filter_type) {
+ int i;
+
+ fprintf(stderr,"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);
+ }
+ transmitter->low_latency=filter_type;
+ TXASetMP(transmitter->id, filter_type);
+}
+
+void set_filter_size(int filter_size) {
+ int i;
+
+ fprintf(stderr,"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);
+ }
+ transmitter->fft_size=filter_size;
+ TXASetNC(transmitter->id, filter_size);
+}
extern void calculate_display_average();
+extern void set_filter_type(int filter_type);
+extern void set_filter_size(int filter_size);
#endif
fprintf(stderr,"create_receiver: id=%d after restore adc=%d\n",rx->id, rx->adc);
-fprintf(stderr,"create_receiver: OpenChannel id=%d buffer_size=%d fft_size=%d sample_rate=%d\n",rx->id,rx->buffer_size, rx->fft_size, rx->sample_rate);
+fprintf(stderr,"create_receiver: OpenChannel id=%d buffer_size=%d fft_size=%d sample_rate=%d\n",
+ rx->id,
+ rx->buffer_size,
+ 2048, // rx->fft_size,
+ rx->sample_rate);
OpenChannel(rx->id,
rx->buffer_size,
- rx->fft_size,
+ 2048, // rx->fft_size,
rx->sample_rate,
48000, // dsp rate
48000, // output rate
1, // run
0.010, 0.025, 0.0, 0.010, 0);
+fprintf(stderr,"RXASetNC %d\n",rx->fft_size);
+ RXASetNC(rx->id, rx->fft_size);
+fprintf(stderr,"RXASetMP %d\n",rx->low_latency);
+ RXASetMP(rx->id, rx->low_latency);
+
b=band_get_band(vfo[rx->id].band);
BANDSTACK *bs=b->bandstack;
BANDSTACK_ENTRY *entry=&bs->entry[vfo[rx->id].bandstack];
FILTER *band_filter=&band_filters[vfo[rx->id].filter];
set_filter(rx,band_filter->low,band_filter->high);
- RXASetNC(rx->id, rx->fft_size);
- RXASetMP(rx->id, rx->low_latency);
SetRXAFMDeviation(rx->id,(double)deviation);
}
int ptt_update(void *data) {
+
+ return mox_update(data);
+/*
int mode;
if(split) {
mode=vfo[1].mode;
} else {
mode=vfo[0].mode;
}
- if(protocol==NEW_PROTOCOL || (mode!=modeCWU && mode!=modeCWL)) {
+ if(protocol==NEW_PROTOCOL || protocol==ORIGINAL_PROTOCOL || (mode!=modeCWU && mode!=modeCWL)) {
mox_cb(NULL,NULL);
}
g_idle_add(vfo_update,NULL);
return 0;
+*/
}
void tune_cb(GtkWidget *widget, gpointer data) {
fprintf(stderr,"create_transmitter: OpenChannel id=%d buffer_size=%d fft_size=%d sample_rate=%d dspRate=%d outputRate=%d\n",
tx->id,
tx->buffer_size,
- tx->fft_size,
+ 2048, // tx->fft_size,
tx->mic_sample_rate,
tx->mic_dsp_rate,
tx->iq_output_rate);
OpenChannel(tx->id,
tx->buffer_size,
- tx->fft_size,
+ 2048, // tx->fft_size,
tx->mic_sample_rate,
tx->mic_dsp_rate,
tx->iq_output_rate,
0, // run
0.010, 0.025, 0.0, 0.010, 0);
-fprintf(stderr,"TXASetNC\n");
+fprintf(stderr,"TXASetNC: %d\n",tx->fft_size);
TXASetNC(tx->id, tx->fft_size);
+fprintf(stderr,"TXASetMP: %d\n",tx->low_latency);
TXASetMP(tx->id, tx->low_latency);
SetTXAMode(tx->id, tx->mode);