@@ -1155,37 +1155,28 @@ int32_t GPS::runOnce()
1155
1155
shouldPublish = true ;
1156
1156
}
1157
1157
1158
- // 2. Got a lock for the first time
1158
+ // 2. Got a lock for the first time, or 3. Got a lock after turning back on
1159
1159
bool gotLoc = lookForLocation ();
1160
- if (gotLoc && !hasValidLocation) { // declare that we have location ASAP
1161
- LOG_DEBUG (" hasValidLocation RISING EDGE" );
1162
- hasValidLocation = true ;
1163
- if (updateInterval <= 10 * 1000UL ) {
1164
- shouldPublish = true ;
1165
- } else {
1166
- // Hold for up to 20secs after getting a lock to download ephemeris etc
1167
- uint32_t holdTime = updateInterval - 1000 ;
1168
- if (holdTime > 20000 )
1169
- holdTime = 20000 ;
1170
- fixHoldEnds = millis () + holdTime;
1160
+ if (gotLoc) {
1171
1161
#ifdef GPS_DEBUG
1172
- LOG_DEBUG ( " Holding for %ums (first Lock) " , holdTime);
1173
- # endif
1162
+ if (!hasValidLocation) { // declare that we have location ASAP
1163
+ LOG_DEBUG ( " hasValidLocation RISING EDGE " );
1174
1164
}
1175
- }
1176
- // 3. Got a lock after turning back on
1177
- if (gotLoc && prev_fixQual == 0 ) { // just got a lock after turning back on.
1178
- if (updateInterval <= 10 * 1000UL ) {
1179
- shouldPublish = true ;
1180
- } else {
1181
- // Hold for up to 20secs after getting a lock to download ephemeris etc
1182
- uint32_t holdTime = updateInterval - 1000 ;
1183
- if (holdTime > 20000 )
1184
- holdTime = 20000 ;
1185
- fixHoldEnds = millis () + holdTime;
1165
+ # endif
1166
+ if (!hasValidLocation || prev_fixQual == 0 ) {
1167
+ hasValidLocation = true ;
1168
+ if (updateInterval <= 10 * 1000UL ) {
1169
+ shouldPublish = true ;
1170
+ } else {
1171
+ // Hold for up to 20secs after getting a lock to download ephemeris etc
1172
+ uint32_t holdTime = updateInterval - 1000 ;
1173
+ if (holdTime > 20000 )
1174
+ holdTime = 20000 ;
1175
+ fixHoldEnds = millis () + holdTime;
1186
1176
#ifdef GPS_DEBUG
1187
- LOG_DEBUG (" Holding for %ums (Lock after GPS_OFF) " , holdTime);
1177
+ LOG_DEBUG (" Holding for %ums after lock " , holdTime);
1188
1178
#endif
1179
+ }
1189
1180
}
1190
1181
}
1191
1182
0 commit comments