From d2c94921a6e02bd87d5e551daa262a4c99bc3eb4 Mon Sep 17 00:00:00 2001
From: Bianka Forkel <noreply@fortiss.org>
Date: Wed, 19 Jul 2017 09:40:46 +0000
Subject: [PATCH] LRF: filtered value 1061 refs 7956

---
 .../trunk/lib/src/LaserRangeFinder.c               | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 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 87c80295..c1327b18 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
+++ b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
@@ -88,14 +88,18 @@ GEN_TYPE_int lrf_read() {
                 }
             } else {
                 d = atoi(value);
-                if (d != 0) {
-                    printf("%d\n", d);
-                    timeout = 0;
-                    return d;
-                } else {
+                if (d == 0) {
                     timeout++;
                     printf("-1: zero value\n");
                     return -1;
+                } else if(d == 1061) { //strange behaviour of one lrf
+                    printf("-1: 1061\n");
+                    return -1;
+                }
+                else {
+                    printf("%d\n", d);
+                    timeout = 0;
+                    return d;
                 }
             }
         }
-- 
GitLab