From c1bd628ce524f52851cf2bbcb4bc8bbc373dcd6b Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 20 Jun 2017 12:09:55 -0400 Subject: command: Directly call command_sendf() for ack/nak messages Don't use the sendf() macro for ack and nak messages - directly call the command_sendf() code instead. Signed-off-by: Kevin O'Connor --- src/command.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/command.c') diff --git a/src/command.c b/src/command.c index 62db0bfd..af84539f 100644 --- a/src/command.c +++ b/src/command.c @@ -222,6 +222,11 @@ command_lookup_parser(uint8_t cmdid) return &command_index[cmdid]; } +// Empty message (for ack/nak transmission) +const struct command_encoder encode_acknak PROGMEM = { + .max_size = MESSAGE_MIN, +}; + enum { CF_NEED_SYNC=1<<0, CF_NEED_VALID=1<<1 }; // Find the next complete message. @@ -256,7 +261,7 @@ command_find_block(char *buf, uint8_t buf_len, uint8_t *pop_count) goto nak; } next_sequence = ((msgseq + 1) & MESSAGE_SEQ_MASK) | MESSAGE_DEST; - sendf(""); // An empty message with a new sequence number is an ack + command_sendf(&encode_acknak); return 1; need_more_data: @@ -282,7 +287,7 @@ need_sync: ; return -1; sync_state |= CF_NEED_VALID; nak: - sendf(""); // An empty message with a duplicate sequence number is a nak + command_sendf(&encode_acknak); return -1; } -- cgit v1.2.3-70-g09d2