From 6441c1d98684feaebd58734989392a37084bcd00 Mon Sep 17 00:00:00 2001 From: Daniele Forsi IU5HKX Date: Sun, 21 Dec 2025 14:18:14 +0100 Subject: [PATCH] Handle the firmwares that don't echo the commands Fixes #1968. --- rotators/skywatcher/skywatcher.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/rotators/skywatcher/skywatcher.c b/rotators/skywatcher/skywatcher.c index 441a4c95b..787f8e0fa 100644 --- a/rotators/skywatcher/skywatcher.c +++ b/rotators/skywatcher/skywatcher.c @@ -60,7 +60,8 @@ static int skywatcher_cmd(ROT *rot, const char *cmd, char *response, rig_flush(port); size_t cmd_len = strlen(cmd); ERROR_CHECK(write_block(port, (unsigned char *) cmd, cmd_len)); - // echo from the device + // Some firmwares echo the commands and some don't, so this may be the echo + // of the command sent above or the response int code = read_string(port, (unsigned char *) response, response_len, "\r", 1, 0, 1); @@ -69,13 +70,15 @@ static int skywatcher_cmd(ROT *rot, const char *cmd, char *response, return code; } - // the actual response - code = read_string(port, (unsigned char *) response, response_len, "\r", 1, 0, + // If we got echo from the device, then get the actual response + if (response[0] == ':') { + code = read_string(port, (unsigned char *) response, response_len, "\r", 1, 0, 1); - if (code < 0) - { - return code; + if (code < 0) + { + return code; + } } // nullify last \r