FIX: HI/LOW fuzz levels. (one step for ASK/NZR etc)

This commit is contained in:
Chris 2018-09-08 20:54:54 +02:00
commit 4e42d11d15

View file

@ -176,10 +176,14 @@ int getHiLo(uint8_t *bits, size_t size, int *high, int *low, uint8_t fuzzHi, uin
if (signalprop.isnoise) return -1; if (signalprop.isnoise) return -1;
// add fuzz. // add fuzz.
*high = ((signalprop.high - 128) * fuzzHi + 12800)/100; *high = (signalprop.high * fuzzHi) / 100;
*low = ((signalprop.low - 128) * fuzzLo + 12800)/100; if ( signalprop.low < 0 ) {
*low = (signalprop.low * fuzzLo) / 100;
} else {
*low = signalprop.low * (100 + (100 - fuzzLo))/100;
}
if (g_debugMode == 1) if (g_debugMode > 0)
prnt("getHiLo fuzzed: High %d | Low %d", *high, *low); prnt("getHiLo fuzzed: High %d | Low %d", *high, *low);
return 1; return 1;
} }
@ -609,9 +613,10 @@ int DetectASKClock(uint8_t *dest, size_t size, int *clock, int maxErr) {
} }
//if we found no errors then we can stop here and a low clock (common clocks) //if we found no errors then we can stop here and a low clock (common clocks)
// this is correct one - return this clock // this is correct one - return this clock
if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, err %d, startpos %d, endpos %d", clk[clkCnt], errCnt, ii, i); //if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, err %d, startpos %d, endpos %d", clk[clkCnt], errCnt, ii, i);
if (errCnt == 0 && clkCnt < 7) { if (errCnt == 0 && clkCnt < 7) {
if (!clockFnd) *clock = clk[clkCnt]; if (!clockFnd)
*clock = clk[clkCnt];
return ii; return ii;
} }
//if we found errors see if it is lowest so far and save it as best run //if we found errors see if it is lowest so far and save it as best run
@ -631,7 +636,7 @@ int DetectASKClock(uint8_t *dest, size_t size, int *clock, int maxErr) {
best = k; best = k;
} }
} }
if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, # Errors %d, Current Best Clk %d, bestStart %d", clk[k], bestErr[k], clk[best], bestStart[best]); //if (g_debugMode == 2) prnt("DEBUG ASK: clk %d, # Errors %d, Current Best Clk %d, bestStart %d", clk[k], bestErr[k], clk[best], bestStart[best]);
} }
if (!clockFnd) *clock = clk[best]; if (!clockFnd) *clock = clk[best];