Project

General

Profile

Revision 1789

wireless: added timeout on ackhandle

View differences:

branches/wireless/code/projects/libwireless/wireless_send.c
342 342
void ackhandle(uint8_t num,uint8_t val) {
343 343
  uint8_t len;
344 344
  uint8_t packets = 0;
345
  uint8_t num_packet = 0;
345 346
  WL_DEBUG_PRINT_P("entering ackhandle function: num:");
346 347
  WL_DEBUG_PRINT_HEX(num);
347 348
  WL_DEBUG_PRINT_P("\r\n");
......
369 370
      WL_DEBUG_PRINT_P("|send_buf:");
370 371
      for(int i=send_buf_first;i<send_buf_last;i++)
371 372
        WL_DEBUG_PRINT_HEX(send_buf[i]);
372
      if (send_buf_get(&val) != num) {
373
        // not the correct packet, so continue
373
      
374
      num_packet = send_buf_get(&val);
375
      if (num_packet != num) {
376
        // not the correct packet
377
        
378
        if ((num_packet < num && num > 9 && num_packet < num-10)
379
            || (num_packet > num && num > 9)) {
380
          ackhandle(num_packet,1); // resend
381
          ackhandle(num,0); // redo this packet
382
          return;
383
        }
384
        
374 385
        WL_DEBUG_PRINT_P("|not correct packet");
375 386
        val += len;
376 387
        WL_DEBUG_PRINT_P("|send_packet_buf_pos:");

Also available in: Unified diff