summaryrefslogtreecommitdiff
path: root/lcdgps.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-02-22 15:44:05 -0800
committerGary E. Miller <gem@rellim.com>2019-02-22 15:44:05 -0800
commitf1be39110e39e5c8d095200231a75aea3afecd57 (patch)
tree77d43f78b8235d2a9e085d80c3a2631d12505d03 /lcdgps.c
parent1db29a3fa49eca5929ba03346eac7cd49f58e86d (diff)
downloadgpsd-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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lcdgps.c b/lcdgps.c
index 6d0eccf5..dc3cca0d 100644
--- a/lcdgps.c
+++ b/lcdgps.c
@@ -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