Skip to content

Commit

Permalink
ts2phc: Fix edge rejection for pulse widths over 0.5s.
Browse files Browse the repository at this point in the history
If the configured pulse width is longer than 0.5 seconds, the calculated
range of ignored offsets is too small to cover the wrong edge. Fix the
calculation of the limits to use the minimum of pulsewidth and
(1.0s - pulsewidth). A pulsewidth of 0.5s should give the shortest interval.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
  • Loading branch information
mlichvar authored and richardcochran committed Jul 28, 2024
1 parent ada36c7 commit 0011504
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ts2phc_pps_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ static struct ts2phc_pps_sink *ts2phc_pps_sink_create(struct ts2phc_private *pri
sink->correction = nanoseconds_to_tmv(correction);

pulsewidth = config_get_int(cfg, device, "ts2phc.pulsewidth");
if (pulsewidth > 500000000)
pulsewidth = 1000000000 - pulsewidth;
pulsewidth /= 2;
sink->ignore_upper = 1000000000 - pulsewidth;
sink->ignore_lower = pulsewidth;
Expand Down

0 comments on commit 0011504

Please sign in to comment.