Skip to content

Commit 96c5512

Browse files
committed
rm cruft from sfe detection
1 parent 3d0bb4d commit 96c5512

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

src/components/gps/controller.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,31 +111,6 @@ void GPSController::update() {
111111
return; // bail-out!
112112

113113
for (GPSHardware *drv : _gps_drivers) {
114-
// Get the GPS driver interface from the hardware instance
115-
WS_DEBUG_PRINTLN("[gps] Updating GPS driver...");
116-
Adafruit_GPS *ada_gps = nullptr;
117-
if (drv->GetDriverType() == GPS_DRV_MTK) {
118-
// Interface shouldn't matter here because we already set it up in the
119-
// initialization phase, so we can just grab the Adafruit_GPS instance
120-
ada_gps = drv->GetAdaGps();
121-
if (ada_gps == nullptr) {
122-
WS_DEBUG_PRINTLN(
123-
"[gps] ERROR: Can't read - GPS instance not initialized!");
124-
continue;
125-
}
126-
} else if (drv->GetDriverType() == GPS_DRV_UBLOX) {
127-
SFE_UBLOX_GNSS *sfe_gps = drv->GetUbxGps();
128-
if (sfe_gps == nullptr) {
129-
WS_DEBUG_PRINTLN(
130-
"[gps] ERROR: Can't read - UBLOX instance not initialized!");
131-
continue;
132-
}
133-
} else {
134-
WS_DEBUG_PRINTLN(
135-
"[gps] ERROR: Unsupported GPS driver type, skipping update()!");
136-
continue;
137-
}
138-
139114
// TODO: Commented out due to parsing failures, stability issue (failed to
140115
// parse NMEA acks for this) Perform a keep-alive check by sending an
141116
// antenna check command every 2 seconds

src/components/gps/hardware.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ bool GPSHardware::DetectMtkI2C(uint32_t addr) {
241241
* otherwise.
242242
*/
243243
bool GPSHardware::DetectUbxI2C(uint32_t addr) {
244-
_ubx_gps_ddc = new Adafruit_UBloxDDC(addr, *_wire);
244+
_ubx_gps_ddc = new Adafruit_UBloxDDC(addr, _wire);
245245
if (!_ubx_gps_ddc->begin())
246246
return false;
247-
_ubx_gps = new Adafruit_UBX(_ubx_gps_ddc);
247+
_ubx_gps = new Adafruit_UBX(&_ubx_gps_ddc);
248248
if (!_ubx_gps->begin())
249249
return false;
250250
_ubx_gps->verbose_debug = 3; // TODO: Set this to 1 in production
@@ -545,10 +545,12 @@ void GPSHardware::PollStoreSentences() {
545545
WS_DEBUG_PRINT("Did We get a NMEA sentence? ");
546546
uint8_t buffer[MAX_LEN_NMEA_SENTENCE];
547547
String nmeaBuffer = "";
548-
int bytesAvailable = gps.available();
548+
size_t bytesToRead;
549+
size_t bytesRead;
550+
int bytesAvailable = _ubx_gps_ddc->available();
549551
if (bytesAvailable > 0) {
550-
size_t bytesToRead = min(bytesAvailable, MAX_NEMA_SENTENCE_LEN);
551-
size_t bytesRead = gps.readBytes(buffer, bytesToRead);
552+
min(bytesAvailable, MAX_NEMA_SENTENCE_LEN);
553+
_ubx_gps_ddc->readBytes(buffer, bytesToRead);
552554
}
553555
// Build NMEA sentences and parse when complete
554556
for (size_t i = 0; i < bytesRead; i++) {

0 commit comments

Comments
 (0)