# HG changeset patch
# User "Dave Page <dave.page@gleeble.com>"
# Date 1390359199 -46800
# Node ID f3843f68644f6d614a0e1ddbf93e9e7a0e043b34
# Parent  8476f196755b90ea6011662ed0390af44c6a176b
FoE: Fix expected packet number when busy

diff -r 8476f196755b -r f3843f68644f master/fsm_foe.c
--- a/master/fsm_foe.c	Wed Jan 22 13:01:45 2014 +1300
+++ b/master/fsm_foe.c	Wed Jan 22 15:53:19 2014 +1300
@@ -772,10 +772,15 @@
     opCode = EC_READ_U8(data);
 
     if (opCode == EC_FOE_OPCODE_BUSY) {
+        fsm->rx_expected_packet_no--;
         if (ec_foe_prepare_send_ack(fsm, datagram)) {
             ec_foe_set_rx_error(fsm, FOE_PROT_ERROR);
         }
         fsm->state = ec_fsm_foe_state_sent_ack;
+#ifdef DEBUG_FOE
+        EC_SLAVE_DBG(fsm->slave, 0, "%s() busy. Next pkt %u\n", __func__,
+                fsm->rx_expected_packet_no);
+#endif
         return;
     }