mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-21 20:52:45 +08:00
fix avg
This commit is contained in:
parent
903af4412a
commit
e7edefe24e
1 changed files with 9 additions and 4 deletions
|
@ -54,7 +54,7 @@ static void RAMFUNC skipSniff(uint8_t *dest, uint16_t dsize, uint8_t skipMode, u
|
||||||
if (accum > (val << 8))
|
if (accum > (val << 8))
|
||||||
accum = val << 8;
|
accum = val << 8;
|
||||||
case HF_SNOOP_SKIP_AVG:
|
case HF_SNOOP_SKIP_AVG:
|
||||||
accum += (val & 0xff) + (val << 8);
|
accum += (val & 0xff) + (val >> 8);
|
||||||
default: { // HF_SNOOP_SKIP_DROP and the rest
|
default: { // HF_SNOOP_SKIP_DROP and the rest
|
||||||
if (ratioindx == 0)
|
if (ratioindx == 0)
|
||||||
accum = val & 0xff;
|
accum = val & 0xff;
|
||||||
|
@ -64,10 +64,15 @@ static void RAMFUNC skipSniff(uint8_t *dest, uint16_t dsize, uint8_t skipMode, u
|
||||||
ratioindx++;
|
ratioindx++;
|
||||||
if (ratioindx >= skipRatio) {
|
if (ratioindx >= skipRatio) {
|
||||||
ratioindx = 0;
|
ratioindx = 0;
|
||||||
if (skipMode == HF_SNOOP_SKIP_AVG)
|
if (skipMode == HF_SNOOP_SKIP_AVG && skipRatio > 0) {
|
||||||
*dest = accum / (skipRatio * 2);
|
accum = accum / (skipRatio * 2);
|
||||||
else
|
if (accum <= 0xff)
|
||||||
*dest = accum;
|
*dest = accum;
|
||||||
|
else
|
||||||
|
*dest = 0xff;
|
||||||
|
} else {
|
||||||
|
*dest = accum;
|
||||||
|
}
|
||||||
dest++;
|
dest++;
|
||||||
dsize --;
|
dsize --;
|
||||||
accum = 0;
|
accum = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue