diff --git a/src/protocol_v1/agilex_msg_parser_v1.c b/src/protocol_v1/agilex_msg_parser_v1.c index e05c0005..c5fed8da 100644 --- a/src/protocol_v1/agilex_msg_parser_v1.c +++ b/src/protocol_v1/agilex_msg_parser_v1.c @@ -15,6 +15,7 @@ #include "string.h" bool DecodeCanFrameV1(const struct can_frame *rx_frame, AgxMessage *msg) { + bool ret = true; // if checksum not correct if (!CalcCanFrameChecksumV1(rx_frame->can_id, (uint8_t *)rx_frame->data, rx_frame->can_dlc)) { @@ -87,10 +88,11 @@ bool DecodeCanFrameV1(const struct can_frame *rx_frame, AgxMessage *msg) { break; } default: + ret = false; break; } - return true; + return ret; } bool EncodeCanFrameV1(const AgxMessage *msg, struct can_frame *tx_frame) { diff --git a/src/protocol_v2/agilex_msg_parser_v2.c b/src/protocol_v2/agilex_msg_parser_v2.c index a625e290..5b561138 100644 --- a/src/protocol_v2/agilex_msg_parser_v2.c +++ b/src/protocol_v2/agilex_msg_parser_v2.c @@ -15,6 +15,7 @@ #include "math.h" bool DecodeCanFrameV2(const struct can_frame *rx_frame, AgxMessage *msg) { + bool ret = true; msg->type = AgxMsgUnkonwn; switch (rx_frame->can_id) { @@ -372,10 +373,11 @@ bool DecodeCanFrameV2(const struct can_frame *rx_frame, AgxMessage *msg) { break; } default: + ret = false; break; } - return true; + return ret; } bool EncodeCanFrameV2(const AgxMessage *msg, struct can_frame *tx_frame) {