From: Jan "Yenya" Kasprzak Date: Wed, 27 May 2015 10:47:12 +0000 (+0200) Subject: Count consecutive errors only once. X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=openparking.git;a=commitdiff_plain;h=7b7601109907bbacc91cb7895557218db57fc700 Count consecutive errors only once. --- diff --git a/firmware/firmware.c b/firmware/firmware.c index c2dd944..d57a5a2 100644 --- a/firmware/firmware.c +++ b/firmware/firmware.c @@ -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;