Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Bug : isConnected function only works for i2c and fails for Serial #129

@sukesh-ak

Description

@sukesh-ak

Subject of the issue

Looks like isConnected function only works for i2c but its used in both (i2c & Serial) Begin functions.
So the detection fails in the case of UART connected modules.

//Returns true if I2C device ack's
boolean SFE_UBLOX_GPS::isConnected(uint16_t maxWait)
{
  if (commType == COMM_TYPE_I2C)
  {
    _i2cPort->beginTransmission((uint8_t)_gpsI2Caddress);
    if (_i2cPort->endTransmission() != 0)
      return false; //Sensor did not ack
  }

  // Query navigation rate to see whether we get a meaningful response
  packetCfg.cls = UBX_CLASS_CFG;
  packetCfg.id = UBX_CFG_RATE;
  packetCfg.len = 0;
  packetCfg.startingSpot = 0;

  return (sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_RECEIVED); // We are polling the RATE so we expect data and an ACK
}

This code does not work as expected

  if (myGPS.begin(GPSSerial) == false)
  {
    Serial.println(F("Ublox GPS not detected. Check wiring."));
    while (1)
      ;
  }

Your workbench

UBlox 8 connected to ESP32

Steps to reproduce

Use GPS module with UART and use begin check for module detection

Expected behavior

isConnected should implement routine for Serial too

Actual behavior

Fails the module detection logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions