diff options
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"); |