Merge remote-tracking branch 'upstream/master' into hf_mf_sim

This commit is contained in:
vratiskol 2019-03-25 15:51:21 +01:00
commit 04c14d1931
10 changed files with 41 additions and 41 deletions

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;
}

View file

@ -18,6 +18,8 @@ A5B4C3D2,
1C0B5848,
# paxton bullit?
575F4F4B,
#
50520901,
# Default pwd, simple:
00000000,
11111111,

View file

@ -256,12 +256,12 @@ char *sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t brea
sprintf(tmp++, ".");
else
sprintf(tmp++, "%u", data[in_index]);
// check if a line break is needed and we have room to print it in our array
if ((breaks > 0) && !((in_index + 1) % breaks) && (out_index + 1 != rowlen)) {
// increment and print line break
out_index++;
sprintf(tmp++, "%s", "\n");
}
in_index++;
}