diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-27 13:58:12 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-27 13:58:12 +0200 |
commit | 5882adbf21363e63b1069f6321ca7c08d1fa9b41 (patch) | |
tree | d4753e0b33cf50fe4270d7fa174b3f20c4b5f5a1 /robot | |
parent | 31daa9db97a0d0e094c20ac8f3891d3633610039 (diff) |
implement SRES
Diffstat (limited to 'robot')
-rw-r--r-- | robot/sercomm.c | 19 | ||||
-rw-r--r-- | robot/setup.c | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/robot/sercomm.c b/robot/sercomm.c index 608cb04..07c4bd8 100644 --- a/robot/sercomm.c +++ b/robot/sercomm.c @@ -117,7 +117,24 @@ void w2_cmd_cord_rx(w2_s_bin *data) { return; } void w2_cmd_bomd_rx(w2_s_bin *data) { return; } -void w2_cmd_sres_rx(w2_s_bin *data) { return; } +void w2_cmd_sres_rx(w2_s_bin *data) { + w2_s_cmd_sres_rx *message = malloc(w2_cmd_sizeof(data->data, data->bytes)); + memcpy(message, data->data, data->bytes); + + switch (message->type) { + case W2_CMD_SRES_RX_TYPE_REINITGS: { + // TODO: soft-reset + break; + } + case W2_CMD_SRES_RX_TYPE_PREVMODE: { + w2_modes_call(W2_M_PREV); + break; + } + default: { + w2_errcatch_throw(W2_E_WARN_SERIAL_NOISY); + } + } +} void w2_cmd_mcfg_rx(w2_s_bin *data) { return; } diff --git a/robot/setup.c b/robot/setup.c index 2c426a3..95b201e 100644 --- a/robot/setup.c +++ b/robot/setup.c @@ -28,7 +28,8 @@ void w2_setup_main() { time_reset(); // set default mode - w2_modes_swap(W2_M_HALT); + w2_modes_swap(W2_M_MAZE); + w2_modes_call(W2_M_HALT); // indicate startup done play("L50 c>c"); |