simple debug..

This commit is contained in:
iceman1001 2018-02-21 16:48:52 +01:00
commit b5500c3e54
3 changed files with 38 additions and 41 deletions

View file

@ -29,13 +29,12 @@ int CmdPacDemod(const char *Cmd) {
//NRZ //NRZ
if (!NRZrawDemod(Cmd, false)) { 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; return 0;
} }
size_t size = DemodBufferLen; size_t size = DemodBufferLen;
int ans = detectPac(DemodBuffer, &size); int ans = detectPac(DemodBuffer, &size);
if (ans < 0) { if (ans < 0) {
if (g_debugMode) {
if (ans == -1) if (ans == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: too few bits found"); PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: too few bits found");
else if (ans == -2) else if (ans == -2)
@ -44,7 +43,7 @@ int CmdPacDemod(const char *Cmd) {
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Size not correct: %d", size); PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: Size not correct: %d", size);
else else
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: ans: %d", ans); PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: ans: %d", ans);
}
return 0; return 0;
} }
setDemodBuf(DemodBuffer, 128, ans); setDemodBuf(DemodBuffer, 128, ans);

View file

@ -82,7 +82,7 @@ int CmdParadoxDemod(const char *Cmd) {
//raw fsk demod no manchester decoding no start bit finding just get binary from wave //raw fsk demod no manchester decoding no start bit finding just get binary from wave
uint8_t bits[MAX_GRAPH_TRACE_LEN]={0}; uint8_t bits[MAX_GRAPH_TRACE_LEN]={0};
size_t size = getFromGraphBuf(bits); size_t size = getFromGraphBuf(bits);
if (size==0) { if (size == 0) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples");
return 0; return 0;
} }
@ -92,21 +92,20 @@ int CmdParadoxDemod(const char *Cmd) {
//get binary from fsk wave //get binary from fsk wave
int idx = detectParadox(bits, &size, &hi2, &hi, &lo, &waveIdx); int idx = detectParadox(bits, &size, &hi2, &hi, &lo, &waveIdx);
if (idx < 0){ if (idx < 0){
if (g_debugMode){
if (idx == -1){ if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples");
} else if (idx == -2) { else if (idx == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox just noise detected"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox just noise detected");
} else if (idx == -3) { else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod");
} else if (idx == -4) { else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found");
} else if (idx == -5) { else if (idx == -5)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %d", size); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %d", size);
} else { else
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx);
}
}
return 0; return 0;
} }
@ -134,10 +133,10 @@ int CmdParadoxDemod(const char *Cmd) {
rawLo 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(); printDemodBuff();
}
return 1; return 1;
} }
//by marshmellow //by marshmellow

View file

@ -130,13 +130,13 @@ int GetPrescoBits(uint32_t fullcode, uint8_t *prescoBits) {
int CmdPrescoDemod(const char *Cmd) { int CmdPrescoDemod(const char *Cmd) {
bool st = true; bool st = true;
if (!ASKDemod_ext("32 0 0 0 0 a", false, false, 1, &st)) { 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; return 0;
} }
size_t size = DemodBufferLen; size_t size = DemodBufferLen;
int ans = detectPresco(DemodBuffer, &size); int ans = detectPresco(DemodBuffer, &size);
if (ans < 0) { if (ans < 0) {
if (g_debugMode){
if (ans == -1) if (ans == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: too few bits found"); PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: too few bits found");
else if (ans == -2) else if (ans == -2)
@ -145,7 +145,6 @@ int CmdPrescoDemod(const char *Cmd) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: Size not correct: %d", size); PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: Size not correct: %d", size);
else else
PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans); PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans);
}
return 0; return 0;
} }
setDemodBuf(DemodBuffer, 128, ans); setDemodBuf(DemodBuffer, 128, ans);