]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
more experiments with rounding
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Fri, 14 Jan 2022 09:06:29 +0000 (14:36 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Fri, 14 Jan 2022 09:06:29 +0000 (14:36 +0530)
rigctl.c

index f8297fe9eb0912aaa3c1973f58c49be38e03c351..21a3fb54bdecca090dcf71416fec17a666c16d7d 100644 (file)
--- a/rigctl.c
+++ b/rigctl.c
@@ -3463,7 +3463,7 @@ int parse_cmd(void *data) {
       if (command[2] == ';') {
         int att = 0;
         if (have_rx_gain) {
-          att = (int)(adc[active_receiver->adc].attenuation + 12);
+          att = (int)round(adc[active_receiver->adc].attenuation + 12);
           att = (int)round((att * 99.0) / 60.0);
         } else {
           att = (int)(adc[active_receiver->adc].attenuation);
@@ -3475,7 +3475,7 @@ int parse_cmd(void *data) {
           command[4] = '\0';
           int att = strtol(&command[2], NULL, 10);
           if (have_rx_gain) {
-              att = (int)round(((att * 60.0) / 99.0)) - 12;
+              att = (int)round(((att * 60.0) / 99.0) - 12.0);
           } else {
               att = (int)round((att * 31.0) / 99.0);
           }