diff --git a/gps.c b/gps.c index b9da02a..a386f83 100644 --- a/gps.c +++ b/gps.c @@ -178,7 +178,7 @@ char gps_parse(gpsfix_t *gps) break; case 3: /* Latitude hemisphere */ - if(*r == 'S') gps->latitude_i = -gps->latitude_i; + gps->latitude_h = (*r == 'S' ? 'S' : 'N'); break; case 4: /* Longitude */ @@ -187,7 +187,7 @@ char gps_parse(gpsfix_t *gps) break; case 5: /* Longitude hemisphere */ - if(*r == 'W') gps->longitude_i = -gps->longitude_i; + gps->longitude_h = (*r == 'W' ? 'W' : 'E'); break; case 6: /* Fix quality */ diff --git a/gps.h b/gps.h index cb0f28b..a37f540 100644 --- a/gps.h +++ b/gps.h @@ -15,9 +15,11 @@ typedef struct { int16_t latitude_i; /* -180-180 */ uint32_t latitude_f; /* 0-999999 */ + char latitude_h; /* Hemisphere */ int16_t longitude_i; /* -180-180 */ uint32_t longitude_f; /* 0-999999 */ + char longitude_h; /* Hemisphere */ int32_t altitude; /* 0-99999 */ diff --git a/hadie.c b/hadie.c index 1d999e7..82ba185 100644 --- a/hadie.c +++ b/hadie.c @@ -195,10 +195,12 @@ char tx_telemetry(void) rtx_wait(); snprintf(msg, MSG_SIZE, - PREFIX CALLSIGN ",%u,%02i:%02i:%02i,%i.%06lu,%i.%06lu,%li,%i:%i", + PREFIX CALLSIGN ",%u,%02i:%02i:%02i,%s%i.%06lu,%s%i.%06lu,%li,%i:%i", counter++, gps.hour, gps.minute, gps.second, + (gps.latitude_h == 'S' ? "-" : ""), gps.latitude_i, gps.latitude_f, + (gps.longitude_h == 'W' ? "-" : ""), gps.longitude_i, gps.longitude_f, gps.altitude, gps.fix, gps.sats);