From 2746f9d038a9636f8d2dcd35968e3127a0ed3389 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 8 Dec 2020 14:40:17 +0000 Subject: [PATCH] More code cleanup --- display_menu.c | 37 ++++++++++++++++++++----------------- i2c_controller.c | 3 +-- radio.c | 15 ++++++++++----- zoompan.c | 4 ++-- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/display_menu.c b/display_menu.c index 7dbf1e3..0dba23b 100644 --- a/display_menu.c +++ b/display_menu.c @@ -24,6 +24,7 @@ #include #include +#include "main.h" #include "new_menu.h" #include "display_menu.h" #include "channel.h" @@ -439,23 +440,25 @@ void display_menu(GtkWidget *parent) { col++; - GtkWidget *b_display_sliders=gtk_check_button_new_with_label("Display Sliders"); - //gtk_widget_override_font(b_display_sliders, pango_font_description_from_string("Arial 18")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_sliders), display_sliders); - gtk_widget_show(b_display_sliders); - gtk_grid_attach(GTK_GRID(grid),b_display_sliders,col,row,1,1); - g_signal_connect(b_display_sliders,"toggled",G_CALLBACK(display_sliders_cb),(gpointer *)NULL); - - col++; - - GtkWidget *b_display_toolbar=gtk_check_button_new_with_label("Display Toolbar"); - //gtk_widget_override_font(b_display_toolbar, pango_font_description_from_string("Arial 18")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_toolbar), display_toolbar); - gtk_widget_show(b_display_toolbar); - 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++; + if(controller!=CONTROLLER_I2C) { + GtkWidget *b_display_sliders=gtk_check_button_new_with_label("Display Sliders"); + //gtk_widget_override_font(b_display_sliders, pango_font_description_from_string("Arial 18")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_sliders), display_sliders); + gtk_widget_show(b_display_sliders); + gtk_grid_attach(GTK_GRID(grid),b_display_sliders,col,row,1,1); + g_signal_connect(b_display_sliders,"toggled",G_CALLBACK(display_sliders_cb),(gpointer *)NULL); + + col++; + + GtkWidget *b_display_toolbar=gtk_check_button_new_with_label("Display Toolbar"); + //gtk_widget_override_font(b_display_toolbar, pango_font_description_from_string("Arial 18")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_display_toolbar), display_toolbar); + gtk_widget_show(b_display_toolbar); + 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); diff --git a/i2c_controller.c b/i2c_controller.c index e5d7666..9827f78 100644 --- a/i2c_controller.c +++ b/i2c_controller.c @@ -252,8 +252,7 @@ static void i2c_interrupt(int line) { } __s32 status=i2c_smbus_read_byte_data(fd,REG_ESTATUS); - g_print("%s: address=%02X status=%02X\n",__FUNCTION__,encoder[i].address,status&0xFF); - + //g_print("%s: address=%02X status=%02X\n",__FUNCTION__,encoder[i].address,status&0xFF); if(status&PUSHR) { //g_print("%s: PUSHR\n",__FUNCTION__); diff --git a/radio.c b/radio.c index 290481c..ed6d2cf 100644 --- a/radio.c +++ b/radio.c @@ -169,7 +169,7 @@ int panadapter_high=-40; int panadapter_low=-140; int display_filled=1; -int display_gradient=0; +int display_gradient=1; int display_detector_mode=DETECTOR_MODE_AVERAGE; int display_average_mode=AVERAGE_MODE_LOG_RECURSIVE; double display_average_time=120.0; @@ -1152,16 +1152,21 @@ void start_radio() { #ifdef GPIO switch(controller) { + case NO_CONTROLLER: + display_zoompan=1; + display_sliders=1; + display_toolbar=1; + break; case CONTROLLER2_V1: case CONTROLLER2_V2: display_zoompan=1; display_sliders=0; display_toolbar=0; break; - default: - display_zoompan=1; - display_sliders=1; - display_toolbar=1; + case CONTROLLER_I2C: + display_zoompan=0; + display_sliders=0; + display_toolbar=0; break; } #else diff --git a/zoompan.c b/zoompan.c index bcf86c9..91bda57 100644 --- a/zoompan.c +++ b/zoompan.c @@ -96,7 +96,7 @@ g_print("zoom_value_changed_cb\n"); } void set_zoom(int rx,double value) { -g_print("set_zoom: %f\n",value); +//g_print("set_zoom: %f\n",value); receiver[rx]->zoom=value; if(display_zoompan) { gtk_range_set_value (GTK_RANGE(zoom_scale),receiver[rx]->zoom); @@ -145,7 +145,7 @@ g_print("remote_set_zoom: EXIT\n"); } void update_zoom(double zoom) { -g_print("update_zoom: %f\n",zoom); +//g_print("update_zoom: %f\n",zoom); int z=active_receiver->zoom+(int)zoom; if(z>MAX_ZOOM) z=MAX_ZOOM; if(z<1) z=1; -- 2.45.2