]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
store and use the original real attenuation value before truncation
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Fri, 14 Jan 2022 10:57:19 +0000 (16:27 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Fri, 14 Jan 2022 10:57:19 +0000 (16:27 +0530)
rigctl.c
sliders.c

index 67e7cf2db2d158dbc3eaf65f7578569866ee78cf..6ab71dc0d324880b9450d15fc0cd85a9b1312191 100644 (file)
--- a/rigctl.c
+++ b/rigctl.c
@@ -3463,7 +3463,7 @@ int parse_cmd(void *data) {
       if (command[2] == ';') {
         double att = 0.0;
         if (have_rx_gain) {
-          att = adc[active_receiver->adc].attenuation + 12.0;
+          att = adc[active_receiver->adc].attenuation_orig + 12.0;
           printf("after stage 1: %f\n", att);
           att = round(att * (99.0 / 60.0));
           printf("after stage 2: %f\n", att);
@@ -3480,7 +3480,7 @@ int parse_cmd(void *data) {
           printf("setting attn level [0..99]: %d\n", attI);
 
           if (have_rx_gain) {
-              att = round(((attI * 60.0) / 99.0) - 12.0);
+              att = ((attI * 60.0) / 99.0) - 12.0;
           } else {
               att = (attI * 31.0) / 99.0;
           }
index 61569adea121c1868373f184295c10b76f6e0eb9..f5d63ce1dc7faa832ea7107d8a2c8e4dff6599d9 100644 (file)
--- a/sliders.c
+++ b/sliders.c
@@ -154,7 +154,8 @@ static void attenuation_value_changed_cb(GtkWidget *widget, gpointer data) {
 void set_attenuation_value(double value) {
   g_print("%s\n",__FUNCTION__);
   printf("last attn value: %d, setting it to: %f\n", adc[active_receiver->adc].attenuation, value);
-  adc[active_receiver->adc].attenuation=(int)value;
+  adc[active_receiver->adc].attenuation_orig = value;
+  adc[active_receiver->adc].attenuation = (int)value;
   set_attenuation(adc[active_receiver->adc].attenuation);
   if(display_sliders) {
     if (have_rx_gain) {