From 3974468399140e4d00369eab05db0ce55a069aaa Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 2 Jan 2015 12:30:44 +0100 Subject: [PATCH] reset mismatch counter on parity correction --- app/src/main/rs/decoder.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/rs/decoder.rs b/app/src/main/rs/decoder.rs index e6795fe..2c0a3f6 100644 --- a/app/src/main/rs/decoder.rs +++ b/app/src/main/rs/decoder.rs @@ -67,8 +67,10 @@ static void robot36_decoder(int sync_timeout) static int prev_timeout, mismatch_counter, parity, latch; if (!prev_timeout && 2 * abs(seperator_counter) > seperator_length) mismatch_counter = parity ^ (seperator_counter > 0) ? mismatch_counter + 1 : 0; - if ((free_running && mismatch_counter > 1) || mismatch_counter > 5) + if ((free_running && mismatch_counter > 1) || mismatch_counter > 5) { parity ^= 1; + mismatch_counter = 0; + } if (!free_running && !vpos && !latch) { parity = 0; latch = 1;