fix: 'lf visa' - use defines instead

This commit is contained in:
iceman1001 2019-03-09 08:14:42 +01:00
parent ae719c3b05
commit 1cf3e1b581

View file

@ -96,8 +96,7 @@ int detectVisa2k(uint8_t *dest, size_t *size) {
//see ASKDemod for what args are accepted
int CmdVisa2kDemod(const char *Cmd) {
// save GraphBuffer - to restore it later
save_restoreGB(1);
save_restoreGB(GRAPH_SAVE);
//sCmdAskEdgeDetect("");
@ -105,7 +104,7 @@ int CmdVisa2kDemod(const char *Cmd) {
bool st = true;
if (!ASKDemod_ext("64 0 0", false, false, 1, &st)) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: ASK/Manchester Demod failed");
save_restoreGB(0);
save_restoreGB(GRAPH_RESTORE);
return 0;
}
size_t size = DemodBufferLen;
@ -120,7 +119,7 @@ int CmdVisa2kDemod(const char *Cmd) {
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: ans: %d", ans);
save_restoreGB(0);
save_restoreGB(GRAPH_RESTORE);
return 0;
}
setDemodBuf(DemodBuffer, 96, ans);
@ -138,7 +137,7 @@ int CmdVisa2kDemod(const char *Cmd) {
// test checksums
if ( chk != calc ) {
PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 checksum failed %x - %x\n", chk, calc);
save_restoreGB(0);
save_restoreGB(GRAPH_RESTORE);
return 0;
}
// parity
@ -146,17 +145,16 @@ int CmdVisa2kDemod(const char *Cmd) {
uint8_t chk_par = (raw3 & 0xFF0) >> 4;
if ( calc_par != chk_par) {
PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 parity failed %x - %x\n", chk_par, calc_par);
save_restoreGB(0);
save_restoreGB(GRAPH_RESTORE);
return 0;
}
PrintAndLogEx(SUCCESS, "Visa2000 Tag Found: Card ID %u, Raw: %08X%08X%08X", raw2, raw1 ,raw2, raw3);
save_restoreGB(0);
return 1;
}
// 64*96*2=12288 samples just in case we just missed the first preamble we can still catch 2 of them
int CmdVisa2kRead(const char *Cmd) {
lf_read(true, 12500);
lf_read(true, 14000);
return CmdVisa2kDemod(Cmd);
}