From 1f141324cc953846d3528176efa77c60e2e60a0a Mon Sep 17 00:00:00 2001 From: AdonaiDiaz Date: Thu, 23 May 2024 11:54:32 -0600 Subject: [PATCH] fix: can read DLC correctly --- Canbus_app/libraries/mcp_can_2515.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Canbus_app/libraries/mcp_can_2515.c b/Canbus_app/libraries/mcp_can_2515.c index 639002d..350e0cc 100644 --- a/Canbus_app/libraries/mcp_can_2515.c +++ b/Canbus_app/libraries/mcp_can_2515.c @@ -344,10 +344,10 @@ void read_canframe(FuriHalSpiBusHandle* spi, const uint8_t addr, CANFRAME* frame else frame->req = 0; - frame->data_lenght = len; - len &= MCP_DLC_MASK; + frame->data_lenght = len; + for(uint8_t i = 0; i < len; i++) { read_register(spi, addr + 5 + i, &data); frame->buffer[i] = data;