XBee API mode library

Revision:
3:8453df14bd30
Parent:
0:0232a97b3883
Child:
8:776b8dc51932
--- a/Send.cpp	Thu Sep 20 02:44:49 2012 +0000
+++ b/Send.cpp	Thu Sep 20 10:50:00 2012 +0000
@@ -139,18 +139,21 @@
 
     createTxRequest(frame_id, data, length, buf, sizeof(buf));
     sendFrame(buf, length + 14);
-    frame_id = frame_id % 255 + 1;
-    
+
     if (confirm) {
-        int index = seekFor(ZigBeeTransmitStatus, 3.0);
+        int index = seekFor(ZigBeeTransmitStatus, frame_id, 3.0);
         if (index != -1) {
             char delivery;
             scan(index, DeliveryStatus, &delivery);
             buf[INDEX(index + 2)] = 0x00;
+            frame_id = frame_id % 255 + 1;
+            
             return delivery == 0;
         }
     }
     
+    frame_id = frame_id % 255 + 1;
+
     return false;
 }