X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/34ff898553f3392c66c50d1a524070882d237fb5..43534cbad22da2db2e1b59f9e08f0cadfe0d8d54:/common/lfdemod.c diff --git a/common/lfdemod.c b/common/lfdemod.c index 406b0445..e9f19311 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -1343,7 +1343,10 @@ uint8_t detectFSKClk(uint8_t *BitStream, size_t size, uint8_t fcHigh, uint8_t fc continue; // else new peak // if we got less than the small fc + tolerance then set it to the small fc - if (fcCounter < fcLow+fcTol) + // if it is inbetween set it to the last counter + if (fcCounter < fcHigh && fcCounter > fcLow) + fcCounter = lastFCcnt; + else if (fcCounter < fcLow+fcTol) fcCounter = fcLow; else //set it to the large fc fcCounter = fcHigh; @@ -1409,7 +1412,7 @@ uint8_t detectFSKClk(uint8_t *BitStream, size_t size, uint8_t fcHigh, uint8_t fc } } - if (ii<0) return 0; // oops we went too far + if (ii<2) return 0; // oops we went too far return clk[ii]; }