From b4a19cda296baa7a5d1ec86af8a5adf2b0a8dd98 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 9 Mar 2017 00:46:58 +0100 Subject: Misplaced test of rtr_flag bool and length assignation Mini simplification of the method... More incoming. Change-Id: I2e7c2c5226e33265591acc6c8bbbe5f5f670db18 Signed-off-by: Romain Forlot --- src/can/can-message.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/can/can-message.cpp b/src/can/can-message.cpp index cf57876..dd15c06 100644 --- a/src/can/can-message.cpp +++ b/src/can/can-message.cpp @@ -166,11 +166,6 @@ can_message_t can_message_t::convert_to_canfd_frame(const struct canfd_frame& fr break; } - if(rtr_flag) - length = frame.len& 0xF; - else - length = (frame.len > maxdlen) ? maxdlen : frame.len; - if (frame.can_id & CAN_ERR_FLAG) format = can_message_format_t::ERROR; else if (frame.can_id & CAN_EFF_FLAG) @@ -211,6 +206,8 @@ can_message_t can_message_t::convert_to_canfd_frame(const struct canfd_frame& fr } else { + length = (frame.len > maxdlen) ? maxdlen : frame.len; + /* Flags field only present for CAN FD frames*/ if(maxdlen == CANFD_MAX_DLEN) flags = frame.flags & 0xF; -- cgit 1.2.3-korg