From b5500c3e543947aa406e29c46c2579b88356dc80 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 21 Feb 2018 16:48:52 +0100 Subject: [PATCH] simple debug.. --- client/cmdlfpac.c | 21 ++++++++++----------- client/cmdlfparadox.c | 37 ++++++++++++++++++------------------- client/cmdlfpresco.c | 21 ++++++++++----------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/client/cmdlfpac.c b/client/cmdlfpac.c index 7b6962056..73086ce59 100644 --- a/client/cmdlfpac.c +++ b/client/cmdlfpac.c @@ -29,22 +29,21 @@ int CmdPacDemod(const char *Cmd) { //NRZ if (!NRZrawDemod(Cmd, false)) { - if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: NRZ Demod failed"); + PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: NRZ Demod failed"); return 0; } size_t size = DemodBufferLen; int ans = detectPac(DemodBuffer, &size); if (ans < 0) { - if (g_debugMode) { - if (ans == -1) - PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: too few bits found"); - else if (ans == -2) - PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: preamble not found"); - else if (ans == -3) - PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Size not correct: %d", size); - else - PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: ans: %d", ans); - } + if (ans == -1) + PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: too few bits found"); + else if (ans == -2) + PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: preamble not found"); + else if (ans == -3) + PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Size not correct: %d", size); + else + PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: ans: %d", ans); + return 0; } setDemodBuf(DemodBuffer, 128, ans); diff --git a/client/cmdlfparadox.c b/client/cmdlfparadox.c index 35c888497..109fe1d4d 100644 --- a/client/cmdlfparadox.c +++ b/client/cmdlfparadox.c @@ -82,7 +82,7 @@ int CmdParadoxDemod(const char *Cmd) { //raw fsk demod no manchester decoding no start bit finding just get binary from wave uint8_t bits[MAX_GRAPH_TRACE_LEN]={0}; size_t size = getFromGraphBuf(bits); - if (size==0) { + if (size == 0) { PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); return 0; } @@ -92,21 +92,20 @@ int CmdParadoxDemod(const char *Cmd) { //get binary from fsk wave int idx = detectParadox(bits, &size, &hi2, &hi, &lo, &waveIdx); if (idx < 0){ - if (g_debugMode){ - if (idx == -1){ - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); - } else if (idx == -2) { - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox just noise detected"); - } else if (idx == -3) { - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod"); - } else if (idx == -4) { - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found"); - } else if (idx == -5) { - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %d", size); - } else { - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx); - } - } + + if (idx == -1) + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); + else if (idx == -2) + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox just noise detected"); + else if (idx == -3) + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod"); + else if (idx == -4) + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found"); + else if (idx == -5) + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %d", size); + else + PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx); + return 0; } @@ -134,10 +133,10 @@ int CmdParadoxDemod(const char *Cmd) { rawLo ); - if (g_debugMode){ - PrintAndLogEx(DEBUG, "DEBUG: Paradox idx: %d, len: %d, Printing Demod Buffer:", idx, size); + PrintAndLogEx(DEBUG, "DEBUG: Paradox idx: %d, len: %d, Printing Demod Buffer:", idx, size); + if (g_debugMode) printDemodBuff(); - } + return 1; } //by marshmellow diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index e4b0c9859..9c8037457 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -130,22 +130,21 @@ int GetPrescoBits(uint32_t fullcode, uint8_t *prescoBits) { int CmdPrescoDemod(const char *Cmd) { bool st = true; if (!ASKDemod_ext("32 0 0 0 0 a", false, false, 1, &st)) { - if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error Presco ASKDemod failed"); + PrintAndLogEx(DEBUG, "DEBUG: Error Presco ASKDemod failed"); return 0; } size_t size = DemodBufferLen; int ans = detectPresco(DemodBuffer, &size); if (ans < 0) { - if (g_debugMode){ - if (ans == -1) - PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: too few bits found"); - else if (ans == -2) - PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: preamble not found"); - else if (ans == -3) - PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: Size not correct: %d", size); - else - PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans); - } + + if (ans == -1) + PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: too few bits found"); + else if (ans == -2) + PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: preamble not found"); + else if (ans == -3) + PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: Size not correct: %d", size); + else + PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans); return 0; } setDemodBuf(DemodBuffer, 128, ans);