2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 uint16_t minutes_fraction;
30 ao_gps_split(int32_t v, __xdata struct ao_gps_split *split) __reentrant
39 split->degrees = v / 10000000;
40 minutes_e7 = (v % 10000000) * 60;
41 split->minutes = minutes_e7 / 10000000;
42 split->minutes_fraction = (minutes_e7 % 10000000) / 1000;
46 ao_gps_print(__xdata struct ao_gps_data *gps_data) __reentrant
49 (gps_data->flags & AO_GPS_NUM_SAT_MASK) >> AO_GPS_NUM_SAT_SHIFT);
50 if (gps_data->flags & AO_GPS_VALID) {
51 static __xdata struct ao_gps_split lat, lon;
55 ao_gps_split(gps_data->latitude, &lat);
56 ao_gps_split(gps_data->longitude, &lon);
57 printf(" %2d:%02d:%02d",
61 printf(" %2d°%02d.%04d'%c %2d°%02d.%04d'%c %5dm",
65 lat.positive ? 'N' : 'S',
69 lon.positive ? 'E' : 'W',
71 if (gps_data->climb_rate >= 0) {
73 climb = gps_data->climb_rate;
76 climb = -gps_data->climb_rate;
78 printf(" %5u.%02dm/s(H) %d° %c%5d.%02dm/s(V)",
79 gps_data->ground_speed / 100,
80 gps_data->ground_speed % 100,
85 printf(" %d.%d(hdop) %5d(herr) %5d(verr)\n",
90 printf(" unlocked\n");