diff --git a/src/gpsread.cpp b/src/gpsread.cpp index 3b764b55..a29d9c9f 100644 --- a/src/gpsread.cpp +++ b/src/gpsread.cpp @@ -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