From ba16f23513b14ee591e372e564401cedd644e45b Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 8 Nov 2017 09:55:23 +0100 Subject: [PATCH] Send entire CAN message rather than CAN signal. Old behavior send only the CAN signal, now we retrieve the CAN message value instead and send the CAN message with all CAN signals composing the message. Change-Id: I2394cc30630601e46aa939ddda88e8616372179e Signed-off-by: Romain Forlot --- low-can-binding/can/can-encoder.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/low-can-binding/can/can-encoder.cpp b/low-can-binding/can/can-encoder.cpp index 9ba85317..5cb1f244 100644 --- a/low-can-binding/can/can-encoder.cpp +++ b/low-can-binding/can/can-encoder.cpp @@ -37,13 +37,19 @@ const can_frame encoder_t::build_frame(const std::shared_ptr& sign cf.can_id = signal->get_message()->get_id(); cf.can_dlc = CAN_MAX_DLEN; - bitfield_encode_float((float)value, - signal->get_bit_position(), - signal->get_bit_size(), - signal->get_factor(), - signal->get_offset(), - cf.data, - CAN_MAX_DLEN); + + signal->set_last_value((float)value); + + for(const auto& sig: signal->get_message()->get_can_signals()) + { + bitfield_encode_float((float)value, + signal->get_bit_position(), + signal->get_bit_size(), + signal->get_factor(), + signal->get_offset(), + cf.data, + CAN_MAX_DLEN); + } return cf; } -- 2.16.6