summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/binding/low-can-cb.cpp
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-30 19:21:22 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-01 18:26:17 +0200
commit829e92779abd4ea0e79d558242523d9757436332 (patch)
tree110e85c08e5b581536513084e2fd70c75f415e6a /CAN-binder/low-can-binding/binding/low-can-cb.cpp
parent02deb38e600ba46a695963c6bb71ff13056761ee (diff)
manage unset values with NAN
Change-Id: I144bc110864f507e57d5e4b7f03ee1c0aa61ff63 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/binding/low-can-cb.cpp')
-rw-r--r--CAN-binder/low-can-binding/binding/low-can-cb.cpp7
1 files changed, 1 insertions, 6 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 ace5348..4fa375b 100644
--- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp
+++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp
@@ -395,12 +395,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
// poll a PID for nothing.
if(sig->get_supported() && subscribe)
{
- float frequency;
-
- if(event_filter.frequency >= 0)
- { frequency = event_filter.frequency; }
- else
- { frequency = sig->get_frequency(); }
+ float frequency = isnan(event_filter.frequency) ? sig->get_frequency() : event_filter.frequency;
diag_m.add_recurring_request(diag_req, sig->get_name().c_str(), false, sig->get_decoder(), sig->get_callback(), frequency);
//TODO: Adding callback requesting ignition status: diag_req, sig.c_str(), false, diagnostic_message_t::decode_obd2_response, diagnostic_message_t::check_ignition_status, frequency);