diff options
author | Gary E. Miller <gem@rellim.com> | 2019-02-22 15:44:05 -0800 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-02-22 15:44:05 -0800 |
commit | f1be39110e39e5c8d095200231a75aea3afecd57 (patch) | |
tree | 77d43f78b8235d2a9e085d80c3a2631d12505d03 /lcdgps.c | |
parent | 1db29a3fa49eca5929ba03346eac7cd49f58e86d (diff) | |
download | gpsd-f1be39110e39e5c8d095200231a75aea3afecd57.tar.gz |
deg_to_s() and calls to it: Allow negative degrees, use fabs().
Every call to deg_to_s() was preceded by a fabs(deg). So move
the fabs() into deg_to_s().
Diffstat (limited to 'lcdgps.c')
-rw-r--r-- | lcdgps.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -189,12 +189,16 @@ static void update_lcd(struct gps_data_t *gpsdata) int track; char *s; - s = deg_to_str(deg_type, fabs(gpsdata->fix.latitude)); - snprintf(tmpbuf, sizeof(tmpbuf) - 1, "widget_set gpsd one 1 1 {Lat: %s %c}\n", s, (gpsdata->fix.latitude < 0) ? 'S' : 'N'); + s = deg_to_str(deg_type, gpsdata->fix.latitude); + snprintf(tmpbuf, sizeof(tmpbuf) - 1, + "widget_set gpsd one 1 1 {Lat: %s %c}\n", s, + (gpsdata->fix.latitude < 0) ? 'S' : 'N'); send_lcd(tmpbuf); - s = deg_to_str(deg_type, fabs(gpsdata->fix.longitude)); - snprintf(tmpbuf, sizeof(tmpbuf) - 1, "widget_set gpsd two 1 2 {Lon: %s %c}\n", s, (gpsdata->fix.longitude < 0) ? 'W' : 'E'); + s = deg_to_str(deg_type, gpsdata->fix.longitude); + snprintf(tmpbuf, sizeof(tmpbuf) - 1, + "widget_set gpsd two 1 2 {Lon: %s %c}\n", s, + (gpsdata->fix.longitude < 0) ? 'W' : 'E'); send_lcd(tmpbuf); /* As a pilot, a heading of "0" gives me the heebie-jeebies (ie, 0 |