Skip to content

Commit 7b21635

Browse files
authored
Merge pull request iNavFlight#10082 from WizzardDr/master
Skip `pollVersion()` and `pollGnssCapabilities()` if `gps_auto_config = OFF`
2 parents 95ff86a + 2269730 commit 7b21635

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/main/io/gps_ublox.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,25 +1048,26 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread)
10481048
gpsState.hwVersion = UBX_HW_VERSION_UNKNOWN;
10491049
gpsState.autoConfigStep = 0;
10501050

1051-
do {
1052-
pollVersion();
1053-
gpsState.autoConfigStep++;
1054-
ptWaitTimeout((gpsState.hwVersion != UBX_HW_VERSION_UNKNOWN), GPS_CFG_CMD_TIMEOUT_MS);
1055-
} while(gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && gpsState.hwVersion == UBX_HW_VERSION_UNKNOWN);
1056-
1057-
gpsState.autoConfigStep = 0;
1058-
ubx_capabilities.supported = ubx_capabilities.enabledGnss = ubx_capabilities.defaultGnss = 0;
1059-
// M7 and earlier will never get pass this step, so skip it (#9440).
1060-
// UBLOX documents that this is M8N and later
1061-
if (gpsState.hwVersion > UBX_HW_VERSION_UBLOX7) {
1062-
do {
1063-
pollGnssCapabilities();
1064-
gpsState.autoConfigStep++;
1065-
ptWaitTimeout((ubx_capabilities.capMaxGnss != 0), GPS_CFG_CMD_TIMEOUT_MS);
1066-
} while (gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && ubx_capabilities.capMaxGnss == 0);
1067-
}
10681051
// Configure GPS module if enabled
10691052
if (gpsState.gpsConfig->autoConfig) {
1053+
do {
1054+
pollVersion();
1055+
gpsState.autoConfigStep++;
1056+
ptWaitTimeout((gpsState.hwVersion != UBX_HW_VERSION_UNKNOWN), GPS_CFG_CMD_TIMEOUT_MS);
1057+
} while(gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && gpsState.hwVersion == UBX_HW_VERSION_UNKNOWN);
1058+
1059+
gpsState.autoConfigStep = 0;
1060+
ubx_capabilities.supported = ubx_capabilities.enabledGnss = ubx_capabilities.defaultGnss = 0;
1061+
// M7 and earlier will never get pass this step, so skip it (#9440).
1062+
// UBLOX documents that this is M8N and later
1063+
if (gpsState.hwVersion > UBX_HW_VERSION_UBLOX7) {
1064+
do {
1065+
pollGnssCapabilities();
1066+
gpsState.autoConfigStep++;
1067+
ptWaitTimeout((ubx_capabilities.capMaxGnss != 0), GPS_CFG_CMD_TIMEOUT_MS);
1068+
} while (gpsState.autoConfigStep < GPS_VERSION_RETRY_TIMES && ubx_capabilities.capMaxGnss == 0);
1069+
}
1070+
10701071
// Configure GPS
10711072
ptSpawn(gpsConfigure);
10721073
}
@@ -1079,7 +1080,7 @@ STATIC_PROTOTHREAD(gpsProtocolStateThread)
10791080
ptSemaphoreWait(semNewDataReady);
10801081
gpsProcessNewSolutionData(false);
10811082

1082-
if ((gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) {
1083+
if ((gpsState.gpsConfig->autoConfig) && (gpsState.gpsConfig->provider == GPS_UBLOX || gpsState.gpsConfig->provider == GPS_UBLOX7PLUS)) {
10831084
if ((millis() - gpsState.lastCapaPoolMs) > GPS_CAPA_INTERVAL) {
10841085
gpsState.lastCapaPoolMs = millis();
10851086

0 commit comments

Comments
 (0)