summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-18 17:08:55 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-18 17:08:55 -0400
commit1eb735e88937380dd24f042aa05cbf55896a9e6d (patch)
tree5b122fc90668de6b8144d1ffbf22ce1cfcc7bc98
parent6fb031b70a114f352d59b0bb57a65c270fc9684b (diff)
parent41f0f250c1902bf3e9783b9bdf1a5a822801f874 (diff)
downloadgpsd-1eb735e88937380dd24f042aa05cbf55896a9e6d.tar.gz
Merge branch 'master' of ssh://esr@git.berlios.de/gitroot/gpsd
-rw-r--r--Tachometer.c18
-rw-r--r--crc24q.c2
-rw-r--r--driver_italk.c135
-rw-r--r--driver_ubx.c6
-rw-r--r--driver_zodiac.c77
-rw-r--r--isgps.c14
-rw-r--r--libgpsd_core.c7
-rw-r--r--monitor_nmea.c18
-rw-r--r--subframe.c7
-rw-r--r--test_gpsmm.cpp11
10 files changed, 14 insertions, 281 deletions
diff --git a/Tachometer.c b/Tachometer.c
index e252ed62..c453f9f5 100644
--- a/Tachometer.c
+++ b/Tachometer.c
@@ -76,24 +76,6 @@ static StringRec char_data[] = {
{12, 5},
{2, 5},
{2, -5}}}};
-#if 0
-{{{{ {2, -5}}},
- { 5, /* "%" */
- {{17, -5},
- {20, -5},
- {20, -2},
- {17, -2},
- {17, -5}}},
- { 2,
- {{27, -5},
- {17, 5}}},
- {5,
- {{24, 2},
- {27, 2},
- {27, 5},
- {24, 5},
- {24, 2}}}};
-#endif
/*@ -initallelements @*/
/*@ -charint @*/
diff --git a/crc24q.c b/crc24q.c
index c58e0427..8f515c49 100644
--- a/crc24q.c
+++ b/crc24q.c
@@ -30,7 +30,7 @@
#include "crc24q.h"
-#if 0
+#ifdef REBUILD_CRC_TABLE
/*
* The crc24q code table below can be regenerated with the following code:
*/
diff --git a/driver_italk.c b/driver_italk.c
index 56da5b78..4933164c 100644
--- a/driver_italk.c
+++ b/driver_italk.c
@@ -394,7 +394,7 @@ static bool italk_set_mode(struct gps_device_t *session UNUSED,
char parity UNUSED, int stopbits UNUSED,
bool mode UNUSED)
{
-#if 0
+#ifdef __NOT_YET__
/*@ +charint @*/
char msg[] = { 0, };
@@ -474,136 +474,3 @@ const struct gps_type_t italk_binary =
};
/* *INDENT-ON* */
#endif /* defined(ITRAX_ENABLE) && defined(BINARY_ENABLE) */
-
-#ifdef ANCIENT_ITRAX_ENABLE
-/**************************************************************************
- *
- * The NMEA mode of the iTrax chipset, as used in the FastTrax and others.
- *
- * As described by v1.31 of the NMEA Protocol Specification for the
- * iTrax02 Evaluation Kit, 2003-06-12.
- * v1.18 of the manual, 2002-19-6, describes effectively
- * the same protocol, but without ZDA.
- *
- **************************************************************************/
-
-/*
- * Enable GGA=0x2000, RMC=0x8000, GSA=0x0002, GSV=0x0001, ZDA=0x0004.
- * Disable GLL=0x1000, VTG=0x4000, FOM=0x0020, PPS=0x0010.
- * This is 82+75+67+(3*60)+34 = 438 characters
- *
- * 1200 => at most 1 fix per 4 seconds
- * 2400 => at most 1 fix per 2 seconds
- * 4800 => at most 1 fix per 1 seconds
- * 9600 => at most 2 fixes per second
- * 19200 => at most 4 fixes per second
- * 57600 => at most 13 fixes per second
- * 115200 => at most 26 fixes per second
- *
- * We'd use FOM, but they don't specify a confidence interval.
- */
-#define ITRAX_MODESTRING "$PFST,NMEA,A007,%d\r\n"
-
-static int literal_send(int fd, const char *fmt, ...)
-/* ship a raw command to the GPS */
-{
- va_list ap;
-
- va_start(ap, fmt);
- (void)vsnprintf(session->msgbuf, sizeof(session->msgbuf), fmt, ap);
- va_end(ap);
- session->msgbuflen = strlen(session->msgbuf);
- return gpsd_write(fd, session->msgbuf, session->msgbuflen);
-}
-
-static void itrax_probe_subtype(struct gps_device_t *session,
- unsigned int seq)
-/* start it reporting */
-{
- if (seq == 0) {
- /* initialize GPS clock with current system time */
- struct tm when;
- double integral, fractional;
- time_t intfixtime;
- char buf[31], frac[6];
- fractional = modf(timestamp(), &integral);
- intfixtime = (time_t) integral;
- (void)gmtime_r(&intfixtime, &when);
- /* FIXME: so what if my local clock is wrong? */
- (void)strftime(buf, sizeof(buf), "$PFST,INITAID,%H%M%S.XX,%d%m%y\r\n",
- &when);
- (void)snprintf(frac, sizeof(frac), "%.2f", fractional);
- buf[21] = frac[2];
- buf[22] = frac[3];
- (void)literal_send(session->gpsdata.gps_fd, buf);
- /* maybe this should be considered a reconfiguration? */
- (void)literal_send(session->gpsdata.gps_fd, "$PFST,START\r\n");
- }
-}
-
-#ifdef ALLOW_RECONFIGURE
-static void itrax_configurator(struct gps_device_t event_t event, *session)
-/* set synchronous mode */
-{
- if (event == event_configure && session.packet_counter == 0) {
- (void)literal_send(session->gpsdata.gps_fd, "$PFST,SYNCMODE,1\r\n");
- (void)literal_send(session->gpsdata.gps_fd,
- ITRAX_MODESTRING, session->gpsdata.baudrate);
- }
-}
-
-static bool itrax_speed(struct gps_device_t *session,
- speed_t speed, char parity UNUSED,
- int stopbits UNUSED)
-/* change the baud rate */
-{
- return literal_send(session->gpsdata.gps_fd, ITRAX_MODESTRING,
- speed) >= 0;
- return false;
-}
-
-static bool itrax_rate(struct gps_device_t *session, double rate)
-/* change the sample rate of the GPS */
-{
- return literal_send(session->gpsdata.gps_fd, "$PSFT,FIXRATE,%d\r\n",
- rate) >= 0;
-}
-#endif /* ALLOW_RECONFIGURE */
-
-static void itrax_wrap(struct gps_device_t *session)
-/* stop navigation, this cuts the power drain */
-{
-#ifdef ALLOW_RECONFIGURE
- (void)literal_send(session->gpsdata.gps_fd, "$PFST,SYNCMODE,0\r\n");
-#endif /* ALLOW_RECONFIGURE */
- (void)literal_send(session->gpsdata.gps_fd, "$PFST,STOP\r\n");
-}
-
-/*@ -redef @*/
-/* *INDENT-OFF* */
-const static struct gps_type_t itrax = {
- .type_name = "iTrax", /* full name of type */
- .packet_type = NMEA_PACKET; /* associated lexer packet type */
- .trigger = "$PFST,OK", /* tells us to switch to Itrax */
- .channels = 12, /* consumer-grade GPS */
- .probe_detect = NULL, /* no probe */
- .get_packet = generic_get, /* how to get a packet */
- .parse_packet = nmea_parse_input, /* how to interpret a packet */
- .rtcm_writer = NULL, /* iTrax doesn't support DGPS/WAAS/EGNOS */
- .event_hook = event_hook, /* lietime event handler */
-#ifdef ALLOW_RECONFIGURE
- .speed_switcher = itrax_speed, /* how to change speeds */
- .mode_switcher = NULL, /* no mode switcher */
- .rate_switcher = itrax_rate, /* there's a sample-rate switcher */
- .min_cycle = 0, /* no hard limit */
-#endif /* ALLOW_RECONFIGURE */
-#ifdef ALLOW_CONTROLSEND
- .control_send = garmin_control_send, /* send raw bytes */
-#endif /* ALLOW_CONTROLSEND */
-#ifdef NTPSHM_ENABLE
- .ntp_offset = NULL, /* no method for NTP fudge factor */
-#endif /* NTPSHM_ ENABLE */
-};
-/* *INDENT-ON* */
-/*@ -redef @*/
-#endif /* ITRAX_ENABLE */
diff --git a/driver_ubx.c b/driver_ubx.c
index 9f09e567..0bb61958 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -201,12 +201,6 @@ ubx_msg_nav_svinfo(struct gps_device_t *session, unsigned char *buf,
gpsd_report(LOG_PROG, "runt svinfo (datalen=%zd)\n", data_len);
return 0;
}
-#if 0
- // Alas, this sentence doesn't supply GPS week
- tow = getleul(buf, 0);
- session->gpsdata.skyview_time = gpstime_to_unix(gps_week, tow)
- - session->context->leap_seconds;
-#endif
/*@ +charint @*/
nchan = (unsigned int)getub(buf, 4);
if (nchan > MAXCHANNELS) {
diff --git a/driver_zodiac.c b/driver_zodiac.c
index 1aafc90a..238c3f09 100644
--- a/driver_zodiac.c
+++ b/driver_zodiac.c
@@ -196,36 +196,6 @@ static gps_mask_t handle1000(struct gps_device_t *session)
/* clock_drift = (int)getzlong(51) * 1e-2; */
/* clock_drift_sd = (int)getzlong(53) * 1e-2; */
-#if 0
- gpsd_report(LOG_INF, "date: %lf\n", session->newdata.time);
- gpsd_report(LOG_INF, " solution invalid:\n");
- gpsd_report(LOG_INF, " altitude: %d\n", (getzword(10) & 1) ? 1 : 0);
- gpsd_report(LOG_INF, " no diff gps: %d\n", (getzword(10) & 2) ? 1 : 0);
- gpsd_report(LOG_INF, " not enough satellites: %d\n",
- (getzword(10) & 4) ? 1 : 0);
- gpsd_report(LOG_INF, " exceed max EHPE: %d\n",
- (getzword(10) & 8) ? 1 : 0);
- gpsd_report(LOG_INF, " exceed max EVPE: %d\n",
- (getzword(10) & 16) ? 1 : 0);
- gpsd_report(LOG_INF, " solution type:\n");
- gpsd_report(LOG_INF, " propagated: %d\n", (getzword(11) & 1) ? 1 : 0);
- gpsd_report(LOG_INF, " altitude: %d\n", (getzword(11) & 2) ? 1 : 0);
- gpsd_report(LOG_INF, " differential: %d\n",
- (getzword(11) & 4) ? 1 : 0);
- gpsd_report(LOG_INF, "Number of measurements in solution: %d\n",
- getzword(12));
- gpsd_report(LOG_INF, "Lat: %f\n", getzlong(27) * RAD_2_DEG * 1e-8);
- gpsd_report(LOG_INF, "Lon: %f\n", getzlong(29) * RAD_2_DEG * 1e-8);
- gpsd_report(LOG_INF, "Alt: %f\n", (double)getzlong(31) * 1e-2);
- gpsd_report(LOG_INF, "Speed: %f\n",
- (double)getzlong(34) * 1e-2 * MPS_TO_KNOTS);
- gpsd_report(LOG_INF, "Map datum: %d\n", getzword(39));
- gpsd_report(LOG_INF, "Magnetic variation: %f\n",
- getzword(37) * RAD_2_DEG * 1e-4);
- gpsd_report(LOG_INF, "Course: %f\n", getzword(36) * RAD_2_DEG * 1e-4);
- gpsd_report(LOG_INF, "Separation: %f\n", getzword(33) * 1e-2);
-#endif
-
mask =
TIME_IS | LATLON_IS | ALTITUDE_IS | CLIMB_IS | SPEED_IS | TRACK_IS |
STATUS_IS | MODE_IS;
@@ -260,15 +230,7 @@ static gps_mask_t handle1002(struct gps_device_t *session)
session->driver.zodiac.Zv[i] = status = (int)getzword(15 + (3 * i));
session->driver.zodiac.Zs[i] = prn = (int)getzword(16 + (3 * i));
/*@ +type @*/
-#if 0
- gpsd_report(LOG_INF, "Sat%02d:\n", i);
- gpsd_report(LOG_INF, " used:%d\n", (status & 1) ? 1 : 0);
- gpsd_report(LOG_INF, " eph:%d\n", (status & 2) ? 1 : 0);
- gpsd_report(LOG_INF, " val:%d\n", (status & 4) ? 1 : 0);
- gpsd_report(LOG_INF, " dgps:%d\n", (status & 8) ? 1 : 0);
- gpsd_report(LOG_INF, " PRN:%d\n", prn);
- gpsd_report(LOG_INF, " C/No:%d\n", getzword(17 + (3 * i)));
-#endif
+
if (status & 1)
session->gpsdata.used[session->gpsdata.satellites_used++] = prn;
for (j = 0; j < ZODIAC_CHANNELS; j++) {
@@ -317,11 +279,6 @@ static gps_mask_t handle1003(struct gps_device_t *session)
session->gpsdata.azimuth[i] += 360;
session->gpsdata.elevation[i] =
(int)(((short)getzword(17 + (3 * i))) * RAD_2_DEG * 1e-4);
-#if 0
- gpsd_report(LOG_INF, "Sat%02d: PRN:%d az:%d el:%d\n",
- i, getzword(15 + (3 * i)), getzword(16 + (3 * i)),
- getzword(17 + (3 * i)));
-#endif
} else {
session->gpsdata.PRN[i] = 0;
session->gpsdata.azimuth[i] = 0;
@@ -345,34 +302,7 @@ static void handle1005(struct gps_device_t *session UNUSED)
/* ticks = getzlong(6); */
/* sequence = getzword(8); */
int numcorrections = (int)getzword(12);
-#if 0
- int i;
- gpsd_report(LOG_INF, "Packet: %d\n", session->driver.zodiac.sn);
- gpsd_report(LOG_INF, "Station bad: %d\n", (getzword(9) & 1) ? 1 : 0);
- gpsd_report(LOG_INF, "User disabled: %d\n", (getzword(9) & 2) ? 1 : 0);
- gpsd_report(LOG_INF, "Station ID: %d\n", getzword(10));
- gpsd_report(LOG_INF, "Age of last correction in seconds: %d\n",
- getzword(11));
- gpsd_report(LOG_INF, "Number of corrections: %d\n", getzword(12));
- for (i = 0; i < numcorrections; i++) {
- gpsd_report(LOG_INF, "Sat%02d:\n", getzword(13 + i) & 0x3f);
- gpsd_report(LOG_INF, "ephemeris:%d\n",
- (getzword(13 + i) & 64) ? 1 : 0);
- gpsd_report(LOG_INF, "rtcm corrections:%d\n",
- (getzword(13 + i) & 128) ? 1 : 0);
- gpsd_report(LOG_INF, "rtcm udre:%d\n",
- (getzword(13 + i) & 256) ? 1 : 0);
- gpsd_report(LOG_INF, "sat health:%d\n",
- (getzword(13 + i) & 512) ? 1 : 0);
- gpsd_report(LOG_INF, "rtcm sat health:%d\n",
- (getzword(13 + i) & 1024) ? 1 : 0);
- gpsd_report(LOG_INF, "corrections state:%d\n",
- (getzword(13 + i) & 2048) ? 1 : 0);
- gpsd_report(LOG_INF, "iode mismatch:%d\n",
- (getzword(13 + i) & 4096) ? 1 : 0);
- }
-#endif
if (session->newdata.mode == MODE_NO_FIX)
session->gpsdata.status = STATUS_NO_FIX;
else if (numcorrections == 0)
@@ -405,11 +335,6 @@ static void handle1108(struct gps_device_t *session)
/* leap_nanoseconds = getzlong(17); */
if ((int)(getzword(19) & 3) == 3)
session->context->leap_seconds = (int)getzword(16);
-#if 0
- gpsd_report(LOG_INF, "Leap seconds: %d.%09d\n", getzword(16),
- getzlong(17));
- gpsd_report(LOG_INF, "UTC validity: %d\n", getzword(19) & 3);
-#endif
}
static gps_mask_t zodiac_analyze(struct gps_device_t *session)
diff --git a/isgps.c b/isgps.c
index 4c89ad40..abc566a3 100644
--- a/isgps.c
+++ b/isgps.c
@@ -151,15 +151,11 @@ unsigned int isgps_parity(isgps30bits_t th)
return (p);
}
-
-#define isgps_parityok(w) (isgps_parity(w) == ((w) & 0x3f))
-
-#if 0
/*
* ESR found a doozy of a bug...
*
- * Defining the above as a function triggers an optimizer bug in gcc 3.4.2.
- * The symptom is that parity computation is screwed up and the decoder
+ * Defining isgps_parityok as a function triggers an optimizer bug in gcc
+ * 3.4.2. The symptom is that parity computation is screwed up and the decoder
* never achieves sync lock. Something steps on the argument to
* isgpsparity(); the lossage appears to be related to the compiler's
* attempt to fold the isgps_parity() call into isgps_parityok() in some
@@ -174,11 +170,7 @@ unsigned int isgps_parity(isgps30bits_t th)
*
* gcc 4.0 does not manifest these bugs.
*/
-static bool isgps_parityok(isgps30bits_t w)
-{
- return (isgpsparity(w) == (w & 0x3f));
-}
-#endif
+#define isgps_parityok(w) (isgps_parity(w) == ((w) & 0x3f))
void isgps_init( /*@out@*/ struct gps_packet_t *session)
{
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 1700b7b5..b3dd456d 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -254,13 +254,6 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
log = "Too long for 5Hz, too short for 1Hz\n";
} else if (1001000 > cycle) {
/* looks like PPS pulse or square wave */
-
-#if 0
-/* huh? */
-#if defined(NMEA_ENABLE) && defined(GPSCLOCK_ENABLE)
- &&session->driver.nmea.ignore_trailing_edge
-#endif /* GPSCLOCK_ENABLE */
-#endif
if (0 == duration) {
ok = 1;
log = "PPS invisible pulse\n";
diff --git a/monitor_nmea.c b/monitor_nmea.c
index 184c524e..62ac248a 100644
--- a/monitor_nmea.c
+++ b/monitor_nmea.c
@@ -151,24 +151,6 @@ static void cooked_pvt(void)
} else
(void)snprintf(scr, sizeof(scr), "n/a");
(void)mvwprintw(cookedwin, 1, 60, "%-17s", scr);
-
-#if 0
- if (isnan(session.gpsdata.fix.track) == 0)
- (void)snprintf(scr, sizeof(scr), "%.1f meters/sec",
- session.gpsdata.fix.speed);
- else
- (void)snprintf(scr, sizeof(scr), "n/a");
- (void)mvwprintw(cookedwin, 1, 33, "%-17s", scr);
-
- /* fill in the course */
- if (session.gpsdata.fix.mode >= MODE_2D
- && isnan(session.gpsdata.fix.track) == 0)
- (void)snprintf(scr, sizeof(scr), "%.1f deg",
- session.gpsdata.fix.track);
- else
- (void)snprintf(scr, sizeof(scr), "n/a");
- (void)mvwprintw(cookedwin, 5, 11, "%-17s", scr);
-#endif
}
diff --git a/subframe.c b/subframe.c
index 6cc43b9b..bb4c3337 100644
--- a/subframe.c
+++ b/subframe.c
@@ -8,7 +8,7 @@
#include "gpsd.h"
#include "timebase.h"
-#if 0
+#ifdef __NOT_YET__
static char sf4map[] =
{ -1, 57, 25, 26, 27, 28, 57, 29, 30, 31, 32, 57, 62, 52, 53, 54, 57, 55,
56, 58, 59, 57, 60, 61, 62, 63
@@ -52,17 +52,16 @@ int gpsd_interpret_subframe_raw(struct gps_device_t *session,
preamble = (words[0] >> 22) & 0xff;
if (preamble == 0x8b) { /* preamble is inverted */
- preamble ^= 0xff;
words[0] ^= 0x3fffffc0; /* invert */
- words[0] &= ~0x40000000; /* clear D30* */
} else if (preamble != 0x74) {
gpsd_report(LOG_WARN,
"50B: gpsd_interpret_subframe_raw: bad preamble 0x%x\n",
preamble);
return 0;
}
+ words[0] = (words[0] >> 6) & 0xffffff;
- for (i = 0; i < 10; i++) {
+ for (i = 1; i < 10; i++) {
int invert;
/* D30* says invert */
invert = (words[i] & 0x40000000) ? 1 : 0;
diff --git a/test_gpsmm.cpp b/test_gpsmm.cpp
index 45114c73..f30fdfa6 100644
--- a/test_gpsmm.cpp
+++ b/test_gpsmm.cpp
@@ -15,7 +15,7 @@
using namespace std;
-#if 0
+#ifdef SAMPLE_USAGE
static void callback(struct gps_data_t* p, char* buf, size_t len);
#endif
@@ -29,7 +29,7 @@ int main(void) {
return (1);
}
-#if 0
+#ifdef SAMPLE_USAGE
cout << "Going to set the callback...\n";
if (gps_rec.set_callback(callback)!=0 ) {
cout << "Error setting callback.\n";
@@ -40,8 +40,8 @@ int main(void) {
sleep(10);
cout << "Exited from sleep...\n";
#endif
-
-#if 0
+
+#ifdef SAMPLE_USAGE
if (gps_rec.del_callback()!=0) {
cout << "Error deleting callback\n";
return (1);
@@ -54,9 +54,8 @@ int main(void) {
return 0;
}
-#if 0
+#ifdef SAMPLE_USAGE
static void callback(struct gps_data_t* p, char* buf, size_t len) {
-
if (p==NULL) {
cout << "Error polling gpsd\n";
return;