aboutsummaryrefslogtreecommitdiff
path: root/robot/sercomm.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-29 16:27:29 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-29 16:27:29 +0200
commit3b2c2cf6b2af9e76b343a5a8fc8e9245f240690d (patch)
treef257a9a03b8205f55301901d00c5865f8b179607 /robot/sercomm.c
parentf466856892d94f5b42bf2369cae0fd73dd468dfa (diff)
serial parsing working on client
Diffstat (limited to 'robot/sercomm.c')
-rw-r--r--robot/sercomm.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/robot/sercomm.c b/robot/sercomm.c
index 07c4bd8..e346cc2 100644
--- a/robot/sercomm.c
+++ b/robot/sercomm.c
@@ -3,7 +3,7 @@
#include "../shared/bin.h"
#include "../shared/serial_parse.h"
-#include "errcatch.h"
+#include "../shared/errcatch.h"
#include "hypervisor.h"
#include "io.h"
#include "mode_dirc.h"
@@ -58,26 +58,6 @@ void w2_sercomm_append_msg(w2_s_bin *data) {
g_w2_sercomm_index = next_index;
}
-void w2_cmd_handler(uint8_t data[W2_SERIAL_READ_BUFFER_SIZE], uint8_t data_length) {
- w2_s_bin *copy = w2_bin_s_alloc(data_length, data);
- void (*handler)(w2_s_bin *) = g_w2_cmd_handlers[data[0]];
-
- if (handler == NULL) {
-#ifdef W2_SIM
- // TODO throw warning
- simwarn("unknown serial message with code 0x%02x\n", data[0]);
-#endif
- w2_errcatch_throw(W2_E_WARN_SERIAL_NOISY);
- } else {
-#ifdef W2_SIM
- w2_sim_print_serial(copy);
-#endif
- handler(copy);
- }
-
- free(copy);
-}
-
void w2_cmd_ping_rx(w2_s_bin *data) {
w2_s_cmd_ping_rx *message = malloc(w2_cmd_sizeof(data->data, data->bytes));
memcpy(message, data->data, data->bytes);