Adding stop as an argument for pushRawData - resolves #30

This commit is contained in:
PaulZC
2021-05-08 05:51:03 +01:00
parent 39cc5bbb13
commit f081f75c66
2 changed files with 8 additions and 5 deletions
+5 -3
View File
@@ -3394,7 +3394,9 @@ void SFE_UBLOX_GNSS::checkCallbacks(void)
// Push (e.g.) RTCM data directly to the module // Push (e.g.) RTCM data directly to the module
// Returns true if all numDataBytes were pushed successfully // Returns true if all numDataBytes were pushed successfully
// Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing. // Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing.
boolean SFE_UBLOX_GNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes) // Default to using a restart between transmissions. Set stop to true to use a stop instead.
// On processors like the ESP32, you can use setI2CTransactionSize to increase the size of each transmission - to e.g. 128 bytes
boolean SFE_UBLOX_GNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes, boolean stop)
{ {
if (commType == COMM_TYPE_SERIAL) if (commType == COMM_TYPE_SERIAL)
{ {
@@ -3425,12 +3427,12 @@ boolean SFE_UBLOX_GNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes)
if (bytesLeftToWrite > 0) if (bytesLeftToWrite > 0)
{ {
if (_i2cPort->endTransmission(false) != 0) //Send a restart command. Do not release bus. if (_i2cPort->endTransmission(stop) != 0) //Send a restart or stop command
return (false); //Sensor did not ACK return (false); //Sensor did not ACK
} }
else else
{ {
if (_i2cPort->endTransmission() != 0) //We're done. Release bus. if (_i2cPort->endTransmission() != 0) //We're done. Release bus. Always use a stop here
return (false); //Sensor did not ACK return (false); //Sensor did not ACK
} }
} }
+2 -1
View File
@@ -641,7 +641,8 @@ public:
// Push (e.g.) RTCM data directly to the module // Push (e.g.) RTCM data directly to the module
// Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing. // Warning: this function does not check that the data is valid. It is the user's responsibility to ensure the data is valid before pushing.
boolean pushRawData(uint8_t *dataBytes, size_t numDataBytes); // Default to using a restart between transmissions. Set stop to true to use a stop instead.
boolean pushRawData(uint8_t *dataBytes, size_t numDataBytes, boolean stop = false);
// Support for data logging // Support for data logging
void setFileBufferSize(uint16_t bufferSize); // Set the size of the file buffer. This must be called _before_ .begin. void setFileBufferSize(uint16_t bufferSize); // Set the size of the file buffer. This must be called _before_ .begin.