@@ -126,7 +126,7 @@ uint8_t _findCanPacketSlot(long unsigned int from, long unsigned int currentPart
126126 " ,PACK_ID=%" PRIu8 " ,LAST_PART=%" PRIu8 " \n " ), packets[i].locked , packets[i].address , packets[i].packetId ,
127127 packets[i].lastReceivedPart );
128128 if (packets[i].locked && packets[i].address == from && packets[i].packetId == messageId &&
129- packets[i].lastReceivedPart == currentPart + 1 ) {
129+ packets[i].lastReceivedPart == currentPart) {
130130 slot = i;
131131 }
132132 }
@@ -188,7 +188,7 @@ bool transportSend(const uint8_t to, const void *data, const uint8_t len, const
188188 uint8_t partLen;
189189 if (len <= 8 ) {
190190 partLen = len;
191- } else if (currentFrame * 8 <= len) {
191+ } else if (currentFrame * 8 + 8 <= len) {
192192 partLen = 8 ;
193193 } else {
194194 partLen = len % 8 ;
@@ -210,10 +210,11 @@ bool transportSend(const uint8_t to, const void *data, const uint8_t len, const
210210 if (sndStat == CAN_OK) {
211211 CAN_DEBUG (PSTR (" CAN:SND:OK\n " ));
212212 } 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 ;
217218}
218219
219220bool transportDataAvailable (void )
@@ -238,6 +239,8 @@ bool transportDataAvailable(void)
238239 if (currentPart == 0 ) {
239240 slot = _findCanPacketSlot ();
240241 packets[slot].locked = true ;
242+ packets[slot].address = from;
243+ packets[slot].packetId = messageId;
241244 } else {
242245 slot = _findCanPacketSlot (from, currentPart, messageId);
243246 }
0 commit comments