Skip to content

Commit

Permalink
Add a minimum clock threshold.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Jan 26, 2020
1 parent 60e5e35 commit 0c48897
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/decoders/fluxmapreader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down

0 comments on commit 0c48897

Please sign in to comment.