mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
chg: better strong wave detection for biphase
This commit is contained in:
parent
841f20c5e5
commit
8c017157d4
1 changed files with 4 additions and 3 deletions
|
@ -445,11 +445,11 @@ int ManchesterEncode(uint8_t *bits, size_t size) {
|
||||||
|
|
||||||
// by marshmellow
|
// by marshmellow
|
||||||
// to detect a wave that has heavily clipped (clean) samples
|
// to detect a wave that has heavily clipped (clean) samples
|
||||||
// loop 512 samples, if 250 of them is deemed maxed out, we assume the wave is clipped.
|
// loop 1024 samples, if 250 of them is deemed maxed out, we assume the wave is clipped.
|
||||||
bool DetectCleanAskWave(uint8_t *dest, size_t size, uint8_t high, uint8_t low) {
|
bool DetectCleanAskWave(uint8_t *dest, size_t size, uint8_t high, uint8_t low) {
|
||||||
bool allArePeaks = true;
|
bool allArePeaks = true;
|
||||||
uint16_t cntPeaks = 0;
|
uint16_t cntPeaks = 0;
|
||||||
size_t loopEnd = 512 + 160;
|
size_t loopEnd = 1024 + 160;
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (loopEnd > size) loopEnd = size;
|
if (loopEnd > size) loopEnd = size;
|
||||||
|
@ -463,7 +463,8 @@ bool DetectCleanAskWave(uint8_t *dest, size_t size, uint8_t high, uint8_t low) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allArePeaks) {
|
if (!allArePeaks) {
|
||||||
if (cntPeaks > 250) return true;
|
if (g_debugMode == 2) prnt("DEBUG DetectCleanAskWave: peaks (200) %u", cntPeaks);
|
||||||
|
if (cntPeaks > 200) return true;
|
||||||
}
|
}
|
||||||
return allArePeaks;
|
return allArePeaks;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue