summaryrefslogtreecommitdiffstats
path: root/low-can-binding/can/can-decoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/can/can-decoder.cpp')
-rw-r--r--low-can-binding/can/can-decoder.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/low-can-binding/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp
index 4a3f87f4..0af488b2 100644
--- a/low-can-binding/can/can-decoder.cpp
+++ b/low-can-binding/can/can-decoder.cpp
@@ -94,30 +94,32 @@ int decoder_t::handle_sign(const signal_t& signal, std::vector<uint8_t>& data_si
///
float decoder_t::parse_signal_bitfield(signal_t& signal, std::shared_ptr<message_t> message)
{
- const std::vector<uint8_t> data = message->get_data_vector();
+ int sign;
+ std::vector<uint8_t> data;
std::vector<uint8_t> data_signal;
uint8_t bit_size = (uint8_t) signal.get_bit_size();
uint32_t bit_position = signal.get_bit_position();
+ int new_start_byte = 0;
+ int new_end_byte = 0;
+ uint8_t new_start_bit = 0;
+ uint8_t new_end_bit = 0;
+
if(signal.get_message()->frame_layout_is_bigendian())
{
bit_position = converter_t::bit_position_swap(message->get_length(),
signal.get_bit_position(),
- signal.get_bit_size());
+ bit_size);
message->frame_swap();
}
- int new_start_byte = 0;
- int new_end_byte = 0;
- uint8_t new_start_bit = 0;
- uint8_t new_end_bit = 0;
-
+ data = message->get_data_vector();
converter_t::signal_to_bits_bytes(bit_position, bit_size, new_start_byte, new_end_byte, new_start_bit, new_end_bit);
for(int i=new_start_byte;i<=new_end_byte;i++)
data_signal.push_back(data[i]);
- int sign = decoder_t::handle_sign(signal, data_signal, new_end_bit, data);
+ sign = handle_sign(signal, data_signal, new_end_bit, data);
if(data_signal.size() > 65535)
AFB_ERROR("Too long data signal %s", signal.get_name().c_str());