From d429713936b0330347758c94c2cef33c493c9d8f Mon Sep 17 00:00:00 2001 From: "Konstantin Sharlaimov (DigitalEntity)" Date: Wed, 7 Nov 2018 20:54:18 +0100 Subject: [PATCH] Default GPS baud rate to 115200; Add extra timeout reset to GPS UBLOX init --- src/main/io/gps_ublox.c | 7 +++++-- src/main/io/serial.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/io/gps_ublox.c b/src/main/io/gps_ublox.c index e1a0dabf63d..9cc983b2e11 100755 --- a/src/main/io/gps_ublox.c +++ b/src/main/io/gps_ublox.c @@ -71,7 +71,7 @@ static const uint32_t ubloxScanMode1[] = { 0x00000000, 0x00000851, 0x0004E004, 0x00020200, 0x00000180, 0x00000000, }; -static const char * baudInitData[GPS_BAUDRATE_COUNT] = { +static const char * baudInitDataNMEA[GPS_BAUDRATE_COUNT] = { "$PUBX,41,1,0003,0001,115200,0*1E\r\n", // GPS_BAUDRATE_115200 "$PUBX,41,1,0003,0001,57600,0*2D\r\n", // GPS_BAUDRATE_57600 "$PUBX,41,1,0003,0001,38400,0*26\r\n", // GPS_BAUDRATE_38400 @@ -696,6 +696,9 @@ STATIC_PROTOTHREAD(gpsConfigure) { ptBegin(gpsConfigure); + // Reset timeout + gpsSetProtocolTimeout(GPS_SHORT_TIMEOUT); + // Set dynamic model switch (gpsState.gpsConfig->dynModel) { case GPS_DYNMODEL_PEDESTRIAN: @@ -845,7 +848,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread) gpsState.autoBaudrateIndex = (gpsState.autoBaudrateIndex + 1) % GPS_BAUDRATE_COUNT; // 2. Send an $UBX command to switch the baud rate specified by portConfig [baudrateIndex] - serialPrint(gpsState.gpsPort, baudInitData[gpsState.baudrateIndex]); + serialPrint(gpsState.gpsPort, baudInitDataNMEA[gpsState.baudrateIndex]); // 3. Wait for command to be received and processed by GPS ptWait(isSerialTransmitBufferEmpty(gpsState.gpsPort)); diff --git a/src/main/io/serial.c b/src/main/io/serial.c index ca22b428dcb..46c665024ff 100644 --- a/src/main/io/serial.c +++ b/src/main/io/serial.c @@ -110,7 +110,7 @@ void pgResetFn_serialConfig(serialConfig_t *serialConfig) for (int i = 0; i < SERIAL_PORT_COUNT; i++) { serialConfig->portConfigs[i].identifier = serialPortIdentifiers[i]; serialConfig->portConfigs[i].msp_baudrateIndex = BAUD_115200; - serialConfig->portConfigs[i].gps_baudrateIndex = BAUD_38400; + serialConfig->portConfigs[i].gps_baudrateIndex = BAUD_115200; serialConfig->portConfigs[i].telemetry_baudrateIndex = BAUD_AUTO; serialConfig->portConfigs[i].peripheral_baudrateIndex = BAUD_115200; }