summaryrefslogtreecommitdiff
path: root/driver_navcom.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2012-06-02 02:08:34 -0400
committerEric S. Raymond <esr@thyrsus.com>2012-06-02 02:08:34 -0400
commitfa034144b0f61a8993a7a48af41334dd9e65d89b (patch)
tree13f79d52bbc284e6924dd97d84bf0ad224606d98 /driver_navcom.c
parent7b6292a4fed8434b3344821bc7ee0ba1c90e124f (diff)
downloadgpsd-fa034144b0f61a8993a7a48af41334dd9e65d89b.tar.gz
Refacter the bits.c stuff to eliminate ugly globals...
...and be more explicit about operand sizes. All regressuion tests [ass, code splints clean.
Diffstat (limited to 'driver_navcom.c')
-rw-r--r--driver_navcom.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/driver_navcom.c b/driver_navcom.c
index 655c745c..f9c601a8 100644
--- a/driver_navcom.c
+++ b/driver_navcom.c
@@ -888,22 +888,21 @@ static gps_mask_t handle_0xb5(struct gps_device_t *session)
{
if (sizeof(double) == 8) {
gps_mask_t mask = TIME_SET;
- union long_double l_d;
- unsigned char *buf = session->packet.outbuffer + 3;
+ char *buf = (char *)session->packet.outbuffer + 3;
uint16_t week = getleu16(buf, 3);
uint32_t tow = getleu32(buf, 5);
- double rms = getled(buf, 9);
+ double rms = getled64(buf, 9);
#ifdef __UNUSED__
/* Reason why it's unused is these figures do not agree
* with those obtained from the PVT report (handle_0xb1).
* The figures from 0xb1 do agree with the values reported
* by Navcom's PC utility */
- //double ellips_maj = getled(buf, 17);
- //double ellips_min = getled(buf, 25);
- //double ellips_azm = getled(buf, 33);
- double lat_sd = getled(buf, 41);
- double lon_sd = getled(buf, 49);
- double alt_sd = getled(buf, 57);
+ //double ellips_maj = getled64(buf, 17);
+ //double ellips_min = getled64(buf, 25);
+ //double ellips_azm = getled64(buf, 33);
+ double lat_sd = getled64(buf, 41);
+ double lon_sd = getled64(buf, 49);
+ double alt_sd = getled64(buf, 57);
double hrms = sqrt(pow(lat_sd, 2) + pow(lon_sd, 2));
#endif /* __UNUSED__ */
session->gpsdata.epe = rms * 1.96;
@@ -1082,20 +1081,18 @@ static gps_mask_t handle_0xef(struct gps_device_t *session)
//uint32_t tow = getleu32(buf, 5);
int8_t osc_temp = getsb(buf, 9);
uint8_t nav_status = getub(buf, 10);
- union long_double l_d;
double nav_clock_offset;
- union int_float i_f;
float nav_clock_drift;
float osc_filter_drift_est;
int32_t time_slew = (int32_t) getles32(buf, 27);
if (sizeof(double) == 8) {
- nav_clock_offset = getled(buf, 11);
+ nav_clock_offset = getled64((char *)buf, 11);
} else {
nav_clock_offset = NAN;
}
if (sizeof(float) == 4) {
- nav_clock_drift = getlef(buf, 19);
- osc_filter_drift_est = getlef(buf, 23);
+ nav_clock_drift = getlef32((char *)buf, 19);
+ osc_filter_drift_est = getlef32((char *)buf, 23);
} else {
nav_clock_drift = NAN;
osc_filter_drift_est = NAN;