aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/command.c b/src/command.c
index 2df70d85..b0c7f882 100644
--- a/src/command.c
+++ b/src/command.c
@@ -257,7 +257,6 @@ command_find_block(uint8_t *buf, uint_fast8_t buf_len, uint_fast8_t *pop_count)
goto nak;
}
next_sequence = ((msgseq + 1) & MESSAGE_SEQ_MASK) | MESSAGE_DEST;
- command_sendf(&encode_acknak);
return 1;
need_more_data:
@@ -308,13 +307,22 @@ command_dispatch(uint8_t *buf, uint_fast8_t msglen)
}
}
+// Send an ack message to the host (notifying that it can send more data)
+void
+command_send_ack(void)
+{
+ command_sendf(&encode_acknak);
+}
+
// Find a message block and then dispatch all the commands in it
int_fast8_t
command_find_and_dispatch(uint8_t *buf, uint_fast8_t buf_len
, uint_fast8_t *pop_count)
{
int_fast8_t ret = command_find_block(buf, buf_len, pop_count);
- if (ret > 0)
+ if (ret > 0) {
command_dispatch(buf, *pop_count);
+ command_send_ack();
+ }
return ret;
}