diff options
author | Keith Packard <keithp@keithp.com> | 2014-02-06 17:08:34 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-02-06 17:08:34 -0800 |
commit | 4a5b3837b460d1b6fcea99312728114c4734495a (patch) | |
tree | 23cc65f626336768e67f1b1d239318b5faaaadcc /src | |
parent | 9e0bda088c097ac6bcc677d7b6d00683e73a68fb (diff) |
altos: report 0/0/0 for APRS position when GPS is not locked
We were reporting whatever the GPS device sent, even if it wasn't
reporting a valid status. That's not terribly useful.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/ao_aprs.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/drivers/ao_aprs.c b/src/drivers/ao_aprs.c index 56d98437..25a651ca 100644 --- a/src/drivers/ao_aprs.c +++ b/src/drivers/ao_aprs.c @@ -515,13 +515,19 @@ static int tncComment(uint8_t *buf) */ static int tncPositionPacket(void) { - int32_t latitude = ao_gps_data.latitude; - int32_t longitude = ao_gps_data.longitude; - int32_t altitude = ao_gps_data.altitude; + int32_t latitude = 0; + int32_t longitude = 0; + int32_t altitude = 0; uint8_t *buf; - if (altitude < 0) - altitude = 0; + if (ao_gps_data.flags & AO_GPS_VALID) { + latitude = ao_gps_data.latitude; + longitude = ao_gps_data.longitude; + altitude = ao_gps_data.altitude; + if (altitude < 0) + altitude = 0; + } + altitude = (altitude * (int32_t) 10000 + (3048/2)) / (int32_t) 3048; buf = tncBuffer; |