From 8edf48fe3601b15ce451d98a5411bb3101c2c4e6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 25 Oct 2006 14:32:16 +0000 Subject: Correct scaling in PGRME output. --- libgpsd_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libgpsd_core.c') diff --git a/libgpsd_core.c b/libgpsd_core.c index 940091f7..f71e8ca4 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -405,12 +405,16 @@ static void gpsd_binary_quality_dump(struct gps_device_t *session, if (finite(session->gpsdata.fix.eph) || finite(session->gpsdata.fix.epv) || finite(session->gpsdata.epe)) { - /* output PGRME only if realistic */ + /* + * Output PGRME only if realistic. Note: we're converting back to + * our guess about Garmin's confidence units here, make sure this + * stays consistent with the in-conversion in nmea_parse.c! + */ (void)snprintf(bufp, len-strlen(bufp), "$PGRME,%.2f,M,%.2f,M,%.2f,M", - ZEROIZE(session->gpsdata.fix.eph), - ZEROIZE(session->gpsdata.fix.epv), - ZEROIZE(session->gpsdata.epe)); + ZEROIZE(session->gpsdata.fix.eph * (CEP50_SIGMA/GPSD_CONFIDENCE)), + ZEROIZE(session->gpsdata.fix.epv * (CEP50_SIGMA/GPSD_CONFIDENCE)), + ZEROIZE(session->gpsdata.epe * (CEP50_SIGMA/GPSD_CONFIDENCE))); nmea_add_checksum(bufp); } #undef ZEROIZE -- cgit v1.2.1