From f434ef5f3ccf650e98ecfd5b91bd30a7d6b74e63 Mon Sep 17 00:00:00 2001 From: c vw Date: Tue, 2 Nov 2021 20:05:48 +0100 Subject: [PATCH] Fixed bugs in RFGAIN processing. --- actions.c | 3 +-- sliders.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/actions.c b/actions.c index 3b019f2..4bb665d 100644 --- a/actions.c +++ b/actions.c @@ -840,7 +840,7 @@ int process_action(void *data) { active_receiver->panadapter_high=(int)value; break; case PANADAPTER_LOW: - value=KnobOrWheel(a, active_receiver->panadapter_high, -160.0, -60.0, 1.0); + value=KnobOrWheel(a, active_receiver->panadapter_low, -160.0, -60.0, 1.0); active_receiver->panadapter_low=(int)value; break; case PANADAPTER_STEP: @@ -871,7 +871,6 @@ int process_action(void *data) { break; case RF_GAIN_RX1: value=KnobOrWheel(a, adc[receiver[0]->adc].gain, adc[receiver[0]->adc].min_gain, adc[receiver[0]->adc].max_gain, 1.0); - value=KnobOrWheel(a, adc[receiver[0]->adc].gain, 0.0, 100.0, 1.0); set_rf_gain(0,value); break; case RF_GAIN_RX2: diff --git a/sliders.c b/sliders.c index 476352c..82a536c 100644 --- a/sliders.c +++ b/sliders.c @@ -394,21 +394,21 @@ void update_rf_gain() { } void set_rf_gain(int rx,double value) { - g_print("%s\n",__FUNCTION__); + int rxadc=receiver[rx]->adc; + g_print("%s rx=%d adc=%d val=%f\n",__FUNCTION__, rx, rxadc, value); if (!have_rx_gain) { // ignore attempt to set gain when we do not have one g_print("%s: Ignoring attempt to set RF gain\n",__FUNCTION__); return; } - adc[receiver[rx]->adc].gain=value; + adc[rxadc].gain=value; #ifdef SOAPYSDR if(protocol==SOAPYSDR_PROTOCOL) { soapy_protocol_set_gain(receiver[rx]); } #endif if(display_sliders) { - //gtk_range_set_value (GTK_RANGE(attenuation_scale),receiver[rx]->rf_gain); - gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[receiver[rx]->id].gain); + gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[rxadc].gain); } else { if(scale_status!=RF_GAIN || scale_rx!=rx) { if(scale_status!=NO_ACTION) { @@ -421,13 +421,12 @@ void set_rf_gain(int rx,double value) { scale_status=RF_GAIN; scale_rx=rx; char title[64]; - sprintf(title,"RF Gain RX %d",rx); + sprintf(title,"RF Gain ADC %d",rxadc); scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog)); - rf_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,adc[rx].min_gain, adc[rx].max_gain, 1.0); + rf_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,adc[rxadc].min_gain, adc[rxadc].max_gain, 1.0); gtk_widget_set_size_request (rf_gain_scale, 400, 30); - //gtk_range_set_value (GTK_RANGE(rf_gain_scale),receiver[rx]->rf_gain); - gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[receiver[rx]->id].gain); + gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[rxadc].gain); gtk_widget_show(rf_gain_scale); gtk_container_add(GTK_CONTAINER(content),rf_gain_scale); scale_timer=g_timeout_add(2000,scale_timeout_cb,NULL); @@ -435,8 +434,7 @@ void set_rf_gain(int rx,double value) { gtk_dialog_run(GTK_DIALOG(scale_dialog)); } else { g_source_remove(scale_timer); - //gtk_range_set_value (GTK_RANGE(rf_gain_scale),receiver[rx]->rf_gain); - gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[receiver[rx]->id].gain); + gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[rxadc].gain); scale_timer=g_timeout_add(2000,scale_timeout_cb,NULL); } } -- 2.45.2