]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/lfsampling.c
lf demod cleanup nrz clock detect fixes
[proxmark3-svn] / armsrc / lfsampling.c
index 7c5412820b20ce065637c6af6d253345dba4ba5c..b6ca920907e220d5ad9a69898f2530fe2970da7c 100644 (file)
@@ -255,7 +255,8 @@ uint32_t SnoopLF()
 **/
 void doT55x7Acquisition(size_t sample_size) {
 
-       #define T55xx_READ_UPPER_THRESHOLD 128+40  // 40 grph
+       #define T55xx_READ_UPPER_THRESHOLD 128+60  // 60 grph
+       #define T55xx_READ_LOWER_THRESHOLD 128-60  // -60 grph
        #define T55xx_READ_TOL   5
 
        uint8_t *dest = BigBuf_get_addr();
@@ -267,6 +268,7 @@ void doT55x7Acquisition(size_t sample_size) {
        uint16_t i = 0;
        bool startFound = false;
        bool highFound = false;
+       bool lowFound = false;
        uint8_t curSample = 0;
        uint8_t lastSample = 0;
        uint16_t skipCnt = 0;
@@ -282,15 +284,26 @@ void doT55x7Acquisition(size_t sample_size) {
 
                        // skip until the first high sample above threshold
                        if (!startFound && curSample > T55xx_READ_UPPER_THRESHOLD) {
-                               if (curSample > lastSample) 
-                                       lastSample = curSample;
+                               //if (curSample > lastSample) 
+                               //      lastSample = curSample;
                                highFound = true;
                        } else if (!highFound) {
                                skipCnt++;
                                continue;
                        }
+                       // skip until the first Low sample below threshold
+                       if (!startFound && curSample < T55xx_READ_LOWER_THRESHOLD) {
+                               //if (curSample > lastSample) 
+                               lastSample = curSample;
+                               lowFound = true;
+                       } else if (!lowFound) {
+                               skipCnt++;
+                               continue;
+                       }
+
+
                        // skip until first high samples begin to change
-                       if (startFound || curSample < T55xx_READ_UPPER_THRESHOLD-T55xx_READ_TOL){
+                       if (startFound || curSample > T55xx_READ_LOWER_THRESHOLD+T55xx_READ_TOL){
                                // if just found start - recover last sample
                                if (!startFound) {
                                        dest[i++] = lastSample;
Impressum, Datenschutz