mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 05:37:54 -06:00
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 <kevin@koconnor.net>
This commit is contained in:
parent
c8af3feee6
commit
528f9f7604
5 changed files with 17 additions and 10 deletions
|
@ -307,3 +307,14 @@ command_dispatch(uint8_t *buf, uint_fast8_t msglen)
|
|||
func(args);
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
command_dispatch(buf, *pop_count);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue