]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - common/lfdemod.c
Update README.md
[proxmark3-svn] / common / lfdemod.c
index 047c9e2893edbbdccb770f32f53a7a16965cecd5..8b31f1a4c10a751cd447d2667aa89f7a57a7e22e 100644 (file)
@@ -259,13 +259,15 @@ int cleanAskRawDemod(uint8_t *BinStream, size_t *size, int clk, int invert, int
 //by marshmellow
 void askAmp(uint8_t *BitStream, size_t size)
 {
-       for(size_t i = 1; i<size; i++){
-               if (BitStream[i]-BitStream[i-1]>=30) //large jump up
-                       BitStream[i]=255;
-               else if(BitStream[i]-BitStream[i-1]<=-20) //large jump down
-                       BitStream[i]=0;
+       uint8_t last = 128;
+       for(size_t i = 1; i < size; ++i){
+               if (BitStream[i]-BitStream[i-1] >= 30) //large jump up
+                       last = 255;
+               else if(BitStream[i-1] - BitStream[i] >= 20) //large jump down
+                       last = 0;
+               
+               BitStream[i] = last;
        }
-       return;
 }
 
 //by marshmellow
@@ -764,16 +766,16 @@ int PyramiddemodFSK(uint8_t *dest, size_t *size)
        return (int)startIdx;
 }
 
-// find presco preamble 0x10D in already demoded data
+// find nedap preamble in already demoded data
 int NedapDemod(uint8_t *dest, size_t *size) {
        //make sure buffer has data
        if (*size < 128) return -3;
 
        size_t startIdx = 0;
+       //uint8_t preamble[] = {1,1,1,1,1,1,1,1,1,0,0,0,1};
        uint8_t preamble[] = {1,1,1,1,1,1,1,1,1,0};
        uint8_t errChk = preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx);
        if (errChk == 0) return -4; //preamble not found
-       //return start position
        return (int) startIdx;
 }
 
Impressum, Datenschutz