From 2b4d79c54a863f540d3741d9fae2d68019eb6afe Mon Sep 17 00:00:00 2001 From: John Melton G0ORX Date: Sat, 21 Mar 2020 14:18:11 +0000 Subject: [PATCH] add ability to turn off/on sequence error display --- display_menu.c | 12 ++++++++++++ radio.c | 10 +++++++++- radio.h | 3 ++- rx_panadapter.c | 22 ++++++++++++---------- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/display_menu.c b/display_menu.c index 2097ffb..a47b683 100644 --- a/display_menu.c +++ b/display_menu.c @@ -134,6 +134,10 @@ static void display_toolbar_cb(GtkWidget *widget, gpointer data) { reconfigure_radio(); } +static void display_sequence_errors_cb(GtkWidget *widget, gpointer data) { + display_sequence_errors=display_sequence_errors==1?0:1; +} + void display_menu(GtkWidget *parent) { parent_window=parent; @@ -438,6 +442,14 @@ void display_menu(GtkWidget *parent) { gtk_grid_attach(GTK_GRID(grid),b_display_toolbar,col,row,1,1); g_signal_connect(b_display_toolbar,"toggled",G_CALLBACK(display_toolbar_cb),(gpointer *)NULL); + col++; + + GtkWidget *b_display_sequence_errors=gtk_check_button_new_with_label("Display Seq Errs"); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_sequence_errors), display_sequence_errors); + gtk_widget_show(b_display_sequence_errors); + gtk_grid_attach(GTK_GRID(grid),b_display_sequence_errors,col,row,1,1); + g_signal_connect(b_display_sequence_errors,"toggled",G_CALLBACK(display_sequence_errors_cb),(gpointer *)NULL); + gtk_container_add(GTK_CONTAINER(content),grid); sub_menu=dialog; diff --git a/radio.c b/radio.c index d173d35..d498650 100644 --- a/radio.c +++ b/radio.c @@ -321,7 +321,8 @@ int can_transmit=0; gboolean duplex=FALSE; gboolean mute_rx_while_transmitting=FALSE; -int sequence_errors=0; +gboolean display_sequence_errors=TRUE; +gint sequence_errors=0; gint rx_height; @@ -941,6 +942,8 @@ void start_radio() { average_current=0; n_current=0; + display_sequence_errors=TRUE; + radioRestoreState(); // @@ -2028,6 +2031,8 @@ g_print("radioRestoreState: %s\n",property_path); } #endif + value=getProperty("radio.display_sequence_errors"); + if(value!=NULL) display_sequence_errors=atoi(value); //g_print("sem_post\n"); #ifdef __APPLE__ @@ -2323,6 +2328,9 @@ g_print("radioSaveState: %s\n",property_path); sprintf(value,"%d",rigctl_port_base); setProperty("rigctl_port_base",value); + sprintf(value,"%d",display_sequence_errors); + setProperty("radio.display_sequence_errors",value); + saveProperties(property_path); g_print("sem_post\n"); #ifdef __APPLE__ diff --git a/radio.h b/radio.h index 3b4127b..ef826a6 100644 --- a/radio.h +++ b/radio.h @@ -299,7 +299,8 @@ extern int have_rx_gain; // TRUE on HermesLite/RadioBerry extern int rx_gain_calibration; // position of the RX gain slider that // corresponds to zero amplification/attenuation -extern int sequence_errors; +extern gboolean display_sequence_errors; +extern gint sequence_errors; extern void radio_stop(); extern void reconfigure_radio(); diff --git a/rx_panadapter.c b/rx_panadapter.c index f6e41f3..7771b4c 100644 --- a/rx_panadapter.c +++ b/rx_panadapter.c @@ -553,16 +553,18 @@ void rx_panadapter_update(RECEIVER *rx) { } #endif - if(sequence_errors!=0) { - cairo_move_to(cr,100.0,50.0); - cairo_set_source_rgb(cr,1.0,0.0,0.0); - cairo_set_font_size(cr,12); - cairo_show_text(cr, "Sequence Error"); - sequence_error_count++; - // show for 2 second - if(sequence_error_count==2*rx->fps) { - sequence_errors=0; - sequence_error_count=0; + if(display_sequence_errors) { + if(sequence_errors!=0) { + cairo_move_to(cr,100.0,50.0); + cairo_set_source_rgb(cr,1.0,0.0,0.0); + cairo_set_font_size(cr,12); + cairo_show_text(cr, "Sequence Error"); + sequence_error_count++; + // show for 2 second + if(sequence_error_count==2*rx->fps) { + sequence_errors=0; + sequence_error_count=0; + } } } -- 2.45.2