summaryrefslogtreecommitdiffstats
path: root/gps.c
diff options
context:
space:
mode:
authorDieter Spaar <spaar@mirider.augusta.de>2012-07-18 22:20:02 +0200
committerHarald Welte <laforge@gnumonks.org>2012-07-18 22:22:47 +0200
commita5c8d8068840bbc216c132d7f8b42b3167c43b9f (patch)
treed23b272998a98e47529fe94c75c7ea7ba73773b5 /gps.c
parentd652a321d9588a6d96c0b28f9df2130fa7e16737 (diff)
gps.c: Add error message in case of parser problems
Diffstat (limited to 'gps.c')
-rw-r--r--gps.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gps.c b/gps.c
index c235748..f259193 100644
--- a/gps.c
+++ b/gps.c
@@ -20,6 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdio.h>
+
#include "gps.h"
@@ -90,8 +92,10 @@ gps_unpack_sf123(uint32_t *sf, struct gps_ephemeris_sv *eph)
eph->aodo = GET_FIELD_U(sf2[7], 5, 2);
/* Check & cross-validate iodc[7:0], iode1, iode2 */
- if ((iode1 != iode2) || (iode1 != (eph->iodc & 0xff)))
+ if ((iode1 != iode2) || (iode1 != (eph->iodc & 0xff))) {
+ fprintf(stderr, "gps_unpack_sf123 failed\n");
return -1;
+ }
return 0;
}
@@ -106,6 +110,7 @@ gps_unpack_sf123(uint32_t *sf, struct gps_ephemeris_sv *eph)
int
gps_unpack_sf45_almanac(uint32_t *sf, struct gps_almanac_sv *alm)
{
+ /* this is the page ID but not the satellite ID, its wrong in subframe 5 */
alm->sv_id = GET_FIELD_U(sf[0], 6, 16);
alm->e = GET_FIELD_U(sf[0], 16, 0);