mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
examples/gps: show units in output
The GPS example prints parsed measurements without explicit units. The RMC floating-point speed path also used minmea_tocoord(), even though speed is not a coordinate. Add units to the output labels, print speed with minmea_tofloat(), and print GGA altitude as a scaled value with the sentence-provided unit. Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
This commit is contained in:
parent
8d6c495365
commit
1a6d06c3be
1 changed files with 13 additions and 13 deletions
|
|
@ -99,21 +99,21 @@ int main(int argc, FAR char *argv[])
|
|||
|
||||
if (minmea_parse_rmc(&frame, line))
|
||||
{
|
||||
printf("Fixed-point Latitude...........: %" PRIdLEAST32
|
||||
"\n",
|
||||
printf("Fixed-point Latitude (NMEA * 1000)..: %"
|
||||
PRIdLEAST32 "\n",
|
||||
minmea_rescale(&frame.latitude, 1000));
|
||||
printf("Fixed-point Longitude..........: %" PRIdLEAST32
|
||||
"\n",
|
||||
printf("Fixed-point Longitude (NMEA * 1000).: %"
|
||||
PRIdLEAST32 "\n",
|
||||
minmea_rescale(&frame.longitude, 1000));
|
||||
printf("Fixed-point Speed..............: %" PRIdLEAST32
|
||||
"\n",
|
||||
printf("Fixed-point Speed (knots * 1000)....: %"
|
||||
PRIdLEAST32 "\n",
|
||||
minmea_rescale(&frame.speed, 1000));
|
||||
printf("Floating point degree latitude.: %2.6f\n",
|
||||
printf("Floating point Latitude (degrees)...: %2.6f\n",
|
||||
minmea_tocoord(&frame.latitude));
|
||||
printf("Floating point degree longitude: %2.6f\n",
|
||||
printf("Floating point Longitude (degrees)..: %2.6f\n",
|
||||
minmea_tocoord(&frame.longitude));
|
||||
printf("Floating point speed...........: %2.6f\n",
|
||||
minmea_tocoord(&frame.speed));
|
||||
printf("Floating point Speed (knots)........: %2.6f\n",
|
||||
minmea_tofloat(&frame.speed));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -130,9 +130,9 @@ int main(int argc, FAR char *argv[])
|
|||
{
|
||||
printf("Fix quality....................: %d\n",
|
||||
frame.fix_quality);
|
||||
printf("Altitude.......................: %" PRIdLEAST32
|
||||
"\n",
|
||||
frame.altitude.value);
|
||||
printf("Altitude (%c)...................: %2.6f\n",
|
||||
frame.altitude_units ? frame.altitude_units : '?',
|
||||
minmea_tofloat(&frame.altitude));
|
||||
printf("Tracked satellites.............: %d\n",
|
||||
frame.satellites_tracked);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue