From: Ramakrishnan Muthukrishnan Date: Wed, 12 Jan 2022 06:33:37 +0000 (+0530) Subject: rewrite gain mapping equations X-Git-Url: https://git.rkrishnan.org/Site/Content/simplejson/status?a=commitdiff_plain;h=780fad88ff125a2b066ff9ccb46fe7f2cfd86e67;p=pihpsdr.git rewrite gain mapping equations --- diff --git a/rigctl.c b/rigctl.c index 6e96455..6f48425 100644 --- a/rigctl.c +++ b/rigctl.c @@ -1820,12 +1820,12 @@ gboolean parse_extended_cmd(char *command, CLIENT *client) { // set/read mic gain if (command[4] == ';') { memset(reply, '\0', 9); - sprintf(reply, "ZZMG%03d;", (int)(((mic_gain + 12.0) / 72.0) * 100.0)); + sprintf(reply, "ZZMG%03d;", (int)(((mic_gain * 100.0) / 72.0) + 12)); send_resp(client->fd, reply); } else if (command[7] == ';') { command[7] = '\0'; double gain = (double)atoi(&command[4]); - gain = ((gain / 100.0) * 72.0) - 12.0; + gain = (((gain - 12) / 100.0) * 72.0); set_mic_gain(gain); } break;