aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/can/can-encoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/can/can-encoder.cpp')
-rw-r--r--low-can-binding/can/can-encoder.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/low-can-binding/can/can-encoder.cpp b/low-can-binding/can/can-encoder.cpp
index 9ba8531..5cb1f24 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<can_signal_t>& 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;
}