From: marshmellow42 <marshmellowrf@gmail.com>
Date: Tue, 28 Feb 2017 16:53:55 +0000 (-0500)
Subject: fix STT bug for strong waves (or cleaned ones)
X-Git-Tag: v3.0.0~62^2~6
X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/dda5a928f0a598f21ee01396eae9b2c6da603f11?hp=40c6a02bc9b602885f2887c023e17a8559cc733c

fix STT bug for strong waves (or cleaned ones)
---

diff --git a/common/lfdemod.c b/common/lfdemod.c
index f5fee22a..12511208 100644
--- a/common/lfdemod.c
+++ b/common/lfdemod.c
@@ -1759,6 +1759,10 @@ bool DetectST(uint8_t buffer[], size_t *size, int *foundclock) {
 			for(i=0; i < clk/2-tol; ++i) {
 				buffer[dataloc+i] = high+5;
 			}
+		} //test for single sample outlier (high between two lows) in the case of very strong waves
+		if (buffer[dataloc] >= high && buffer[dataloc+2] <= low) {
+			buffer[dataloc] = buffer[dataloc+2];
+			buffer[dataloc+1] = buffer[dataloc+2];
 		}
 		for (i=0; i<datalen; ++i) {
 			if (i+newloc < bufsize) {