From e20046647c598a696fdb42a9c446340722b9dacf Mon Sep 17 00:00:00 2001 From: DL1YCF Date: Sun, 12 Sep 2021 13:46:08 +0200 Subject: [PATCH] Corrections for HL2 RXgain slider --- radio.c | 8 +++++--- sliders.c | 5 +++-- waterfall.c | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/radio.c b/radio.c index d53b766..1b95d8c 100644 --- a/radio.c +++ b/radio.c @@ -1161,10 +1161,11 @@ void start_radio() { adc[0].dither=FALSE; adc[0].random=FALSE; adc[0].preamp=FALSE; + adc[0].attenuation=0; if(have_rx_gain) { - adc[0].attenuation=14; + adc[0].gain=rx_calibration; } else { - adc[0].attenuation=0; + adc[0].gain=0; } #ifdef SOAPYSDR adc[0].antenna=0; @@ -1190,8 +1191,9 @@ void start_radio() { adc[1].dither=FALSE; adc[1].random=FALSE; adc[1].preamp=FALSE; + adc[1].attenuation=0; if(have_rx_gain) { - adc[0].attenuation=14; + adc[1].attenuation=rx_gain_calibration; } else { adc[1].attenuation=0; } diff --git a/sliders.c b/sliders.c index 24ee99b..01b9376 100644 --- a/sliders.c +++ b/sliders.c @@ -156,7 +156,8 @@ void set_attenuation_value(double value) { set_attenuation(adc[active_receiver->adc].attenuation); if(display_sliders) { if (have_rx_gain) { - gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc[active_receiver->adc].attenuation); + /* NOTREACHED */ + gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc[active_receiver->adc].gain); } else { gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc[active_receiver->adc].attenuation); } @@ -859,7 +860,7 @@ fprintf(stderr,"sliders_init: width=%d height=%d\n", width,height); } else { #endif rf_gain_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,-12.0, 48.0, 1.0); - gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[active_receiver->adc].attenuation); + gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[active_receiver->adc].gain); #ifdef SOAPYSDR } #endif diff --git a/waterfall.c b/waterfall.c index 01bb5b7..cb6850f 100644 --- a/waterfall.c +++ b/waterfall.c @@ -183,7 +183,7 @@ void waterfall_update(RECEIVER *rx) { for(i=0;iadc].attenuation); + sample=samples[i+pan]+(float)(rx_gain_calibration-adc[rx->adc].gain); } else { sample=samples[i+pan]+(float)adc[rx->adc].attenuation; } @@ -242,7 +242,7 @@ void waterfall_update(RECEIVER *rx) { if(rx->waterfall_automatic) { - rx->waterfall_low=average/display_width; + rx->waterfall_low=average/width; rx->waterfall_high=rx->waterfall_low+50; } -- 2.45.2