From 273388b39844566523d476837e2e9128be875831 Mon Sep 17 00:00:00 2001 From: c vw Date: Fri, 6 Mar 2020 11:54:33 +0100 Subject: [PATCH] some "cppcheck" code polishing (unused variables etc.) --- diversity_menu.c | 56 ------------------------------------------------ diversity_menu.h | 4 ---- gpio.c | 4 ++-- meter.c | 16 -------------- rigctl.c | 8 ------- tx_menu.c | 2 -- xvtr_menu.c | 2 -- 7 files changed, 2 insertions(+), 90 deletions(-) diff --git a/diversity_menu.c b/diversity_menu.c index eac362e..47ac76d 100644 --- a/diversity_menu.c +++ b/diversity_menu.c @@ -150,34 +150,6 @@ void update_diversity_gain(double increment) { set_gain_phase(); } -void update_diversity_gain_coarse(double increment) { - double g=gain_coarse+increment; - if(g<-25.0) g=-25.0; - if(g>25.0) g=25.0; - gain_coarse=g; - div_gain=gain_coarse+gain_fine; - if(gain_coarse_scale!=NULL) { - gtk_range_set_value(GTK_RANGE(gain_coarse_scale),gain_coarse); - } else { - show_diversity_gain(); - } - set_gain_phase(); -} - -void update_diversity_gain_fine(double increment) { - double g=gain_fine+(increment/100); - if(g<-2.0) g=-2.0; - if(g>2.0) g=2.0; - gain_fine=g; - div_gain=gain_coarse+gain_fine; - if(gain_fine_scale!=NULL) { - gtk_range_set_value(GTK_RANGE(gain_fine_scale),gain_fine); - } else { - show_diversity_gain(); - } - set_gain_phase(); -} - void update_diversity_phase(double increment) { double p=div_phase+increment; while (p > 180.0) p -= 360.0; @@ -197,34 +169,6 @@ void update_diversity_phase(double increment) { set_gain_phase(); } -void update_diversity_phase_coarse(double increment) { - double p=phase_coarse+increment; - if (p > 180.0) p = 180.0; - if (p < -180.0) p = -180.0; - phase_coarse=p; - if(phase_coarse_scale!=NULL) { - gtk_range_set_value(GTK_RANGE(phase_coarse_scale),phase_coarse); - } else { - show_diversity_phase(); - } - div_phase=phase_coarse+phase_fine; - set_gain_phase(); -} - -void update_diversity_phase_fine(double increment) { - double p=phase_fine+(increment/10.0); - while (p > 5.0) p = 5.0; - while (p < -5.0) p = -5.0; - phase_fine=p; - if(phase_fine_scale!=NULL) { - gtk_range_set_value(GTK_RANGE(phase_fine_scale),phase_fine); - } else { - show_diversity_phase(); - } - div_phase=phase_coarse+phase_fine; - set_gain_phase(); -} - void diversity_menu(GtkWidget *parent) { parent_window=parent; diff --git a/diversity_menu.h b/diversity_menu.h index 59d63b8..b71588f 100644 --- a/diversity_menu.h +++ b/diversity_menu.h @@ -19,8 +19,4 @@ extern void diversity_menu(GtkWidget *parent); extern void update_diversity_gain(double increment); -extern void update_diversity_gain_coarse(double increment); -extern void update_diversity_gain_fine(double increment); extern void update_diversity_phase(double increment); -extern void update_diversity_phase_coarse(double increment); -extern void update_diversity_phase_fine(double increment); diff --git a/gpio.c b/gpio.c index 2ab33d5..57fd76a 100644 --- a/gpio.c +++ b/gpio.c @@ -1378,11 +1378,11 @@ void gpio_save_state() { if(controller!=CONTROLLER1) { setProperty("i2c_device",i2c_device); - sprintf(value,"%d",i2c_address_1); + sprintf(value,"%ud",i2c_address_1); setProperty("i2c_address_1",value); for(int i=0;i<16;i++) { sprintf(name,"i2c_sw[%d]",i); - sprintf(value,"%d",i2c_sw[i]); + sprintf(value,"%ud",i2c_sw[i]); setProperty(name,value); } diff --git a/meter.c b/meter.c index 1a691d5..4441f24 100644 --- a/meter.c +++ b/meter.c @@ -147,7 +147,6 @@ void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double char sf[32]; int text_location; double offset; - int max_power=100; char *units="W"; double interval=10.0; cairo_t *cr = cairo_create (meter_surface); @@ -159,33 +158,26 @@ void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double } switch(pa_power) { case PA_1W: - max_power=1000; units="mW"; interval=100.0; level=level*1000.0; break; case PA_10W: - max_power=10; interval=1.0; break; case PA_30W: - max_power=30; interval=3.0; break; case PA_50W: - max_power=50; interval=5.0; break; case PA_100W: - max_power=100; interval=10.0; break; case PA_200W: - max_power=200; interval=20.0; break; case PA_500W: - max_power=500; interval=50.0; break; } @@ -339,37 +331,29 @@ if(analog_meter) { cairo_set_line_width(cr, 1.0); cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); - int max_power=100; char *units="W"; double interval=10.0; switch(pa_power) { case PA_1W: - max_power=1000; units="mW"; interval=100.0; break; case PA_10W: - max_power=10; interval=1.0; break; case PA_30W: - max_power=30; interval=3.0; break; case PA_50W: - max_power=50; interval=5.0; break; case PA_100W: - max_power=100; interval=10.0; break; case PA_200W: - max_power=200; interval=20.0; break; case PA_500W: - max_power=500; interval=50.0; break; } diff --git a/rigctl.c b/rigctl.c index d452ca5..ba0c1b4 100644 --- a/rigctl.c +++ b/rigctl.c @@ -84,8 +84,6 @@ int connect_cnt = 0; int rigctlGetFilterLow(); int rigctlGetFilterHigh(); -void rigctlSetFilterLow(int val); -void rigctlSetFilterHigh(int val); int new_level; int active_transmitter = 0; int rigctl_busy = 0; // Used to tell rigctl_menu that launch has already occured @@ -3956,12 +3954,6 @@ int rigctlGetMode() { } } -// Changed these two functions to void -void rigctlSetFilterLow(int val){ -}; -void rigctlSetFilterHigh(int val){ -}; - void set_freqB(long long new_freqB) { vfo[VFO_B].frequency = new_freqB; diff --git a/tx_menu.c b/tx_menu.c index f519912..3ee5513 100644 --- a/tx_menu.c +++ b/tx_menu.c @@ -405,8 +405,6 @@ void tx_menu(GtkWidget *parent) { row++; col=0; - int saved_row=row; - GtkWidget *panadapter_high_label=gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(panadapter_high_label), "Panadapter High: "); #ifdef GTK316 diff --git a/xvtr_menu.c b/xvtr_menu.c index c8b7d83..7126cc1 100644 --- a/xvtr_menu.c +++ b/xvtr_menu.c @@ -52,8 +52,6 @@ static void save_xvtr () { const char *maxf; const char *lof; const char *loerr; - const char *txlof; // used in temporarily de-activated code - const char *txloerr; // used in temporarily de-activated code for(i=BANDS;ibandstack; -- 2.45.2