diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 16003107..0abb33b9 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -16,7 +16,11 @@ HardwareSerial *GPS::_serial_gps = &Serial1; HardwareSerial *GPS::_serial_gps = NULL; #endif +#ifdef GPS_I2C_ADDRESS +uint8_t GPS::i2cAddress = GPS_I2C_ADDRESS; +#else uint8_t GPS::i2cAddress = 0; +#endif bool timeSetFromGPS; // We try to set our time from GPS each time we wake from sleep diff --git a/src/gps/UBloxGPS.cpp b/src/gps/UBloxGPS.cpp index d648a0e8..28ccba85 100644 --- a/src/gps/UBloxGPS.cpp +++ b/src/gps/UBloxGPS.cpp @@ -53,8 +53,15 @@ bool UBloxGPS::setup() assert(ok); return false; } else { - ok = ublox.setUART1Output(COM_TYPE_UBX, 500); // Use native API - assert(ok); + if (_serial_gps) { + ok = ublox.setUART1Output(COM_TYPE_UBX, 500); // Use native API + assert(ok); + } + if (i2cAddress) { + ublox.setI2COutput(COM_TYPE_UBX, 500); + assert(ok); + } + ok = ublox.setNavigationFrequency(1, 500); // Produce 4x/sec to keep the amount of time we stall in getPVT low assert(ok); // ok = ublox.setAutoPVT(false); // Not implemented on NEO-6M