Skip to content

Commit

Permalink
pointer to repeated packet with async ack bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gioblu committed Mar 9, 2017
1 parent 0a1c77e commit ddfd2c1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions PJON.h
Expand Up @@ -287,10 +287,12 @@ limitations under the License. */
uint16_t length, uint16_t length,
uint32_t timing, uint32_t timing,
uint16_t header = PJON_NOT_ASSIGNED, uint16_t header = PJON_NOT_ASSIGNED,
uint16_t p_id = 0 uint16_t p_id = 0,
uint16_t p_index = PJON_FAIL
) { ) {
for(uint8_t i = 0; i < PJON_MAX_PACKETS; i++) bool index = (p_index != PJON_FAIL);
if(packets[i].state == 0) { for(uint8_t i = (index) ? p_index : 0; i < PJON_MAX_PACKETS; i++)
if(packets[i].state == 0 || p_index) {
if(!(length = compose_packet( if(!(length = compose_packet(
id, b_id, packets[i].content, packet, length, header, p_id id, b_id, packets[i].content, packet, length, header, p_id
))) return PJON_FAIL; ))) return PJON_FAIL;
Expand Down Expand Up @@ -523,8 +525,10 @@ limitations under the License. */
packets[i].content + (offset - crc_offset), packets[i].content + (offset - crc_offset),
packets[i].length - offset, packets[i].length - offset,
packets[i].timing, packets[i].timing,
actual_info.header actual_info.header,
i
); );
return true;
} }
remove(i); remove(i);
return true; return true;
Expand Down

0 comments on commit ddfd2c1

Please sign in to comment.