From 8ff3fa2e7e1fc741d4dbf86ac94aa1dbe5bc602b Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 12 Jan 2022 12:16:53 +0530
Subject: [PATCH] mic gain: wrong range mapping equations

---
 rigctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rigctl.c b/rigctl.c
index 6f48425..779506d 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 * 100.0) / 72.0) + 12));
+            sprintf(reply, "ZZMG%03d;", (int)(((mic_gain + 12.0) * 100.0 / 62.0)));
             send_resp(client->fd, reply);
         } else if (command[7] == ';') {
             command[7] = '\0';
             double gain = (double)atoi(&command[4]);
-            gain = (((gain - 12) / 100.0) * 72.0);
+            gain = (((gain / 100.0) * 62.0) - 12.0;
             set_mic_gain(gain);
         }
         break;
-- 
2.45.2