From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Sun, 22 Jan 2023 17:19:27 +0000 (+0530)
Subject: rigctl: ZZAR - take care of the sign of the agc threshold reply
X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/frontends/module-simplejson.decoder.html?a=commitdiff_plain;h=c760d12ff1787b14f628e89a7a9380a559a31d4f;p=pihpsdr.git

rigctl: ZZAR - take care of the sign of the agc threshold reply
---

diff --git a/rigctl.c b/rigctl.c
index df87081..6024661 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -973,7 +973,12 @@ gboolean parse_extended_cmd(char *command, CLIENT *client) {
       // read/set RX0 AGC Threshold
       if (command[4] == ';') {
         // send reply back
-        sprintf(reply, "ZZAR%+04d;", (int)(receiver[0]->agc_gain));
+        memset(reply, '\0', 10);
+        if (receiver[0]->agc_gain >= 0) {
+            sprintf(reply, "ZZAR+%+03d;", (int)(receiver[0]->agc_gain));
+        } else {
+            sprintf(reply, "ZZAR-%+03d;", (int)(receiver[0]->agc_gain));
+        }
         send_resp(client->fd, reply);
       } else {
         int threshold = atoi(&command[4]);