mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
chg: adjust ask demod
This commit is contained in:
parent
e925dc9f7a
commit
027cda47d2
1 changed files with 8 additions and 9 deletions
|
@ -1473,6 +1473,11 @@ int askdemod_ext(uint8_t *bits, size_t *size, int *clk, int *invert, int maxErr,
|
||||||
|
|
||||||
if (*size == 0) return -1;
|
if (*size == 0) return -1;
|
||||||
|
|
||||||
|
if (signalprop.isnoise) {
|
||||||
|
if (g_debugMode == 2) prnt("DEBUG (askdemod_ext) just noise detected - aborting");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
int start = DetectASKClock(bits, *size, clk, maxErr);
|
int start = DetectASKClock(bits, *size, clk, maxErr);
|
||||||
if (*clk == 0 || start < 0) return -3;
|
if (*clk == 0 || start < 0) return -3;
|
||||||
|
|
||||||
|
@ -1482,7 +1487,7 @@ int askdemod_ext(uint8_t *bits, size_t *size, int *clk, int *invert, int maxErr,
|
||||||
// ICEMAN todo,
|
// ICEMAN todo,
|
||||||
if (amp == 1) askAmp(bits, *size);
|
if (amp == 1) askAmp(bits, *size);
|
||||||
|
|
||||||
if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, beststart %d, amp %d", *clk, start, amp);
|
if (g_debugMode == 2) prnt("DEBUG (askdemod_ext) clk %d, beststart %d, amp %d", *clk, start, amp);
|
||||||
|
|
||||||
//start pos from detect ask clock is 1/2 clock offset
|
//start pos from detect ask clock is 1/2 clock offset
|
||||||
// NOTE: can be negative (demod assumes rest of wave was there)
|
// NOTE: can be negative (demod assumes rest of wave was there)
|
||||||
|
@ -1490,12 +1495,6 @@ int askdemod_ext(uint8_t *bits, size_t *size, int *clk, int *invert, int maxErr,
|
||||||
uint16_t initLoopMax = 1024;
|
uint16_t initLoopMax = 1024;
|
||||||
if (initLoopMax > *size) initLoopMax = *size;
|
if (initLoopMax > *size) initLoopMax = *size;
|
||||||
|
|
||||||
// just noise - no super good detection. good enough
|
|
||||||
if (signalprop.isnoise) {
|
|
||||||
if (g_debugMode == 2) prnt("DEBUG askdemod_ext: just noise detected - aborting");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect high and lows
|
// Detect high and lows
|
||||||
//25% clip in case highs and lows aren't clipped [marshmellow]
|
//25% clip in case highs and lows aren't clipped [marshmellow]
|
||||||
int high, low;
|
int high, low;
|
||||||
|
@ -1539,7 +1538,7 @@ int askdemod_ext(uint8_t *bits, size_t *size, int *clk, int *invert, int maxErr,
|
||||||
bits[bitnum++] = *invert ^ 1;
|
bits[bitnum++] = *invert ^ 1;
|
||||||
} else if (i - lastBit >= *clk + tol) {
|
} else if (i - lastBit >= *clk + tol) {
|
||||||
if (bitnum > 0) {
|
if (bitnum > 0) {
|
||||||
if (g_debugMode == 2) prnt("DEBUG: (askdemod_ext) Modulation Error at: %u", i);
|
// if (g_debugMode == 2) prnt("DEBUG: (askdemod_ext) Modulation Error at: %u", i);
|
||||||
bits[bitnum++] = 7;
|
bits[bitnum++] = 7;
|
||||||
errCnt++;
|
errCnt++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue