noise_menu.c \
agc_menu.c \
fm_menu.c \
+test_menu.c \
rit.c \
meter.c \
mode.c \
noise_menu.h \
agc_menu.h \
fm_menu.h \
+test_menu.h \
rit.h \
meter.h \
mode.h \
noise_menu.o \
agc_menu.o \
fm_menu.o \
+test_menu.o \
rit.o \
meter.o \
mode.o \
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx1_b), band->alexTxAntenna==0);
gtk_widget_show(tx1_b);
gtk_grid_attach(GTK_GRID(grid),tx1_b,8,i+2,1,1);
+ g_signal_connect(tx1_b,"pressed",G_CALLBACK(tx_ant_cb),(gpointer)((i<<4)+0));
GtkWidget *tx2_b=gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(tx1_b));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tx2_b), band->alexTxAntenna==1);
#include "psk_waterfall.h"
#endif
-#define VFO_HEIGHT ((display_height/32)*4)
+//#define VFO_HEIGHT ((display_height/32)*4)
+#define VFO_HEIGHT ((display_height/32)*6)
#define VFO_WIDTH ((display_width/32)*16)
#define MENU_HEIGHT VFO_HEIGHT
-//#define MENU_WIDTH ((display_width/32)*3)
#define MENU_WIDTH ((display_width/32)*8)
#define RIT_WIDTH ((MENU_WIDTH/3)*2)
#define METER_HEIGHT VFO_HEIGHT
-//#define METER_WIDTH ((display_width/32)*13)
#define METER_WIDTH ((display_width/32)*8)
#define PANADAPTER_HEIGHT ((display_height/32)*8)
#define SLIDERS_HEIGHT ((display_height/32)*6)
}
}
+static gboolean minimize_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_window_iconify(GTK_WINDOW(window));
+ return TRUE;
+}
+
static void start_radio() {
int y;
fprintf(stderr,"start: selected radio=%p device=%d\n",radio,radio->device);
gtk_container_add(GTK_CONTAINER(window), fixed);
y=0;
-fprintf(stderr,"vfo_height=%d\n",VFO_HEIGHT);
vfo = vfo_init(VFO_WIDTH,VFO_HEIGHT,window);
gtk_fixed_put(GTK_FIXED(fixed),vfo,0,0);
rit_control = rit_init(RIT_WIDTH,MENU_HEIGHT,window);
gtk_fixed_put(GTK_FIXED(fixed),rit_control,VFO_WIDTH,y);
-fprintf(stderr,"menu_height=%d\n",MENU_HEIGHT);
+ GtkWidget *minimize_b=gtk_button_new_with_label("Hide");
+ gtk_widget_override_font(minimize_b, pango_font_description_from_string("FreeMono Bold 10"));
+ gtk_widget_set_size_request (minimize_b, MENU_WIDTH-RIT_WIDTH, MENU_HEIGHT/2);
+ g_signal_connect (minimize_b, "button-press-event", G_CALLBACK(minimize_cb), NULL);
+ gtk_widget_show(minimize_b);
+ gtk_fixed_put(GTK_FIXED(fixed),minimize_b,VFO_WIDTH+((MENU_WIDTH/3)*2),y);
+
//menu = menu_init(MENU_WIDTH,MENU_HEIGHT,window);
- menu = new_menu_init(MENU_WIDTH-RIT_WIDTH,MENU_HEIGHT,window);
- gtk_fixed_put(GTK_FIXED(fixed),menu,VFO_WIDTH+((MENU_WIDTH/3)*2),y);
+ menu = new_menu_init(MENU_WIDTH-RIT_WIDTH,MENU_HEIGHT/2,window);
+ gtk_fixed_put(GTK_FIXED(fixed),menu,VFO_WIDTH+((MENU_WIDTH/3)*2),y+(MENU_HEIGHT/2));
-fprintf(stderr,"meter_height=%d\n",METER_HEIGHT);
meter = meter_init(METER_WIDTH,METER_HEIGHT,window);
gtk_fixed_put(GTK_FIXED(fixed),meter,VFO_WIDTH+MENU_WIDTH,y);
y+=VFO_HEIGHT;
height+=SLIDERS_HEIGHT/2;
}
}
-fprintf(stderr,"panadapter_height=%d\n",height);
panadapter = panadapter_init(display_width,height);
gtk_fixed_put(GTK_FIXED(fixed),panadapter,0,VFO_HEIGHT);
y+=height;
if(!display_toolbar) {
height+=TOOLBAR_HEIGHT;
}
-fprintf(stderr,"waterfall_height=%d\n",height);
waterfall = waterfall_init(display_width,height);
gtk_fixed_put(GTK_FIXED(fixed),waterfall,0,y);
y+=height;
#endif
if(display_sliders) {
-fprintf(stderr,"sliders_height=%d\n",SLIDERS_HEIGHT);
sliders = sliders_init(display_width,SLIDERS_HEIGHT,window);
gtk_fixed_put(GTK_FIXED(fixed),sliders,0,y);
y+=SLIDERS_HEIGHT;
}
if(display_toolbar) {
-fprintf(stderr,"toolbar_height=%d\n",TOOLBAR_HEIGHT);
toolbar = toolbar_init(display_width,TOOLBAR_HEIGHT,window);
gtk_fixed_put(GTK_FIXED(fixed),toolbar,0,y);
y+=TOOLBAR_HEIGHT;
cairo_set_font_size(cr, 12);
sprintf(sf,"%d dBm",(int)level);
- cairo_move_to(cr, text_location, 45);
+ cairo_move_to(cr, text_location, meter_height-30);
cairo_show_text(cr, sf);
#ifdef FREEDV
#include "noise_menu.h"
#include "agc_menu.h"
#include "fm_menu.h"
+#include "test_menu.h"
static GtkWidget *parent_window=NULL;
return TRUE;
}
+void start_test() {
+ cleanup();
+ test_menu(parent_window);
+}
+
+static gboolean test_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ start_test();
+ return TRUE;
+}
+
static gboolean new_menu_pressed_event_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
g_signal_connect (agc_b, "button-press-event", G_CALLBACK(agc_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),agc_b,5,4,1,1);
+/*
+ GtkWidget *test_b=gtk_button_new_with_label("Test");
+ g_signal_connect (test_b, "button-press-event", G_CALLBACK(test_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),test_b,0,5,1,1);
+*/
gtk_container_add(GTK_CONTAINER(content),grid);
BAND *band=band_get_current_band();
BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
- if(entry->frequencyA!=f) {
- switch(protocol) {
- case NEW_PROTOCOL:
- case ORIGINAL_PROTOCOL:
- if(ctun) {
- long long minf=entry->frequencyA-(long long)(sample_rate/2);
- long long maxf=entry->frequencyA+(long long)(sample_rate/2);
- if(f<minf) f=minf;
- if(f>maxf) f=maxf;
- ddsOffset=f-entry->frequencyA;
- wdsp_set_offset(ddsOffset);
- return;
- } else {
- entry->frequencyA=f;
- }
- break;
-#ifdef LIMESDR
- case LIMESDR_PROTOCOL:
- {
+ switch(protocol) {
+ case NEW_PROTOCOL:
+ case ORIGINAL_PROTOCOL:
+ if(ctun) {
long long minf=entry->frequencyA-(long long)(sample_rate/2);
long long maxf=entry->frequencyA+(long long)(sample_rate/2);
if(f<minf) f=minf;
ddsOffset=f-entry->frequencyA;
wdsp_set_offset(ddsOffset);
return;
- }
- break;
+ } else {
+ entry->frequencyA=f;
+ }
+ break;
+#ifdef LIMESDR
+ case LIMESDR_PROTOCOL:
+ {
+ long long minf=entry->frequencyA-(long long)(sample_rate/2);
+ long long maxf=entry->frequencyA+(long long)(sample_rate/2);
+ if(f<minf) f=minf;
+ if(f>maxf) f=maxf;
+ ddsOffset=f-entry->frequencyA;
+ wdsp_set_offset(ddsOffset);
+ return;
+ }
+ break;
#endif
- }
}
displayFrequency=f;
-/* TS-2000 emulation via TCP
+
+/* S-2000 emulation via TCP
* Copyright (C) 2016 Steve Wilson <wevets@gmail.com>
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
#include "wdsp_init.h"
#include "bandstack.h"
#include "vfo.h"
+#include "sliders.h"
#include <pthread.h>
// IP stuff below
#include<sys/socket.h>
#include<arpa/inet.h> //inet_addr
-#define RIGCTL_DEBUG
+#undef RIGCTL_DEBUG
// the port client will be connecting to
#define PORT 19090 // This is the HAMLIB port
// Response - AG<0/1>123; Where 123 is 0-260
if(len>4) { // Set Audio Gain
volume = (double) atoi(&cmd_input[3])/260;
-/* KA6S - This crashes the system
- BUG
- set_af_gain(volume);
-*/
g_idle_add(update_af_gain,NULL);
} else { // Read Audio Gain
sprintf(msg,"AG0%03d;",2.6 * volume);
if(len == 13) { //We are receiving freq info
long long new_freqA = atoll(&cmd_input[2]);
setFrequency(new_freqA);
- // KA6S - this kills the system pretty quickly - it freezes
- // vfo_update(NULL);
- // BUG
g_idle_add(vfo_update,NULL);
} else {
if(len==2) {
if(len==13) { //We are receiving freq info
long long new_freqA = atoll(&cmd_input[2]);
setFrequency(new_freqA);
+ g_idle_add(vfo_update,NULL);
} else if(len == 2) {
sprintf(msg,"FB%011d;",getFrequency());
send_resp(msg);
entry= (BANDSTACK_ENTRY *)
bandstack_entry_get_current();
entry->mode=new_mode;
+ // BUG - kills the system when there is some
+ // GPIO activity and Mode sets occur. Used twittling the
+ // frequency along with setting mode between USB/LSB with
+ // flrig. Tried doing the g_idle_add trick - but don't know the
+ // the magic to get that to compile without warnings
setMode(entry->mode);
+ // Moved the vfo_update down after filter updated. (John G0ORX)
+ //g_idle_add(vfo_update,NULL);
FILTER* band_filters=filters[entry->mode];
FILTER* band_filter=&band_filters[entry->filter];
setFilter(band_filter->low,band_filter->high);
/* Need a way to update VFO info here..*/
+ g_idle_add(vfo_update,NULL);
} else { // Read Mode
int curr_mode;
switch (mode) {
send_resp(msg);
} else {
int tval = atoi(&cmd_input[2]);
- new_vol = (double) tval/100;
- set_mic_gain(new_vol);
+ new_vol = (double) tval/2;
+ //set_mic_gain(new_vol);
+ double *p_mic_gain=malloc(sizeof(double));
+ *p_mic_gain=new_vol;
+ g_idle_add(update_mic_gain,(void *)p_mic_gain);
}
}
else if(strcmp(cmd_str,"ML")==0) { // Set/read the monitor function level
//Scales to 0.00-1.00
double drive_val =
- (double)(atoi(&cmd_input[2]))/10;
+ (double)(atoi(&cmd_input[2]));
// setDrive(drive_val);
- set_drive(drive_val);
+ double *p_drive=malloc(sizeof(double));
+ *p_drive=drive_val;
+ g_idle_add(update_drive,(gpointer)p_drive);
+ //set_drive(drive_val);
}
}
else if(strcmp(cmd_str,"PI")==0) { // STore the programmable memory channel
// Scale from -20 - 120
if(len>4) { // Set Audio Gain
int base_value = atoi(&cmd_input[2]);
- float new_gain = ((((float) base_value)/255) * 140) - 20;
- set_agc_gain(new_gain);
+ double new_gain = ((((double) base_value)/255) * 140) - 20;
+ //set_agc_gain(new_gain);
+ double *p_gain=malloc(sizeof(double));
+ *p_gain=new_gain;
+ g_idle_add(update_agc_gain,(gpointer)p_gain);
} else { // Read Audio Gain
sprintf(msg,"RG%03d;",(255/140)*(agc_gain+20));
send_resp(msg);
socket_desc = socket(AF_INET , SOCK_STREAM , 0);
if (socket_desc == -1)
{
- fprintf(stderr,"RIGCTL: Could not create socket\n");
+ fprintf(stderr,"RIGCTL: Could not create socket");
}
fprintf(stderr, "RIGCTL: Socket created\n");
#include <gtk/gtk.h>
#include <semaphore.h>
#include <stdio.h>
+#include <stdlib.h>
#include <math.h>
#include "sliders.h"
}
}
+int update_agc_gain(void *data) {
+ set_agc_gain(*(double*)data);
+ free(data);
+ return 0;
+}
+
static void afgain_value_changed_cb(GtkWidget *widget, gpointer data) {
volume=gtk_range_get_value(GTK_RANGE(af_gain_scale))/100.0;
SetRXAPanelGain1 (CHANNEL_RX0, volume);
}
}
+int update_mic_gain(void *data) {
+ set_mic_gain(*(double*)data);
+ free(data);
+ return 0;
+}
+
void set_drive(double value) {
setDrive(value);
if(display_sliders) {
setDrive(gtk_range_get_value(GTK_RANGE(drive_scale)));
}
+int update_drive(void *data) {
+ set_drive(*(double *)data);
+ free(data);
+ return 0;
+}
+
void set_tune(double value) {
setTuneDrive(value);
if(display_sliders) {
#ifndef _SLIDERS_H
#define _SLIDERS_H
-int update_af_gain(void *data);
+extern int update_agc_gain(void *);
+extern int update_af_gain(void *);
+extern int update_mic_gain(void *);
+extern int update_drive(void *);
void set_agc_gain(double value);
void set_af_gain(double value);
--- /dev/null
+/* Copyright (C)
+* 2016 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+
+static GtkWidget *parent_window=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 gboolean test_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ gtk_window_iconify(GTK_WINDOW(parent_window));
+ return TRUE;
+}
+
+void test_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_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);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close Test");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *test_b=gtk_button_new_with_label("Test");
+ g_signal_connect (test_b, "pressed", G_CALLBACK(test_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),test_b,0,1,1,1);
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
--- /dev/null
+/* Copyright (C)
+* 2016 - John Melton, G0ORX/N6LYT
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*
+*/
+
+void test_menu(GtkWidget *parent);
}
void setFilter(int low,int high) {
+
if(mode==modeCWL) {
filterLow=-cw_keyer_sidetone_frequency-low;
filterHigh=-cw_keyer_sidetone_frequency+high;
filterHigh=high;
}
+ RXASetPassband(receiver,(double)filterLow,(double)filterHigh);
+
double fl=filterLow+ddsOffset;
double fh=filterHigh+ddsOffset;
-
- //RXANBPSetFreqs(receiver,(double)filterLow,(double)filterHigh);
- //SetRXABandpassFreqs(receiver, fl,fh);
- //SetRXASNBAOutputBandwidth(receiver, (double)filterLow, (double)filterHigh);
- RXASetPassband(receiver,fl,fh);
-
SetTXABandpassFreqs(CHANNEL_TX, fl,fh);
+
}
int getFilterLow() {
RXANBPSetShiftFrequency(receiver, (double)offset);
SetRXAShiftRun(receiver, 1);
}
-
-/*
- BAND *band=band_get_current_band();
- BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
- setFrequency(entry->frequencyA);
- setMode(entry->mode);
- FILTER* band_filters=filters[entry->mode];
- FILTER* band_filter=&band_filters[entry->filter];
- setFilter(band_filter->low,band_filter->high);
-*/
}
void wdsp_set_input_rate(double rate) {