X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=low-can-binding%2Fcan%2Fcan-encoder.cpp;h=8adbd884fe9a1912866b37a33f6a67f2657fd6be;hb=refs%2Fchanges%2F72%2F23472%2F2;hp=596cc7e20b6bd9f06a88da6bb751aefd76a93416;hpb=92a9d02e999eb72ff08fa0fea375553dbb76a4e6;p=apps%2Fagl-service-can-low-level.git diff --git a/low-can-binding/can/can-encoder.cpp b/low-can-binding/can/can-encoder.cpp index 596cc7e2..8adbd884 100644 --- a/low-can-binding/can/can-encoder.cpp +++ b/low-can-binding/can/can-encoder.cpp @@ -44,14 +44,12 @@ void encoder_t::encode_data(std::shared_ptr sig, std::vector uint8_t new_end_bit = 0; converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit, new_end_bit); - std::vector data_signal(new_end_byte - new_start_byte + 1); + std::vector data_signal(new_end_byte - new_start_byte + 1, 0xFF); if(filter) { - for (auto& elt: data_signal) - elt = 0xFF; - uint8_t mask_first_v = static_cast(0xFF << new_start_bit); - uint8_t mask_last_v = static_cast(0xFF >> (7 - new_end_bit)); + uint8_t mask_first_v = static_cast(0xFF >> new_start_bit); + uint8_t mask_last_v = static_cast(0xFF << (7 - new_end_bit)); if(new_start_byte == new_end_byte) {