From 7334da6d89a8a5451088746e508af8f5dc6d1dd7 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Tue, 19 Dec 2023 09:29:31 -0600 Subject: [PATCH] Split AZ/EL request into two transactions for easycomm.c --- rotators/easycomm/easycomm.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/rotators/easycomm/easycomm.c b/rotators/easycomm/easycomm.c index 419c16fd8..99c3a64b6 100644 --- a/rotators/easycomm/easycomm.c +++ b/rotators/easycomm/easycomm.c @@ -135,7 +135,7 @@ easycomm_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); - SNPRINTF(cmdstr, sizeof(cmdstr), "AZ EL \n"); + SNPRINTF(cmdstr, sizeof(cmdstr), "AZ\n"); retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf)); @@ -145,16 +145,37 @@ easycomm_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) return retval; } - /* Parse parse string to extract AZ,EL values */ + /* Parse parse string to extract AZ values */ rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __func__, ackbuf); - retval = sscanf(ackbuf, "AZ%f EL%f", az, el); + retval = sscanf(ackbuf, "AZ%f", az); - if (retval != 2) + if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: unknown response (%s)\n", __func__, ackbuf); return -RIG_ERJCTED; } + SNPRINTF(cmdstr, sizeof(cmdstr), "EL\n"); + + retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf)); + + if (retval != RIG_OK) + { + rig_debug(RIG_DEBUG_TRACE, "%s got error: %d\n", __func__, retval); + return retval; + } + + /* Parse parse string to extract EL values */ + rig_debug(RIG_DEBUG_TRACE, "%s got response: %s\n", __func__, ackbuf); + retval = sscanf(ackbuf, "EL%f", el); + + if (retval != 1) + { + rig_debug(RIG_DEBUG_ERR, "%s: unknown response (%s)\n", __func__, ackbuf); + return -RIG_ERJCTED; + } + + return RIG_OK; } @@ -527,7 +548,7 @@ const struct rot_caps easycomm1_rot_caps = ROT_MODEL(ROT_MODEL_EASYCOMM1), .model_name = "EasycommI", .mfg_name = "Hamlib", - .version = "20231218.0", + .version = "20231219.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_OTHER,