chg: 32bits binary strings used as default

This commit is contained in:
iceman1001 2019-03-25 14:41:28 +01:00
parent a820d59368
commit 68fc65a8c5

View file

@ -375,7 +375,7 @@ void printDemodBuff(void) {
}
if (len > 512) len = 512;
PrintAndLogEx(NORMAL, "%s", sprint_bin_break(DemodBuffer, len, 16));
PrintAndLogEx(NORMAL, "%s", sprint_bin_break(DemodBuffer, len, 32));
}
int CmdPrintDemodBuff(const char *Cmd) {
@ -426,7 +426,7 @@ int CmdPrintDemodBuff(const char *Cmd) {
}
PrintAndLogEx(NORMAL, "DemodBuffer: %s", hex);
} else {
PrintAndLogEx(NORMAL, "DemodBuffer:\n%s", sprint_bin_break(DemodBuffer + offset, length, 16));
PrintAndLogEx(NORMAL, "DemodBuffer:\n%s", sprint_bin_break(DemodBuffer + offset, length, 32));
}
return 1;
}
@ -599,7 +599,7 @@ int Cmdmandecoderaw(const char *Cmd) {
}
PrintAndLogEx(NORMAL, "Manchester Decoded - # errors:%d - data:", errCnt);
PrintAndLogEx(NORMAL, "%s", sprint_bin_break(bits, size, 16));
PrintAndLogEx(NORMAL, "%s", sprint_bin_break(bits, size, 32));
if (errCnt == 0) {
uint64_t id = 0;
@ -650,7 +650,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) {
PrintAndLogEx(WARNING, "# Errors found during Demod (shown as " _YELLOW_("7")" in bit stream): %d", errCnt);
PrintAndLogEx(NORMAL, "Biphase Decoded using offset: %d - # invert:%d - data:", offset, invert);
PrintAndLogEx(NORMAL, "%s", sprint_bin_break(bits, size, 16));
PrintAndLogEx(NORMAL, "%s", sprint_bin_break(bits, size, 32));
//remove first bit from raw demod
if (offset)
@ -1094,7 +1094,9 @@ int CmdFSKrawdemod(const char *Cmd) {
//attempt to psk1 demod graph buffer
int PSKDemod(const char *Cmd, bool verbose) {
int invert = 0, clk = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
@ -1107,28 +1109,29 @@ int PSKDemod(const char *Cmd, bool verbose) {
if (getSignalProperties()->isnoise)
return 0;
uint8_t BitStream[MAX_GRAPH_TRACE_LEN] = {0};
size_t BitLen = getFromGraphBuf(BitStream);
if (BitLen == 0) return 0;
int errCnt = 0;
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t bitlen = getFromGraphBuf(bits);
if (bitlen == 0)
return 0;
int startIdx = 0;
errCnt = pskRawDemod_ext(BitStream, &BitLen, &clk, &invert, &startIdx);
int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx);
if (errCnt > maxErr) {
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Too many errors found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, BitLen, errCnt);
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Too many errors found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, bitlen, errCnt);
return 0;
}
if (errCnt < 0 || BitLen < 16) { //throw away static - allow 1 and -1 (in case of threshold command first)
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, BitLen, errCnt);
if (errCnt < 0 || bitlen < 16) { //throw away static - allow 1 and -1 (in case of threshold command first)
if (g_debugMode || verbose) PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) no data found, clk: %d, invert: %d, numbits: %d, errCnt: %d", clk, invert, bitlen, errCnt);
return 0;
}
if (verbose || g_debugMode) {
PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Using Clock:%d, invert:%d, Bits Found:%d", clk, invert, BitLen);
PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) Using Clock:%d, invert:%d, Bits Found:%d", clk, invert, bitlen);
if (errCnt > 0) {
PrintAndLogEx(DEBUG, "DEBUG: (PSKdemod) errors during Demoding (shown as 7 in bit stream): %d", errCnt);
}
}
//prime demod buffer for output
setDemodBuf(BitStream, BitLen, 0);
setDemodBuf(bits, bitlen, 0);
setClockGrid(clk, startIdx);
return 1;
}