From 556f4384a39d5359dd398d9d8630db2f23683e6d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 25 Sep 2018 12:09:04 +0200 Subject: [PATCH] uldaq: check that signal definitions are correct. --- etc/uldaq.conf | 4 ++-- lib/nodes/uldaq.c | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/etc/uldaq.conf b/etc/uldaq.conf index b04d8ba76..436315139 100644 --- a/etc/uldaq.conf +++ b/etc/uldaq.conf @@ -4,11 +4,11 @@ nodes = { in = { signals = ( - { name = "ch0", channel = 0, range = "bipolar-10" } + { name = "ch0", type = "float", channel = 0, range = "bipolar-10" } ) sample_rate = 1000, vectorize = 100 } } -} \ No newline at end of file +} diff --git a/lib/nodes/uldaq.c b/lib/nodes/uldaq.c index 3612d1b68..afb831dc1 100644 --- a/lib/nodes/uldaq.c +++ b/lib/nodes/uldaq.c @@ -191,6 +191,15 @@ int uldaq_check(struct node *n) return -1; } + for (size_t i = 0; i < list_length(&n->signals); i++) { + struct signal *s = (struct signal *) list_at(&n->signals, i); + + if (s->type != SIGNAL_TYPE_FLOAT) { + warn("Node '%s' only supports signals of type = float!", node_name(n)); + return -1; + } + } + return 0; }