Refactor erc_rot_get_position to truncate ';' in returned string

before passing array pointer to atof().



git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2961 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.12
Nate Bargmann, N0NB 2010-08-23 20:35:52 +00:00
rodzic 45b72a0e31
commit 9224e0dd70
1 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -479,11 +479,10 @@ static int erc_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *eleva
/*
* ERC returns a four octet string consisting of three octets followed
* by ';' containing the rotor's position in degrees. The
* semi-colon is ignored when passing the string to atof().
* by ';' containing the rotor's position in degrees.
*/
az[4] = 0x00; /* NULL terminated string */
p = az; /* advance past leading ';' */
az[3] = 0x00; /* NULL terminated string--truncate trailing ';' */
p = az;
tmp = (azimuth_t)atof(p);
rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n",
__func__, p, tmp);