From 528f9f76042a7d82a2108f4ea582c61481368ecf Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 24 May 2018 13:18:03 -0400 Subject: command: Add command_find_and_dispatch() helper Add a helper function that calls command_find_block() followed by command_dispatch(). Signed-off-by: Kevin O'Connor --- src/avr/usbserial.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/avr') diff --git a/src/avr/usbserial.c b/src/avr/usbserial.c index fe378227..2a16160d 100644 --- a/src/avr/usbserial.c +++ b/src/avr/usbserial.c @@ -7,7 +7,7 @@ #include // memmove #include "../lib/pjrc_usb_serial/usb_serial.h" #include "board/misc.h" // console_sendf -#include "command.h" // command_dispatch +#include "command.h" // command_find_and_dispatch #include "sched.h" // DECL_INIT static uint8_t receive_buf[MESSAGE_MAX], receive_pos; @@ -51,9 +51,7 @@ console_task(void) { console_check_input(); uint_fast8_t pop_count; - int8_t ret = command_find_block(receive_buf, receive_pos, &pop_count); - if (ret > 0) - command_dispatch(receive_buf, pop_count); + int8_t ret = command_find_and_dispatch(receive_buf, receive_pos, &pop_count); if (ret) console_pop_input(pop_count); } -- cgit v1.2.3-70-g09d2