From 62ce1539e9714f2700305ba2a48db10731459d57 Mon Sep 17 00:00:00 2001
From: Bianka Forkel <noreply@fortiss.org>
Date: Tue, 18 Jul 2017 19:59:07 +0000
Subject: [PATCH] LRF: printf refs 7956

---
 .../trunk/lib/src/LaserRangeFinder.c                        | 6 ++++--
 1 file changed, 4 insertions(+), 2 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 a677ad7e..5d26c526 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
+++ b/org.fortiss.af3.platform.raspberry/trunk/lib/src/LaserRangeFinder.c
@@ -6,7 +6,7 @@ int timeout;
 /** Initialize the laser range finder. */
 void lrf_init() {
     timeout = 0;
-    
+
     /*
     char port[] = "/dev/????????";
     FILE* fp = popen("dmesg | grep -A 3 \"Arduino Uno\"  | grep -o \"ttyACM.\" | tail -n 1","r");
@@ -41,6 +41,7 @@ GEN_TYPE_int lrf_read() {
 
     if (uart_filestream == -1) {
         timeout++;
+        printf("-1: no filestream\n");
         return -1;
     }
 
@@ -67,8 +68,9 @@ GEN_TYPE_int lrf_read() {
     while (1) {
         n_read = uart_receive(bytes, sizeof(bytes) / sizeof(bytes[0]), 0);
 
-        if(n_read < 0) {
+        if(n_read <= 0) {
             timeout++;
+            printf("-1: n_read=%d\n",n_read);
             return -1;
         }
 
-- 
GitLab