1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 17:25:18 +03:00

Merge pull request #3993 from iNavFlight/de_gps_autoconfig_fix

Fix always-on GPS autoconfig
This commit is contained in:
Konstantin Sharlaimov 2018-11-07 19:43:34 +01:00 committed by GitHub
commit d9fa9097c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 38 deletions

View file

@ -329,6 +329,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThreadMTK)
}
// Send configuration commands
if (gpsState.gpsConfig->autoConfig) {
// Disable all messages except GGA and RMC
serialPrint(gpsState.gpsPort, "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n");
ptWait(isSerialTransmitBufferEmpty(gpsState.gpsPort));
@ -360,6 +361,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThreadMTK)
// Try set 10Hz update rate. Module will ignore it if can't support
serialPrint(gpsState.gpsPort, "$PMTK220,100*2F\r\n");
ptWait(isSerialTransmitBufferEmpty(gpsState.gpsPort));
}
// Reset protocol timeout
gpsSetProtocolTimeout(GPS_TIMEOUT);

View file

@ -865,6 +865,8 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread)
serialSetBaudRate(gpsState.gpsPort, baudRates[gpsToSerialBaudRate[gpsState.baudrateIndex]]);
}
// Configure GPS module if enabled
if (gpsState.gpsConfig->autoConfig) {
// Reset protocol timeout
gpsSetProtocolTimeout(MIN(GPS_TIMEOUT, ((GPS_VERSION_RETRY_TIMES + 1) * GPS_VERSION_DETECTION_TIMEOUT_MS)));
@ -880,6 +882,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread)
// Configure GPS
ptSpawn(gpsConfigure);
}
// GPS setup done, reset timeout
gpsSetProtocolTimeout(GPS_TIMEOUT);