You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't quite understand the values used in the uart_tx_file.ino file.
Why we use (MAX_PACKET_SIZE - 2) in some places, and just MAX_PACKET_SIZE in others.
In particular, the calculation of numPackets seems to be going wrong:
uint16_tnumPackets=fileSize / (MAX_PACKET_SIZE-2); // Reserve one byte for current file indexif (fileSize % MAX_PACKET_SIZE) // Add an extra transmission if needednumPackets++;
This comment is also not very clear: // Reserve one byte for current file index
Same here:
uint16_tfileIndex=i*MAX_PACKET_SIZE; // Determine the current file indexuint8_tdataLen=MAX_PACKET_SIZE-2;
if ((fileIndex+ (MAX_PACKET_SIZE-2)) >fileSize) // Determine data length for the last packet if file length is not an exact multiple of MAX_PACKET_SIZE-2dataLen=fileSize-fileIndex;
What does -2 mean?
The text was updated successfully, but these errors were encountered:
The code itself should be more or less ok as is, but there is a typo in the comment - I reserve "two" bytes for the current file index, not just one. That's where the -2 comes from
Hi!
I don't quite understand the values used in the uart_tx_file.ino file.
Why we use
(MAX_PACKET_SIZE - 2)
in some places, and justMAX_PACKET_SIZE
in others.In particular, the calculation of
numPackets
seems to be going wrong:This comment is also not very clear:
// Reserve one byte for current file index
Same here:
What does
-2
mean?The text was updated successfully, but these errors were encountered: