From 2a0270f3ba6eb993fb39ed3564f626d724156654 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 26 Jun 2022 17:40:36 +0200 Subject: implement battery measurement and target area switching --- robot/sercomm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'robot/sercomm.c') diff --git a/robot/sercomm.c b/robot/sercomm.c index a04d35f..0f251d2 100644 --- a/robot/sercomm.c +++ b/robot/sercomm.c @@ -154,13 +154,14 @@ 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; 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_qs / 1e3; - res_msg->io_ms = (uint8_t)g_w2_hypervisor_ema_io_qs / 1e3; - res_msg->sercomm_ms = (uint8_t)g_w2_hypervisor_ema_sercomm_qs / 1e3; - res_msg->mode_ms = (uint8_t)g_w2_hypervisor_ema_mode_qs / 1e3; - res_msg->uptime_s = w2_bin_hton32((uint32_t)(g_w2_hypervisor_uptime_qs / 1e6)); - res_msg->mode = g_w2_mode_history[g_w2_mode_history_index]; - res_msg->battery_mv = w2_bin_hton16(read_battery_millivolts()); + res_msg->errcatch_ms = (uint8_t)g_w2_hypervisor_ema_errcatch_qs / 1e3; + res_msg->io_ms = (uint8_t)g_w2_hypervisor_ema_io_qs / 1e3; + res_msg->sercomm_ms = (uint8_t)g_w2_hypervisor_ema_sercomm_qs / 1e3; + res_msg->mode_ms = (uint8_t)g_w2_hypervisor_ema_mode_qs / 1e3; + res_msg->uptime_s = w2_bin_hton32((uint32_t)(g_w2_hypervisor_uptime_qs / 1e6)); + res_msg->mode = g_w2_mode_history[g_w2_mode_history_index]; + res_msg->battery_mv = w2_bin_hton16(g_w2_io_battery_mv); + res_msg->battery_percent = g_w2_io_battery_percentage; w2_sercomm_append_msg(res_bin); free(res_bin); -- cgit v1.2.3