@@ -169,7 +169,7 @@ void GPSController::update() {
169169 if (drv->GetDriverType () == GPS_DRV_MTK) {
170170 // Interface shouldn't matter here because we already set it up in the
171171 // initialization phase, so we can just grab the Adafruit_GPS instance
172- Adafruit_GPS * ada_gps = drv->GetAdaGps ();
172+ ada_gps = drv->GetAdaGps ();
173173 if (ada_gps == nullptr ) {
174174 WS_DEBUG_PRINTLN (
175175 " [gps] ERROR: Can't read - GPS instance not initialized!" );
@@ -215,22 +215,28 @@ void GPSController::update() {
215215 ada_gps->read ();
216216 WS_DEBUG_PRINTLN (" ...OK!" );
217217 }
218- } else if (drv->GetIfaceType () == GPS_IFACE_I2C) {
219- // For I2C, request and discard any stale data from the device
220- WS_DEBUG_PRINT (" [gps] Discarding stale I2C data..." );
221- drv->I2cReadDiscard ();
222218 }
219+ } else if (drv->GetIfaceType () == GPS_IFACE_I2C) {
220+ // For I2C, request and discard any stale data from the device
221+ WS_DEBUG_PRINTLN (" [gps] Discarding stale I2C data..." );
222+ drv->I2cReadDiscard ();
223+ }
224+
225+ // if (drv->GetIfaceType() == GPS_IFACE_UART_HW) {
223226
224227 // Unset the RX flag
225- WS_DEBUG_PRINTLN (" [gps] Unsetting RX flag..." );
228+ WS_DEBUG_PRINT (" [gps] Unsetting RX flag..." );
226229 if (ada_gps->newNMEAreceived ()) {
227230 ada_gps->lastNMEA ();
228231 }
232+ WS_DEBUG_PRINT (" ok" );
229233
230234 // Let's attempt to get a sentence from the GPS module
231235 // Read from the GPS module for update_rate milliseconds
236+ WS_DEBUG_PRINT (" [gps] GetNmeaUpdateRate..." );
232237 ulong update_rate = 1000 / drv->GetNmeaUpdateRate ();
233238 ulong start_time = millis ();
239+ WS_DEBUG_PRINT (" ok" );
234240
235241 WS_DEBUG_PRINT (" [gps] Reading GPS data for " );
236242 WS_DEBUG_PRINT (update_rate);
@@ -302,6 +308,5 @@ void GPSController::update() {
302308 }
303309 }
304310 drv->SetPollPeriodPrv (cur_time);
305- }
306311 }
307312}
0 commit comments