diff --git a/rotators/gs232a/gs232a.c b/rotators/gs232a/gs232a.c index 8d8685877..d837ed4ba 100644 --- a/rotators/gs232a/gs232a.c +++ b/rotators/gs232a/gs232a.c @@ -180,33 +180,27 @@ static int gs232a_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; - int retval, angle; + int retval, int_az, int_el = 0; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); retval = gs232a_transaction(rot, "C2" EOM, posbuf, sizeof(posbuf), 0); - if (retval != RIG_OK || strlen(posbuf) < 10) + if (retval != RIG_OK) { - return retval < 0 ? retval : -RIG_EPROTO; + return retval; } - /* parse "+0aaa+0eee" */ - if (sscanf(posbuf + 2, "%d", &angle) != 1) + // parse "+0aaa+0eee" and expect both arguments + if (sscanf(posbuf, "+0%d+0%d", &int_az, &int_el) != 2) { - rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __func__, posbuf); + rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s', not +0xxx+0xxx format?\n", + __func__, posbuf); return -RIG_EPROTO; } - *az = (azimuth_t)angle; - - if (sscanf(posbuf + 7, "%d", &angle) != 1) - { - rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __func__, posbuf); - return -RIG_EPROTO; - } - - *el = (elevation_t)angle; + *az = (azimuth_t) int_az; + *el = (elevation_t) int_el; rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __func__, *az, *el); @@ -298,9 +292,9 @@ const struct rot_caps gs23_rot_caps = ROT_MODEL(ROT_MODEL_GS23), .model_name = "GS-23", .mfg_name = "Yaesu/Kenpro", - .version = "20200505.0", + .version = "20200617.0", .copyright = "LGPL", - .status = RIG_STATUS_ALPHA, + .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 150, diff --git a/rotators/gs232a/gs232b.c b/rotators/gs232a/gs232b.c index f0b210739..935f4e4d3 100644 --- a/rotators/gs232a/gs232b.c +++ b/rotators/gs232a/gs232b.c @@ -141,7 +141,8 @@ transaction_write: #endif #if 0 - https://github.com/Hamlib/Hamlib/issues/272 +https://github.com/Hamlib/Hamlib/issues/272 + // If asked for we will check for connection // we don't expect a reply...just a prompt return // Seems some GS232B's only echo the CR @@ -152,6 +153,7 @@ transaction_write: __func__, data, cmdstr); return -RIG_EPROTO; } + #endif if (data[0] == '?') @@ -207,7 +209,7 @@ static int gs232b_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; - int retval, int_az, int_el; + int retval, int_az = 0, int_el = 0; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); @@ -223,9 +225,10 @@ gs232b_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) /* With the format string containing a space character as one of the * directives, any amount of space is matched, including none in the input. */ - if (sscanf(posbuf, "AZ=%d EL=%d", &int_az, &int_el) != 2) - { - rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __func__, + // There's a 12PR1A rotor that only returns AZ so we may only get AZ=xxx + if (sscanf(posbuf, "AZ=%d EL=%d", &int_az, &int_el) == 0) + { // only give error if we didn't parse anything + rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s', expected AZ=xxx EL=xxx\n", __func__, posbuf); return -RIG_EPROTO; } @@ -324,7 +327,7 @@ const struct rot_caps gs232b_rot_caps = ROT_MODEL(ROT_MODEL_GS232B), .model_name = "GS-232B", .mfg_name = "Yaesu", - .version = "20200615.0", + .version = "20200617.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_OTHER,