summaryrefslogtreecommitdiffstats
path: root/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-11-30 09:43:46 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-11-30 11:56:09 +0100
commite184a2a0ef5d0372fe3227a57a69d91740c499ba (patch)
treed39a19bae404c51befd5ff2dacd4c49f66df2886 /low-can-binding/can
parent3faa820b9decb72e90182cd80206242d300aad59 (diff)
Correctly reconstituting entire CAN frame
Change-Id: I39d226c6f6268ec880739e6b9230eb42ce475971 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/can')
-rw-r--r--low-can-binding/can/can-encoder.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/low-can-binding/can/can-encoder.cpp b/low-can-binding/can/can-encoder.cpp
index 5cb1f244..e0015da2 100644
--- a/low-can-binding/can/can-encoder.cpp
+++ b/low-can-binding/can/can-encoder.cpp
@@ -42,11 +42,12 @@ const can_frame encoder_t::build_frame(const std::shared_ptr<can_signal_t>& sign
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(),
+ float last_value = sig->get_last_value();
+ bitfield_encode_float(last_value,
+ sig->get_bit_position(),
+ sig->get_bit_size(),
+ sig->get_factor(),
+ sig->get_offset(),
cf.data,
CAN_MAX_DLEN);
}