File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -174,16 +174,16 @@ namespace sfe_KX13X
174174 return -1 ; // Fail immediately if the transmission isn't successful
175175
176176 // We're chunking in data - keeping the max chunk to kMaxI2CBufferLength
177- // The register address counts as one byte so limit nChunk to kChunkSize -1
178- nChunk = numBytes > (kChunkSize - 1 ) ? (kChunkSize - 1 ) : numBytes;
177+ nChunk = numBytes > kChunkSize ? kChunkSize : numBytes;
179178
180179 nReturned = _i2cPort->requestFrom ((int )addr, (int )nChunk, (int )true ); // Always send a stop
181180
182181 // No data returned, no dice
183182 if (nReturned == 0 )
184183 return -1 ; // error
185184
186- // Check we got back as much data as was requested
185+ // Check we got back as much data as was requested.
186+ // (Fringe case. This should never happen... But, you know, it _could_...)
187187 if (nReturned != nChunk)
188188 failCount++; // Increment the failCount
189189
You can’t perform that action at this time.
0 commit comments