Bug fix in set_pos about protocol compliance. Problem seen

with the Alpha SPID BIG-RAS rotator by Magne / LA1BFA.
In get_pos, changed angle parsing in order to do away with
float parsing of an interger only value.


git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2700 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.10
Stéphane Fillod, F8CFE 2009-06-01 13:58:13 +00:00
rodzic 4776b181f6
commit 1505ddb1d7
1 zmienionych plików z 17 dodań i 14 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
/*
* Hamlib Rotator backend - GS-232A
* Copyright (c) 2001-2008 by Stephane Fillod
* Copyright (c) 2001-2009 by Stephane Fillod
*
* $Id: gs232a.c,v 1.2 2008-10-26 13:38:51 y32kn Exp $
*
@ -130,7 +130,7 @@ gs232a_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
u_az = (unsigned)rint(az);
u_el = (unsigned)rint(el);
sprintf(cmdstr, "W %03u %03u" EOM, u_az, u_el);
sprintf(cmdstr, "W%03u %03u" EOM, u_az, u_el);
retval = gs232a_transaction(rot, cmdstr, NULL, 0);
if (retval != RIG_OK) {
@ -144,7 +144,7 @@ static int
gs232a_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
{
char posbuf[32];
int retval;
int retval, angle;
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__);
@ -154,14 +154,17 @@ gs232a_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
}
/* parse */
if (sscanf(posbuf+2, "%f", az) != 1) {
if (sscanf(posbuf+2, "%d", &angle) != 1) {
rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf);
return -RIG_EPROTO;
}
if (sscanf(posbuf+7, "%f", el) != 1) {
*az = (azimuth_t)angle;
if (sscanf(posbuf+7, "%d", &angle) != 1) {
rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf);
return -RIG_EPROTO;
}
*el = (elevation_t)angle;
rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n",
__FUNCTION__, *az, *el);
@ -238,9 +241,9 @@ const struct rot_caps gs232a_rot_caps = {
.rot_model = ROT_MODEL_GS232A,
.model_name = "GS-232A",
.mfg_name = "Yaesu",
.version = "0.1",
.version = "0.2",
.copyright = "LGPL",
.status = RIG_STATUS_UNTESTED,
.status = RIG_STATUS_BETA,
.rot_type = ROT_TYPE_OTHER,
.port_type = RIG_PORT_SERIAL,
.serial_rate_min = 150,