1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Merge pull request #2699 from McGiverGim/make-gps-stable-again

Make the GPS stable again
This commit is contained in:
Dominic Clifton 2017-04-07 00:07:49 +01:00 committed by Michael Keller
parent e84cbe5fb5
commit 181b0eb078

View file

@ -435,7 +435,7 @@ void gpsUpdate(timeUs_t currentTimeUs)
gpsData.baudrateIndex++; gpsData.baudrateIndex++;
gpsData.baudrateIndex %= GPS_INIT_ENTRIES; gpsData.baudrateIndex %= GPS_INIT_ENTRIES;
} }
gpsData.lastMessage = currentTimeUs / 1000; gpsData.lastMessage = millis();
// TODO - move some / all of these into gpsData // TODO - move some / all of these into gpsData
GPS_numSat = 0; GPS_numSat = 0;
DISABLE_STATE(GPS_FIX); DISABLE_STATE(GPS_FIX);
@ -444,7 +444,7 @@ void gpsUpdate(timeUs_t currentTimeUs)
case GPS_RECEIVING_DATA: case GPS_RECEIVING_DATA:
// check for no data/gps timeout/cable disconnection etc // check for no data/gps timeout/cable disconnection etc
if (currentTimeUs / 1000 - gpsData.lastMessage > GPS_TIMEOUT) { if (millis() - gpsData.lastMessage > GPS_TIMEOUT) {
// remove GPS from capability // remove GPS from capability
sensorsClear(SENSOR_GPS); sensorsClear(SENSOR_GPS);
gpsSetState(GPS_LOST_COMMUNICATION); gpsSetState(GPS_LOST_COMMUNICATION);