From: Ramakrishnan Muthukrishnan Date: Fri, 14 Jan 2022 09:10:51 +0000 (+0530) Subject: more rounding and float to integer experiments X-Git-Url: https://git.rkrishnan.org/Site/Content/simplejson/status?a=commitdiff_plain;h=e212bc757bece2d57860fc97e3bbc99a16367822;p=pihpsdr.git more rounding and float to integer experiments --- 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';