Skip to content

Commit b0f0eb5

Browse files
committed
Fix #27
1 parent e6fd94e commit b0f0eb5

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/u-blox_GNSS.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ void DevUBLOXGNSS::setSpiBufferSize(size_t bufferSize)
962962
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
963963
if (_printDebug == true)
964964
{
965-
_debugSerial.println(F("setSpiTransactionSize: you need to call setSpiBufferSize _before_ begin!"));
965+
_debugSerial.println(F("setSpiBufferSize: you need to call setSpiBufferSize _before_ begin!"));
966966
}
967967
#endif
968968
}
@@ -6089,8 +6089,23 @@ bool DevUBLOXGNSS::pushRawData(uint8_t *dataBytes, size_t numDataBytes, bool cal
60896089
bool ok = false;
60906090
if (_commType == COMM_TYPE_SERIAL)
60916091
{
6092-
// Serial: write all the bytes in one go
6093-
ok = writeBytes(dataBytes, numDataBytes) == numDataBytes;
6092+
// Serial: writeBytes can only write 255 bytes maximum, so we need to divide up into chunks if required
6093+
ok = true;
6094+
size_t bytesLeftToWrite = numDataBytes;
6095+
while (bytesLeftToWrite > 0)
6096+
{
6097+
uint8_t bytesToWrite;
6098+
6099+
if (bytesLeftToWrite < 0x100)
6100+
bytesToWrite = (uint8_t)bytesLeftToWrite;
6101+
else
6102+
bytesToWrite = 0xFF;
6103+
6104+
ok &= (writeBytes(dataBytes, bytesToWrite) == bytesToWrite); // Will set ok to false if any one write fails
6105+
6106+
bytesLeftToWrite -= (size_t)bytesToWrite;
6107+
dataBytes += bytesToWrite;
6108+
}
60946109
}
60956110
else if (_commType == COMM_TYPE_I2C)
60966111
{

0 commit comments

Comments
 (0)