Skip to content

Commit f6d9770

Browse files
committed
Fix i2c transaction bug - uint8 limitation
When attempting to send a payload larger than 256 bytes, sendI2cCommand would fail with a `i2cAddQueue(): realloc Failure`. This was because the loop would run forever causing stack overflow.
1 parent 7beae46 commit f6d9770

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2728,7 +2728,7 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16
27282728
uint16_t startSpot = 0;
27292729
while (bytesToSend > 1)
27302730
{
2731-
uint8_t len = bytesToSend;
2731+
uint16_t len = bytesToSend;
27322732
if (len > i2cTransactionSize)
27332733
len = i2cTransactionSize;
27342734

0 commit comments

Comments
 (0)