File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ namespace arduino
2222 * STATIC CONST DEFINITION
2323 **************************************************************************************/
2424
25- size_t const CanMsg::MAX_DATA_LENGTH;
25+ uint8_t const CanMsg::MAX_DATA_LENGTH;
2626uint32_t const CanMsg::CAN_EFF_FLAG;
2727uint32_t const CanMsg::CAN_SFF_MASK;
2828uint32_t const CanMsg::CAN_EFF_MASK;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ namespace arduino
3333class CanMsg : public Printable
3434{
3535public:
36- static size_t constexpr MAX_DATA_LENGTH = 8 ;
36+ static uint8_t constexpr MAX_DATA_LENGTH = 8 ;
3737
3838 static uint32_t constexpr CAN_EFF_FLAG = 0x80000000U ;
3939 static uint32_t constexpr CAN_SFF_MASK = 0x000007FFU ; /* standard frame format (SFF) */
@@ -42,10 +42,10 @@ class CanMsg : public Printable
4242
4343 CanMsg (uint32_t const can_id, uint8_t const can_data_len, uint8_t const * can_data_ptr)
4444 : id{can_id}
45- , data_length{can_data_len}
45+ , data_length{min ( can_data_len, MAX_DATA_LENGTH) }
4646 , data{0 }
4747 {
48- memcpy (data, can_data_ptr, min (can_data_len, MAX_DATA_LENGTH) );
48+ memcpy (data, can_data_ptr, data_length );
4949 }
5050
5151 CanMsg () : CanMsg(0 , 0 , nullptr ) { }
You can’t perform that action at this time.
0 commit comments