mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 05:37:54 -06:00
command: Add a command_encode_and_frame() helper
Add a helper function that calls command_encodef() followed by command_add_frame(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
cb4e165071
commit
c8af3feee6
6 changed files with 17 additions and 9 deletions
|
@ -167,6 +167,16 @@ command_add_frame(uint8_t *buf, uint_fast8_t msglen)
|
|||
buf[msglen - MESSAGE_TRAILER_SYNC] = MESSAGE_SYNC;
|
||||
}
|
||||
|
||||
// Encode a message and then add a message block frame around it
|
||||
uint_fast8_t
|
||||
command_encode_and_frame(uint8_t *buf, const struct command_encoder *ce
|
||||
, va_list args)
|
||||
{
|
||||
uint_fast8_t msglen = command_encodef(buf, ce, args);
|
||||
command_add_frame(buf, msglen);
|
||||
return msglen;
|
||||
}
|
||||
|
||||
static uint8_t in_sendf;
|
||||
|
||||
// Encode and transmit a "response" message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue