From a49347dc8d3b0a3f309b92058c45733fc057d510 Mon Sep 17 00:00:00 2001 From: Bianka Forkel <noreply@fortiss.org> Date: Wed, 19 Jul 2017 09:23:43 +0000 Subject: [PATCH] LRF: zero value causes timeout refs 7956 --- .../trunk/lib/src/LaserRangeFinder.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c index 93eb8c41..87c80295 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c +++ b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c @@ -88,9 +88,15 @@ GEN_TYPE_int lrf_read() { } } else { d = atoi(value); - printf("%d\n",d); - timeout = 0; - return d; + if (d != 0) { + printf("%d\n", d); + timeout = 0; + return d; + } else { + timeout++; + printf("-1: zero value\n"); + return -1; + } } } } -- GitLab