diff options
Diffstat (limited to 'robot')
-rw-r--r-- | robot/hypervisor.c | 5 | ||||
-rw-r--r-- | robot/modes.c | 2 | ||||
-rw-r--r-- | robot/sercomm.c | 18 |
3 files changed, 12 insertions, 13 deletions
diff --git a/robot/hypervisor.c b/robot/hypervisor.c index 3359bf6..4f994a8 100644 --- a/robot/hypervisor.c +++ b/robot/hypervisor.c @@ -1,6 +1,6 @@ #include "hypervisor.h" -#include "../shared/util.h" #include "../shared/errcatch.h" +#include "../shared/util.h" #include "io.h" #include "modes.h" #include "orangutan_shim.h" @@ -46,8 +46,7 @@ void w2_hypervisor_main() { if (DBG_ENABLE_CYCLEINFO) siminfo("cycle end\n"); if (DBG_CYCLE_DELAY > 0) usleep(DBG_CYCLE_DELAY); - if (DBG_MAX_CYCLES > -1 && g_w2_hypervisor_cycles > DBG_MAX_CYCLES) - exit(0); + if (DBG_MAX_CYCLES > -1 && g_w2_hypervisor_cycles > DBG_MAX_CYCLES) exit(0); #endif g_w2_hypervisor_cycles++; diff --git a/robot/modes.c b/robot/modes.c index 55bb1d4..928e2b4 100644 --- a/robot/modes.c +++ b/robot/modes.c @@ -1,7 +1,7 @@ #include "modes.h" +#include "../shared/errcatch.h" #include "../shared/protocol.h" #include "../shared/util.h" -#include "../shared/errcatch.h" #include "sercomm.h" /** function pointer to current mode */ diff --git a/robot/sercomm.c b/robot/sercomm.c index 5ac9a87..2317d89 100644 --- a/robot/sercomm.c +++ b/robot/sercomm.c @@ -2,8 +2,8 @@ #include <string.h> #include "../shared/bin.h" -#include "../shared/serial_parse.h" #include "../shared/errcatch.h" +#include "../shared/serial_parse.h" #include "hypervisor.h" #include "io.h" #include "mode_dirc.h" @@ -65,8 +65,8 @@ void w2_cmd_ping_rx(w2_s_bin *data) { W2_CAST_BIN(w2_s_cmd_ping_rx, data, req); W2_CREATE_MSG_BIN(w2_s_cmd_ping_tx, res_msg, res_bin); - res_msg->opcode = W2_CMD_PING | W2_CMDDIR_TX; - res_msg->id = req->id; + res_msg->opcode = W2_CMD_PING | W2_CMDDIR_TX; + res_msg->id = req->id; w2_sercomm_append_msg(res_bin); free(res_bin); @@ -112,7 +112,7 @@ void w2_cmd_mcfg_rx(w2_s_bin *data) { return; } void w2_cmd_sens_rx(w2_s_bin *data) { W2_CREATE_MSG_BIN(w2_s_cmd_sens_tx, res_msg, res_bin); - res_msg->opcode = W2_CMD_SENS | W2_CMDDIR_TX; + res_msg->opcode = W2_CMD_SENS | W2_CMDDIR_TX; memcpy((uint8_t *)&res_msg->io, (uint8_t *)&g_w2_io, sizeof(w2_s_io_all)); for (int i = 0; i < 5; i++) w2_bin_repl_hton16(&res_msg->io.qtr[i].range); @@ -128,13 +128,13 @@ void w2_cmd_sens_rx(w2_s_bin *data) { void w2_cmd_info_rx(w2_s_bin *data) { W2_CREATE_MSG_BIN(w2_s_cmd_info_tx, res_msg, res_bin); - res_msg->opcode = W2_CMD_INFO | W2_CMDDIR_TX; + res_msg->opcode = W2_CMD_INFO | W2_CMDDIR_TX; strncpy((char *)res_msg->build_str, W2_BUILD_STR, sizeof(res_msg->build_str)); res_msg->errcatch_ms = (uint8_t)g_w2_hypervisor_ema_errcatch_ms; - res_msg->io_ms = (uint8_t)g_w2_hypervisor_ema_io_ms; - res_msg->sercomm_ms = (uint8_t)g_w2_hypervisor_ema_sercomm_ms; - res_msg->mode_ms = (uint8_t)g_w2_hypervisor_ema_mode_ms; - res_msg->uptime_s = w2_bin_hton32((uint32_t)(g_w2_hypervisor_uptime_ms / 1e3)); + res_msg->io_ms = (uint8_t)g_w2_hypervisor_ema_io_ms; + res_msg->sercomm_ms = (uint8_t)g_w2_hypervisor_ema_sercomm_ms; + res_msg->mode_ms = (uint8_t)g_w2_hypervisor_ema_mode_ms; + res_msg->uptime_s = w2_bin_hton32((uint32_t)(g_w2_hypervisor_uptime_ms / 1e3)); w2_sercomm_append_msg(res_bin); free(res_bin); |