Merge pull request #713 from cyberman54/development

bugfix i2c gps broken (issue #712)
This commit is contained in:
Verkehrsrot 2021-01-07 22:08:30 +01:00 committed by GitHub
commit 2834626f3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {
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