summaryrefslogtreecommitdiffstats
path: root/CAN-binder
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-31 17:14:39 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-01 18:26:18 +0200
commitdeb7525f8e54859a8b271258cf01fe7e6fbe4b94 (patch)
treeb551bc2e2e4a547e77710d66de52025c3df16d65 /CAN-binder
parent6c988cacd4fa284b0effb12e65c76502565c4248 (diff)
Use default signal frequency if no filter provided
Change-Id: I60bc1cdd62a75b539684032bbb58c38256149944 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder')
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-cb.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
index 2e3a10fb..48e22411 100644
--- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp
+++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
@@ -139,6 +139,9 @@ int low_can_subscription_t::create_rx_filter(std::shared_ptr<can_signal_t> sig)
/// @return 0 if ok else -1
int low_can_subscription_t::create_rx_filter()
{
+ if (can_signal_ == nullptr)
+ {return -1;}
+
// Make sure that socket has been opened.
if(! socket_)
{
@@ -154,7 +157,7 @@ int low_can_subscription_t::create_rx_filter()
float val = (float)(1 << can_signal_->get_bit_size()) - 1;
struct timeval freq;
- frequency_clock_t f(event_filter_.frequency);
+ frequency_clock_t f = event_filter_.frequency > 0.0f ? frequency_clock_t(event_filter_.frequency) : can_signal_->get_frequency();
freq = f.get_timeval_from_period();
bcm_msg.msg_head.opcode = RX_SETUP;