@@ -126,7 +126,7 @@ uint8_t _findCanPacketSlot(long unsigned int from, long unsigned int currentPart
126
126
" ,PACK_ID=%" PRIu8 " ,LAST_PART=%" PRIu8 " \n " ), packets[i].locked , packets[i].address , packets[i].packetId ,
127
127
packets[i].lastReceivedPart );
128
128
if (packets[i].locked && packets[i].address == from && packets[i].packetId == messageId &&
129
- packets[i].lastReceivedPart == currentPart + 1 ) {
129
+ packets[i].lastReceivedPart == currentPart) {
130
130
slot = i;
131
131
}
132
132
}
@@ -188,7 +188,7 @@ bool transportSend(const uint8_t to, const void *data, const uint8_t len, const
188
188
uint8_t partLen;
189
189
if (len <= 8 ) {
190
190
partLen = len;
191
- } else if (currentFrame * 8 <= len) {
191
+ } else if (currentFrame * 8 + 8 <= len) {
192
192
partLen = 8 ;
193
193
} else {
194
194
partLen = len % 8 ;
@@ -210,10 +210,11 @@ bool transportSend(const uint8_t to, const void *data, const uint8_t len, const
210
210
if (sndStat == CAN_OK) {
211
211
CAN_DEBUG (PSTR (" CAN:SND:OK\n " ));
212
212
} else {
213
- CAN_DEBUG (PSTR (" !CAN:SND:FAIL\n " ));
214
- return false ;
215
- }
216
- }
213
+ CAN_DEBUG (PSTR (" !CAN:SND:FAIL\n " ));
214
+ return false ;
215
+ }
216
+ }
217
+ return true ;
217
218
}
218
219
219
220
bool transportDataAvailable (void )
@@ -238,6 +239,8 @@ bool transportDataAvailable(void)
238
239
if (currentPart == 0 ) {
239
240
slot = _findCanPacketSlot ();
240
241
packets[slot].locked = true ;
242
+ packets[slot].address = from;
243
+ packets[slot].packetId = messageId;
241
244
} else {
242
245
slot = _findCanPacketSlot (from, currentPart, messageId);
243
246
}
0 commit comments