From 478b4f2ff99c0bd8828d857bfe4c06e3884b1c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Fri, 25 Aug 2023 10:32:28 +0200 Subject: [PATCH] fix CAN id message I'm fucking dump --- 306-controller_interface.X/middleware/can_interface.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/306-controller_interface.X/middleware/can_interface.c b/306-controller_interface.X/middleware/can_interface.c index ec598b9..ac2d631 100644 --- a/306-controller_interface.X/middleware/can_interface.c +++ b/306-controller_interface.X/middleware/can_interface.c @@ -74,9 +74,13 @@ bool CAN_processEvent(Event* ev) { CAN_4_BYTES tmpData; tmpData.full.bytes = data; - uint8_t idMsg = 0x0F && (tmpData.separate.byte0>>4); - uint8_t idRecipient = 0x0F && tmpData.separate.byte1; - uint8_t idSender = (tmpData.separate.byte1>>4); + uint8_t idMsg = tmpData.separate.byte0; + idMsg = idMsg >> 4; + idMsg = idMsg & 0xF; + uint8_t idRecipient = tmpData.separate.byte1; + idRecipient = idRecipient & 0xF; + uint8_t idSender = tmpData.separate.byte1; + idSender = idSender >> 4; me->receiveCan(idSender, idMsg, canData); }