From 2df8c07907a07068d717d9b4ddcc2848f4efd608 Mon Sep 17 00:00:00 2001 From: marshmellow42 Date: Mon, 29 Dec 2014 15:58:59 -0500 Subject: [PATCH] minor setting adjustments/cleanup clean up code --- client/cmddata.c | 8 ++++++-- common/lfdemod.c | 6 +++--- common/lfdemod.h | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/client/cmddata.c b/client/cmddata.c index 32668d98..6416ebbc 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -132,7 +132,7 @@ void printBitStream(uint8_t BitStream[], uint32_t bitLen){ 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], @@ -272,6 +272,10 @@ int Cmdmandecoderaw(const char *Cmd) } 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){ @@ -515,7 +519,7 @@ int CmdFSKrawdemod(const char *Cmd) 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; } diff --git a/common/lfdemod.c b/common/lfdemod.c index c77a449a..1c3aad6f 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -259,7 +259,7 @@ int manrawdemod(uint8_t * BitStream, int *bitLen) bitnum=0; } errCnt=bestErr; - if (errCnt<10){ + if (errCnt<20){ for (i=0; i250) break; + if (bitnum>500) break; } //we got more than 64 good bits and not all errors if ((bitnum > (64+errCnt)) && (errCnt<(*bitLen/1000))) { diff --git a/common/lfdemod.h b/common/lfdemod.h index 38001dd0..e66ed6f9 100644 --- a/common/lfdemod.h +++ b/common/lfdemod.h @@ -22,7 +22,7 @@ int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert); uint32_t bytebits_to_byte(uint8_t* src, int numbits); // -#define MAX_BitStream_LEN (1024*128) +//#define MAX_BitStream_LEN (1024*128) //extern int BitStreamLen; #endif -- 2.39.2