From e212bc757bece2d57860fc97e3bbc99a16367822 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Fri, 14 Jan 2022 14:40:51 +0530
Subject: [PATCH] more rounding and float to integer experiments

---
 rigctl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/rigctl.c b/rigctl.c
index 21a3fb5..a569dba 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -3461,15 +3461,15 @@ int parse_cmd(void *data) {
     case 'A': // RA
       // set/read Attenuator function
       if (command[2] == ';') {
-        int att = 0;
+        double att = 0.0;
         if (have_rx_gain) {
-          att = (int)round(adc[active_receiver->adc].attenuation + 12);
-          att = (int)round((att * 99.0) / 60.0);
+          att = adc[active_receiver->adc].attenuation + 12.0);
+          att = round((att * 99.0) / 60.0);
         } else {
-          att = (int)(adc[active_receiver->adc].attenuation);
-          att = (int)round((att * 99.0) / 31.0);
+          att = adc[active_receiver->adc].attenuation;
+          att = round((att * 99.0) / 31.0);
         }
-        sprintf(reply, "RA%02d00;", att);
+        sprintf(reply, "RA%02d00;", (int)att);
         send_resp(client->fd, reply);
       } else if (command[4] == ';') {
           command[4] = '\0';
-- 
2.45.2