mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
CHG: minor LF adjustments.
CHG: `lf visa2000` - removed askedgedetect, it seemed it destroyed more than enhanced.
This commit is contained in:
parent
a8fd088d8b
commit
4eabb8ad38
6 changed files with 30 additions and 15 deletions
|
@ -834,7 +834,7 @@ int CmdVikingDemod(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
size_t size = DemodBufferLen;
|
size_t size = DemodBufferLen;
|
||||||
//call lfdemod.c demod for Viking
|
|
||||||
int ans = VikingDemod_AM(DemodBuffer, &size);
|
int ans = VikingDemod_AM(DemodBuffer, &size);
|
||||||
if (ans < 0) {
|
if (ans < 0) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - Viking Demod %d %s", ans, (ans == -5)?"[chksum error]":"");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - Viking Demod %d %s", ans, (ans == -5)?"[chksum error]":"");
|
||||||
|
@ -2095,6 +2095,11 @@ int CmdGrid(const char *Cmd)
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
void setGrid_Clock(uint8_t clock){
|
||||||
|
PlotGridXdefault = clock;
|
||||||
|
RepaintGraphWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int CmdHexsamples(const char *Cmd)
|
int CmdHexsamples(const char *Cmd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,6 +80,8 @@ int NRZrawDemod(const char *Cmd, bool verbose);
|
||||||
void printEM410x(uint32_t hi, uint64_t id);
|
void printEM410x(uint32_t hi, uint64_t id);
|
||||||
int getSamples(const char *Cmd, bool silent);
|
int getSamples(const char *Cmd, bool silent);
|
||||||
|
|
||||||
|
void setGrid_Clock(uint8_t clock);
|
||||||
|
|
||||||
int CmdDataIIR(const char *Cmd);
|
int CmdDataIIR(const char *Cmd);
|
||||||
|
|
||||||
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||||
|
|
|
@ -443,7 +443,7 @@ int EM4x50Read(const char *Cmd, bool verbose) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!clk) {
|
if (!clk) {
|
||||||
PrintAndLog("ERROR: EM4x50 - didn't find a clock");
|
if (verbose || g_debugMode) PrintAndLog("ERROR: EM4x50 - didn't find a clock");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else tol = clk/8;
|
} else tol = clk/8;
|
||||||
|
|
|
@ -97,6 +97,7 @@ int CmdJablotronDemod(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setDemodBuf(DemodBuffer+ans, 64, 0);
|
setDemodBuf(DemodBuffer+ans, 64, 0);
|
||||||
|
setGrid_Clock(64);
|
||||||
|
|
||||||
//got a good demod
|
//got a good demod
|
||||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||||
|
@ -125,7 +126,7 @@ int CmdJablotronDemod(const char *Cmd) {
|
||||||
|
|
||||||
int CmdJablotronRead(const char *Cmd) {
|
int CmdJablotronRead(const char *Cmd) {
|
||||||
CmdLFRead("s");
|
CmdLFRead("s");
|
||||||
getSamples("12000", TRUE);
|
getSamples("10000", TRUE);
|
||||||
return CmdJablotronDemod(Cmd);
|
return CmdJablotronDemod(Cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ int CmdVisa2kDemod(const char *Cmd) {
|
||||||
// save GraphBuffer - to restore it later
|
// save GraphBuffer - to restore it later
|
||||||
save_restoreGB(1);
|
save_restoreGB(1);
|
||||||
|
|
||||||
CmdAskEdgeDetect("");
|
//sCmdAskEdgeDetect("");
|
||||||
|
|
||||||
//ASK / Manchester
|
//ASK / Manchester
|
||||||
bool st = TRUE;
|
bool st = TRUE;
|
||||||
|
@ -88,6 +88,7 @@ int CmdVisa2kDemod(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
setDemodBuf(DemodBuffer, 96, ans);
|
setDemodBuf(DemodBuffer, 96, ans);
|
||||||
|
setGrid_Clock(64);
|
||||||
|
|
||||||
//got a good demod
|
//got a good demod
|
||||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||||
|
@ -110,7 +111,7 @@ int CmdVisa2kDemod(const char *Cmd) {
|
||||||
|
|
||||||
int CmdVisa2kRead(const char *Cmd) {
|
int CmdVisa2kRead(const char *Cmd) {
|
||||||
CmdLFRead("s");
|
CmdLFRead("s");
|
||||||
getSamples("16000",TRUE);
|
getSamples("12000",TRUE);
|
||||||
return CmdVisa2kDemod(Cmd);
|
return CmdVisa2kDemod(Cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,6 +243,7 @@ int Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_t *h
|
||||||
|
|
||||||
//by marshmellow
|
//by marshmellow
|
||||||
//demodulates strong heavily clipped samples
|
//demodulates strong heavily clipped samples
|
||||||
|
//RETURN: num of errors. if 0, is ok.
|
||||||
int cleanAskRawDemod(uint8_t *BinStream, size_t *size, int clk, int invert, int high, int low)
|
int cleanAskRawDemod(uint8_t *BinStream, size_t *size, int clk, int invert, int high, int low)
|
||||||
{
|
{
|
||||||
size_t bitCnt=0, smplCnt=0, errCnt=0;
|
size_t bitCnt=0, smplCnt=0, errCnt=0;
|
||||||
|
@ -386,25 +387,30 @@ int askdemod(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr
|
||||||
//by marshmellow
|
//by marshmellow
|
||||||
//take 10 and 01 and manchester decode
|
//take 10 and 01 and manchester decode
|
||||||
//run through 2 times and take least errCnt
|
//run through 2 times and take least errCnt
|
||||||
int manrawdecode(uint8_t * BitStream, size_t *size, uint8_t invert){
|
int manrawdecode(uint8_t *BitStream, size_t *size, uint8_t invert){
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if (*size < 16) return -1;
|
||||||
|
|
||||||
int errCnt = 0, bestErr = 1000;
|
int errCnt = 0, bestErr = 1000;
|
||||||
uint16_t bitnum = 0, MaxBits = 512, bestRun = 0;
|
uint16_t bitnum = 0, MaxBits = 512, bestRun = 0;
|
||||||
size_t i, k;
|
size_t i, k;
|
||||||
if (*size < 16) return -1;
|
|
||||||
//find correct start position [alignment]
|
//find correct start position [alignment]
|
||||||
for (k=0; k < 2; ++k){
|
for (k = 0; k < 2; ++k){
|
||||||
for (i=k; i<*size-3; i += 2)
|
for (i = k; i < *size-3; i += 2) {
|
||||||
if (BitStream[i] == BitStream[i+1])
|
if (BitStream[i] == BitStream[i+1])
|
||||||
errCnt++;
|
errCnt++;
|
||||||
|
}
|
||||||
if (bestErr > errCnt){
|
if (bestErr > errCnt){
|
||||||
bestErr = errCnt;
|
bestErr = errCnt;
|
||||||
bestRun = k;
|
bestRun = k;
|
||||||
}
|
}
|
||||||
errCnt=0;
|
errCnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//decode
|
//decode
|
||||||
for (i=bestRun; i < *size-3; i += 2){
|
for (i = bestRun; i < *size-3; i += 2){
|
||||||
if (BitStream[i] == 1 && (BitStream[i+1] == 0)){
|
if (BitStream[i] == 1 && (BitStream[i+1] == 0)){
|
||||||
BitStream[bitnum++] = invert;
|
BitStream[bitnum++] = invert;
|
||||||
} else if ((BitStream[i] == 0) && BitStream[i+1] == 1){
|
} else if ((BitStream[i] == 0) && BitStream[i+1] == 1){
|
||||||
|
@ -412,9 +418,9 @@ int manrawdecode(uint8_t * BitStream, size_t *size, uint8_t invert){
|
||||||
} else {
|
} else {
|
||||||
BitStream[bitnum++] = 7;
|
BitStream[bitnum++] = 7;
|
||||||
}
|
}
|
||||||
if (bitnum>MaxBits) break;
|
if (bitnum > MaxBits) break;
|
||||||
}
|
}
|
||||||
*size=bitnum;
|
*size = bitnum;
|
||||||
return bestErr;
|
return bestErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue