]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmddata.c
CHG: added some comments when changing the HAS_512_FLASH macro directive.
[proxmark3-svn] / client / cmddata.c
index ece0810d3b2c5bcf4f6bc2d8bbfcbf226e6ce191..fe22aa4bf1d498ec4ff4b434de84703ba309ed3a 100644 (file)
@@ -542,9 +542,9 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
        if (maxLen<BitLen && maxLen != 0) BitLen = maxLen;
        int foundclk = 0;
        //amp before ST check
-       if (amp == 'a' || amp == 'A') {
+       if (amp == 'a' || amp == 'A')
                askAmp(BitStream, BitLen); 
-       }
+
        bool st = false;
        if (*stCheck) st = DetectST(BitStream, &BitLen, &foundclk);
        if (st) {
@@ -552,6 +552,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
                clk = (clk == 0) ? foundclk : clk;
                if (verbose || g_debugMode) PrintAndLog("\nFound Sequence Terminator");
        }
+               
        int errCnt = askdemod(BitStream, &BitLen, &clk, &invert, maxErr, 0, askType);
        if (errCnt<0 || BitLen<16){  //if fatal error (or -1)
                if (g_debugMode) PrintAndLog("DEBUG: no data found %d, errors:%d, bitlen:%d, clock:%d",errCnt,invert,BitLen,clk);
@@ -1756,9 +1757,7 @@ int CmdFDXBdemodBI(const char *Cmd){
 //attempt to psk1 demod graph buffer
 int PSKDemod(const char *Cmd, bool verbose)
 {
-       int invert=0;
-       int clk=0;
-       int maxErr=100;
+       int invert = 0, clk = 0, maxErr = 100;
        sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
        if (clk==1){
                invert=1;
@@ -1768,25 +1767,26 @@ int PSKDemod(const char *Cmd, bool verbose)
                if (g_debugMode || verbose) PrintAndLog("Invalid argument: %s", Cmd);
                return 0;
        }
-       uint8_t BitStream[MAX_GRAPH_TRACE_LEN]={0};
+       uint8_t BitStream[MAX_GRAPH_TRACE_LEN] = {0};
        size_t BitLen = getFromGraphBuf(BitStream);
        if (BitLen==0) return 0;
-       uint8_t carrier=countFC(BitStream, BitLen, 0);
+       
+       uint8_t carrier = countFC(BitStream, BitLen, 0);
        if (carrier!=2 && carrier!=4 && carrier!=8){
                //invalid carrier
                return 0;
        }
-       if (g_debugMode){
-               PrintAndLog("Carrier: rf/%d",carrier);
-       }
+       
+       if (g_debugMode) PrintAndLog("Carrier: rf/%d",carrier);
+
        int errCnt=0;
        errCnt = pskRawDemod(BitStream, &BitLen, &clk, &invert);
        if (errCnt > maxErr){
-               if (g_debugMode || verbose) PrintAndLog("Too many errors found, clk: %d, invert: %d, numbits: %d, errCnt: %d",clk,invert,BitLen,errCnt);
+               if (g_debugMode || verbose) PrintAndLog("Too many errors found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, BitLen, errCnt);
                return 0;
        } 
        if (errCnt<0|| BitLen<16){  //throw away static - allow 1 and -1 (in case of threshold command first)
-               if (g_debugMode || verbose) PrintAndLog("no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d",clk,invert,BitLen,errCnt);
+               if (g_debugMode || verbose) PrintAndLog("no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, BitLen, errCnt);
                return 0;
        }
        if (verbose || g_debugMode){
@@ -1796,7 +1796,7 @@ int PSKDemod(const char *Cmd, bool verbose)
                }
        }
        //prime demod buffer for output
-       setDemodBuf(BitStream,BitLen,0);
+       setDemodBuf(BitStream, BitLen, 0);
        return 1;
 }
 
Impressum, Datenschutz