mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-14 01:03:01 -07:00
Fixed thresholding of io fskdemod
This commit is contained in:
parent
6f101995b6
commit
e47e52a2c8
1 changed files with 30 additions and 31 deletions
|
@ -592,17 +592,17 @@ uint32_t bytebits_to_byte(uint8_t* src, int numbits)
|
|||
|
||||
int IOdemodFSK(uint8_t *dest, size_t size)
|
||||
{
|
||||
static const uint8_t THRESHOLD = 170;
|
||||
uint32_t idx=0;
|
||||
//make sure buffer has data
|
||||
if (size < 66) return -1;
|
||||
//test samples are not just noise
|
||||
uint8_t testMax=0;
|
||||
for(idx=0;idx<65;idx++){
|
||||
if (testMax<dest[idx]) testMax=dest[idx];
|
||||
uint8_t justNoise = 1;
|
||||
for(idx=0;idx< size && justNoise ;idx++){
|
||||
justNoise = dest[idx] > THRESHOLD;
|
||||
}
|
||||
idx=0;
|
||||
//if not just noise
|
||||
if (testMax>20){
|
||||
if(justNoise) return 0;
|
||||
|
||||
// FSK demodulator
|
||||
size = fskdemod(dest, size,64,1,10,8); // RF/64 and invert
|
||||
if (size < 65) return -1; //did we get a good demod?
|
||||
|
@ -626,7 +626,6 @@ int IOdemodFSK(uint8_t *dest, size_t size)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue