Changed modulation max bit length from 512 to 4096, since we now can get much longer traces

This commit is contained in:
iceman1001 2023-12-01 10:58:33 +01:00
parent 17a93a3b1b
commit bcbe76064d
3 changed files with 12 additions and 9 deletions

View file

@ -222,7 +222,7 @@ static int CmdSetDebugMode(const char *Cmd) {
return PM3_SUCCESS;
}
// max output to 512 bits if we have more
// max output to MAX_DEMODULATION_BITS bits if we have more
// doesn't take inconsideration where the demod offset or bitlen found.
int printDemodBuff(uint8_t offset, bool strip_leading, bool invert, bool print_hex) {
size_t len = g_DemodBufferLen;
@ -257,8 +257,8 @@ int printDemodBuff(uint8_t offset, bool strip_leading, bool invert, bool print_h
len = (g_DemodBufferLen - offset);
}
if (len > 512) {
len = 512;
if (len > MAX_DEMODULATION_BITS) {
len = MAX_DEMODULATION_BITS;
}
if (invert) {
@ -275,7 +275,7 @@ int printDemodBuff(uint8_t offset, bool strip_leading, bool invert, bool print_h
if (print_hex) {
p = (buf + offset);
char hex[512] = {0x00};
char hex[MAX_DEMODULATION_BITS + 1] = {0x00};
int num_bits = binarraytohex(hex, sizeof(hex), (char *)p, len);
if (num_bits == 0) {
p = NULL;

View file

@ -53,8 +53,8 @@
// **********************************************************************************************
// ---------------------------------Utilities Section--------------------------------------------
// **********************************************************************************************
#define LOWEST_DEFAULT_CLOCK 32
#define FSK_PSK_THRESHOLD 123
#define LOWEST_DEFAULT_CLOCK 32
#define FSK_PSK_THRESHOLD 123
//to allow debug print calls when used not on dev
@ -1496,7 +1496,7 @@ bool DetectST(uint8_t *buffer, size_t *size, int *foundclock, size_t *ststart, s
static int millerRawDecode(uint8_t *bits, size_t *size, int invert) {
if (*size < 16) return -1;
uint16_t MaxBits = 512, errCnt = 0;
uint16_t MaxBits = MAX_DEMODULATION_BITS, errCnt = 0;
size_t i, bitCnt = 0;
uint8_t alignCnt = 0, curBit = bits[0], alignedIdx = 0, halfClkErr = 0;
@ -1540,7 +1540,7 @@ int BiphaseRawDecode(uint8_t *bits, size_t *size, int *offset, int invert) {
uint16_t bitnum = 0;
uint16_t errCnt = 0;
size_t i = *offset;
uint16_t maxbits = 512;
uint16_t maxbits = MAX_DEMODULATION_BITS;
//check for phase change faults - skip one sample if faulty
bool offsetA = true, offsetB = true;
@ -1580,7 +1580,7 @@ uint16_t manrawdecode(uint8_t *bits, size_t *size, uint8_t invert, uint8_t *alig
if (*size < 16) return 0xFFFF;
int errCnt = 0, bestErr = 1000;
uint16_t bitnum = 0, maxBits = 512, bestRun = 0;
uint16_t bitnum = 0, maxBits = MAX_DEMODULATION_BITS, bestRun = 0;
size_t i;
//find correct start position [alignment]

View file

@ -30,6 +30,9 @@
// ignore first x samples of the buffer
#define SIGNAL_IGNORE_FIRST_SAMPLES 10
// Max number of bits when demodulating a signal
#define MAX_DEMODULATION_BITS 4096
// generic
typedef struct {
int low;