From 2ca082f09c613ba2f5f2f607403da39ce154d174 Mon Sep 17 00:00:00 2001 From: Kemal Hadimli Date: Sat, 5 Apr 2014 19:17:58 +0300 Subject: [PATCH] GPS: clean up NMEA autodetect baud. -1 no longer used, it will cycle through available baud rates if no data is received anyway --- src/cli.c | 2 +- src/main.c | 3 --- src/mw.h | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cli.c b/src/cli.c index 2d7c0a63f7..9b2e36e375 100644 --- a/src/cli.c +++ b/src/cli.c @@ -130,7 +130,7 @@ const clivalue_t valueTable[] = { { "softserial_1_inverted", VAR_UINT8, &mcfg.softserial_1_inverted, 0, 1 }, { "softserial_2_inverted", VAR_UINT8, &mcfg.softserial_2_inverted, 0, 1 }, { "gps_type", VAR_UINT8, &mcfg.gps_type, 0, 3 }, - { "gps_baudrate", VAR_INT8, &mcfg.gps_baudrate, -1, 4 }, + { "gps_baudrate", VAR_INT8, &mcfg.gps_baudrate, 0, 4 }, { "serialrx_type", VAR_UINT8, &mcfg.serialrx_type, 0, 3 }, { "telemetry_softserial", VAR_UINT8, &mcfg.telemetry_softserial, 0, 1 }, { "telemetry_switch", VAR_UINT8, &mcfg.telemetry_switch, 0, 1 }, diff --git a/src/main.c b/src/main.c index 70c98d37ee..24907b2d1a 100755 --- a/src/main.c +++ b/src/main.c @@ -113,9 +113,6 @@ int main(void) } else { // spektrum and GPS are mutually exclusive // Optional GPS - available in both PPM and PWM input mode, in PWM input, reduces number of available channels by 2. // gpsInit will return if FEATURE_GPS is not enabled. - // Sanity check below - protocols other than NMEA do not support baud rate autodetection - if (mcfg.gps_type > 0 && mcfg.gps_baudrate < 0) - mcfg.gps_baudrate = 0; gpsInit(mcfg.gps_baudrate); } #ifdef SONAR diff --git a/src/mw.h b/src/mw.h index d1f833d64c..d85132f92e 100755 --- a/src/mw.h +++ b/src/mw.h @@ -272,7 +272,7 @@ typedef struct master_t { // gps-related stuff uint8_t gps_type; // Type of GPS hardware. 0: NMEA 1: UBX 2: MTK NMEA 3: MTK Binary - int8_t gps_baudrate; // GPS baudrate, -1: autodetect (NMEA only), 0: 115200, 1: 57600, 2: 38400, 3: 19200, 4: 9600 + int8_t gps_baudrate; // GPS baudrate, 0: 115200, 1: 57600, 2: 38400, 3: 19200, 4: 9600. NMEA will cycle through these until valid data is received uint32_t serial_baudrate;