From f8b74a0aa31d116f087aa1ff40dec48a9308a5d8 Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Sat, 18 Mar 2023 23:01:52 +0100 Subject: [PATCH] Send min voltage & max temp as 16 bit ints --- Core/Lib/can-halal | 2 +- Core/Src/can.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/Lib/can-halal b/Core/Lib/can-halal index eb74553..b2929ad 160000 --- a/Core/Lib/can-halal +++ b/Core/Lib/can-halal @@ -1 +1 @@ -Subproject commit eb74553f896ed2739fc73cee13cbde9e19e1d66a +Subproject commit b2929ad66414b394805ee1d2b9c4778a2f9fe515 diff --git a/Core/Src/can.c b/Core/Src/can.c index 1888d60..33a20df 100644 --- a/Core/Src/can.c +++ b/Core/Src/can.c @@ -20,12 +20,12 @@ void can_init(CAN_HandleTypeDef *handle) { } HAL_StatusTypeDef can_send_status() { - uint8_t data[4]; + uint8_t data[6]; data[0] = ts_state.current_state; data[1] = current_soc; - data[2] = min_voltage >> 8; - data[3] = max_temp >> 4; - return ftcan_transmit(CAN_ID_AMS_STATUS, data, 4); + ftcan_marshal_unsigned(&data[2], min_voltage, 2); + ftcan_marshal_signed(&data[4], max_temp, 2); + return ftcan_transmit(CAN_ID_AMS_STATUS, data, sizeof(data)); } void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data) {