diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-06-02 12:12:47 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-06-02 12:12:47 +0200 |
commit | b12d6b2ecee0be03122a4bdba8ebbc91112fae3f (patch) | |
tree | 1bcc95eb0c26ffd1fbf23fab79f9ea80f26425b8 /robot/modes.c | |
parent | 139651d45a72d57c5147e2854647d95cb87c9e4e (diff) |
dirc working
Diffstat (limited to 'robot/modes.c')
-rw-r--r-- | robot/modes.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/robot/modes.c b/robot/modes.c index f73a809..7decf47 100644 --- a/robot/modes.c +++ b/robot/modes.c @@ -46,13 +46,11 @@ void w2_modes_switch(w2_e_mode new_mode, bool replace) { } // forward mode change to sercomm - size_t msg_size = sizeof(w2_s_cmd_mode_tx); - w2_s_cmd_mode_tx *msg = malloc(msg_size); - msg->opcode = W2_CMD_MODE | W2_CMDDIR_TX; - msg->mode = (uint8_t)new_mode; - w2_s_bin *msg_bin = w2_bin_s_alloc(msg_size, (uint8_t *)msg); + W2_CREATE_MSG_BIN(w2_s_cmd_mode_tx, msg, msg_bin); + msg->opcode = W2_CMD_MODE | W2_CMDDIR_TX; + msg->mode = new_mode; + w2_sercomm_append_msg(msg_bin); - free(msg); free(msg_bin); } |