From: Keith Packard Date: Sun, 13 Nov 2011 02:54:14 +0000 (-0800) Subject: altos: Trim skytraq NMEA messages. Shrink NMEA header matching code X-Git-Tag: 1.0.9.4~72 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=7f9e76e0d3492dcc8bf4b5b1f07c3c727cfdc0ef altos: Trim skytraq NMEA messages. Shrink NMEA header matching code Tell the skytraq to not bother sending a bunch of the NMEA messages that we don't parse. Explicitly look for 'G' follows by 'P' instead of having some general header matching code. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c index 62909606..050573e8 100644 --- a/src/drivers/ao_gps_skytraq.c +++ b/src/drivers/ao_gps_skytraq.c @@ -19,10 +19,6 @@ #include "ao.h" #endif -#define AO_GPS_LEADER 2 - -static __code char ao_gps_header[] = "GP"; - __xdata uint8_t ao_gps_mutex; static __data char ao_gps_char; static __data uint8_t ao_gps_cksum; @@ -50,7 +46,7 @@ static __pdata struct ao_telemetry_satellite ao_gps_tracking_next; (id^a^b^c^d^e^f^g^h^i^j^k^l^m^n), STQ_E static __code uint8_t ao_gps_config[] = { - SKYTRAQ_MSG_8(0x08, 1, 1, 1, 1, 1, 1, 1, 0), /* configure nmea */ + SKYTRAQ_MSG_8(0x08, 1, 0, 1, 0, 1, 0, 0, 0), /* configure nmea */ /* gga interval */ /* gsa interval */ /* gsv interval */ @@ -418,11 +414,12 @@ ao_gps_nmea_parse(void) ao_gps_cksum = 0; ao_gps_error = 0; - for (a = 0; a < AO_GPS_LEADER; a++) { - ao_gps_lexchar(); - if (ao_gps_char != ao_gps_header[a]) - return; - } + ao_gps_lexchar(); + if (ao_gps_char != 'G') + return; + ao_gps_lexchar(); + if (ao_gps_char != 'P') + return; ao_gps_lexchar(); a = ao_gps_char; @@ -459,7 +456,6 @@ ao_gps(void) __reentrant if (ao_serial_getchar() == '$') { ao_gps_nmea_parse(); } - } }