kopia lustrzana https://github.com/fsphil/hadie
Store GPS hemisphere separately -- old method couldn't handle positions between 0 and -1 degrees.
rodzic
be2ce1a11a
commit
bfd33257d0
4
gps.c
4
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 */
|
||||
|
|
2
gps.h
2
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 */
|
||||
|
||||
|
|
4
hadie.c
4
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);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue