#include "util.h"
#include "cmdmain.h"
#include "cmddata.h"
-#include "../common/lfdemod.h"
+#include "lfdemod.h"
static int CmdHelp(const char *Cmd);
return;
}
if (bitLen>512) bitLen=512;
- for (i = 0; i < (bitLen-16); i+=16) {
+ for (i = 0; i <= (bitLen-16); i+=16) {
PrintAndLog("%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i",
BitStream[i],
BitStream[i+1],
}
bitnum=i;
errCnt=manrawdemod(BitStream,&bitnum);
+ if (errCnt>=20){
+ PrintAndLog("Too many errors: %d",errCnt);
+ return 0;
+ }
PrintAndLog("Manchester Decoded - # errors:%d - data:",errCnt);
printBitStream(BitStream,bitnum);
if (errCnt==0){
bit ^= 1;
AppendGraph(0, clock, bit);
-// for (j = 0; j < (int)(clock/2); j++)
-// GraphBuffer[(i * clock) + j] = bit ^ 1;
-// for (j = (int)(clock/2); j < clock; j++)
-// GraphBuffer[(i * clock) + j] = bit;
+ // for (j = 0; j < (int)(clock/2); j++)
+ // GraphBuffer[(i * clock) + j] = bit ^ 1;
+ // for (j = (int)(clock/2); j < clock; j++)
+ // GraphBuffer[(i * clock) + j] = bit;
}
RepaintGraphWindow();
PrintAndLog("Auto-detected clock rate: %d", clock);
return 0;
}
-/*
-uint32_t bytebits_to_byte(uint8_t *src, int numbits)
-{
- uint32_t num = 0;
- for(int i = 0 ; i < numbits ; i++)
- {
- num = (num << 1) | (*src);
- src++;
- }
- return num;
-}
-*/
+
//by marshmellow
//fsk raw demod and print binary
//takes 2 arguments - Clock and invert
RepaintGraphWindow();
// Now output the bitstream to the scrollback by line of 16 bits
- if(size > (7*32)+2) size = (7*32)+2; //only output a max of 7 blocks of 32 bits most tags will have full bit stream inside that sample size
+ if(size > (8*32)+2) size = (8*32)+2; //only output a max of 8 blocks of 32 bits most tags will have full bit stream inside that sample size
printBitStream(BitStream,size);
return 0;
}