]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmddata.c
ADD: LF JABLOTRON functionality. with clone/sim and detection in LF SEARCH.
[proxmark3-svn] / client / cmddata.c
index d0c2dfb34bfde114f80c0a6ca12a3fc47f7a0f7b..18edd33e88ba8a43be3482db3b8c39ee120f0a7a 100644 (file)
@@ -76,7 +76,7 @@ void printDemodBuff(void)
        }
        if (bitLen>512) bitLen=512; //max output to 512 bits if we have more - should be plenty
 
-       char *bin = sprint_bin_break(DemodBuffer,bitLen,16);
+       char *bin = sprint_bin_break(DemodBuffer, bitLen,16);
        PrintAndLog("%s",bin);
 
        return;
@@ -527,7 +527,11 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose)
        sscanf(Cmd, "%i %i %i %i", &offset, &clk, &invert, &maxErr);
        
        uint8_t BitStream[MAX_DEMOD_BUF_LEN];
-       size_t size = getFromGraphBuf(BitStream);         
+       size_t size = getFromGraphBuf(BitStream);       
+       if (size == 0 ) {
+               if (g_debugMode) PrintAndLog("DEBUG: no data in graphbuf");  
+                       return 0;  
+       }
        //invert here inverts the ask raw demoded bits which has no effect on the demod, but we need the pointer
        int errCnt = askdemod(BitStream, &size, &clk, &invert, maxErr, 0, 0);  
        if ( errCnt < 0 || errCnt > maxErr ) {   
@@ -877,13 +881,16 @@ int CmdGraphShiftZero(const char *Cmd)
 int CmdAskEdgeDetect(const char *Cmd)
 {
        int thresLen = 25;
+       int last = 0;
        sscanf(Cmd, "%i", &thresLen); 
 
-       for(int i = 1; i<GraphTraceLen; i++){
-               if (GraphBuffer[i]-GraphBuffer[i-1]>=thresLen) //large jump up
-                       GraphBuffer[i-1] = 127;
-               else if(GraphBuffer[i]-GraphBuffer[i-1]<=-1*thresLen) //large jump down
-                       GraphBuffer[i-1] = -127;
+       for(int i = 1; i < GraphTraceLen; ++i){
+               if (GraphBuffer[i] - GraphBuffer[i-1] >= thresLen) //large jump up
+                       last = 127;
+               else if(GraphBuffer[i] - GraphBuffer[i-1] <= -1 * thresLen) //large jump down
+                       last = -127;
+                       
+               GraphBuffer[i-1] = last;
        }
        RepaintGraphWindow();
        return 0;
Impressum, Datenschutz