Add a minimum clock threshold.

This commit is contained in:
David Given
2020-01-26 17:48:33 +01:00
parent 60e5e35947
commit 0c48897814

View File

@@ -25,6 +25,11 @@ static DoubleFlag clockIntervalBias(
"Adjust intervals between pulses by this many clocks before decoding.",
-0.02);
static DoubleFlag minimumClockUs(
{ "--minimum-clock-us" },
"Refuse to detect clocks shorter than this, to avoid false positives.",
0.75);
int FluxmapReader::readOpcode(unsigned& ticks)
{
ticks = 0;
@@ -222,7 +227,9 @@ nanoseconds_t FluxmapReader::seekToPattern(const FluxMatcher& pattern, const Flu
seek(positions[intervalCount-match.intervals]);
_pos.zeroes = match.zeroes;
matching = match.matcher;
return match.clock * NS_PER_TICK;
nanoseconds_t detectedClock = match.clock * NS_PER_TICK;
if (detectedClock > (minimumClockUs*1000))
return match.clock * NS_PER_TICK;
}
for (unsigned i=0; i<intervalCount; i++)