]> www.fi.muni.cz Git - openparking.git/commitdiff
Count consecutive errors only once.
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 27 May 2015 10:47:12 +0000 (12:47 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 27 May 2015 10:47:12 +0000 (12:47 +0200)
firmware/firmware.c

index c2dd944e54f12566a8bee73473076fe99f7b03e4..d57a5a2b531290a3fdf3ff0ffe8b49b52ce8012b 100644 (file)
@@ -110,7 +110,7 @@ static void do_measurement(unsigned char trig)
 
                if (to_start & (1 << i)) { // echo not received
                        uint16_t err_count = err_counts[off] & 0xFF;
-                       if (err_count < 255) {
+                       if (distances[off] != -1 && err_count < 255) {
                                err_count++;
                                err_counts[off] = (err_counts[off] & 0xFF00)
                                        | err_count;