aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-03-09 00:46:58 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-03-16 17:10:40 +0100
commitb4a19cda296baa7a5d1ec86af8a5adf2b0a8dd98 (patch)
tree48bef6ad1f4a4fe958e07febb23c08203fc2936a
parent11e909e8a7f8bd5978f0ff231ae6d3dd1dfff2e7 (diff)
Misplaced test of rtr_flag bool and length assignation
Mini simplification of the method... More incoming. Change-Id: I2e7c2c5226e33265591acc6c8bbbe5f5f670db18 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--src/can/can-message.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/can/can-message.cpp b/src/can/can-message.cpp
index cf57876d..dd15c06f 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;