bugfix i2c gps broken (issue #712)

This commit is contained in:
cyberman54 2021-01-07 22:07:55 +01:00
parent 3d6af69c0b
commit dee4d825a0

View File

@ -30,34 +30,27 @@ static uint16_t nmea_txDelay_ms = 0;
// initialize and configure GPS
int gps_init(void) {
int ret = 1;
if (!gps_config()) {
ESP_LOGE(TAG, "GPS chip initializiation error");
return 0;
}
#ifdef GPS_SERIAL
ESP_LOGI(TAG, "Opening serial GPS");
GPS_Serial.begin(GPS_SERIAL);
ESP_LOGI(TAG, "Using serial GPS");
#elif defined GPS_I2C
ESP_LOGI(TAG, "Opening I2C GPS");
Wire.begin(GPS_I2C, 400000); // I2C connect to GPS device with 400 KHz
Wire.beginTransmission(GPS_ADDR);
Wire.write(0x00); // dummy write
ret = Wire.endTransmission(); // check if chip is seen on i2c bus
if (ret) {
ESP_LOGE(TAG,
"Quectel L76 GPS chip not found on i2c bus, bus error %d. "
"Stopping GPS-Task.",
ret);
ret = 0;
} else {
Wire.write(0x00); // dummy write
if (Wire.endTransmission()) {
ESP_LOGE(TAG, "Quectel L76 GPS chip not found");
return 0;
} else
ESP_LOGI(TAG, "Quectel L76 GPS chip found");
}
#endif
return ret;
return 1;
} // gps_init()
// detect gps chipset type and configure it with device specific settings