Commit d2a57023 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

std-servo: fix initial jump for p2p slaves

This was my fault. The initial time jump was based on "T4 + MPD". This
on the assumption that T4 is sharper then time->get().  At least this
is true for White Rabbit systems, where time->get() was not even
correct when I started the project.

As a result, the initial jump for a p2p slave was always wrong,
because it referred to an old timestamp. We ended up a few hundreds ms
off the master, to the start a long steering.

We now add ofm to the current time, and the result is good in both case.
WR systems have their own servo anyways, but even a slave to non-wr
masters should behave well, because time->set now works.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent d633d167
......@@ -272,28 +272,22 @@ static
int pp_servo_offset_master(struct pp_instance *ppi, TimeInternal * mpd,
TimeInternal * ofm, TimeInternal * m_to_s_dly)
{
Integer32 adj;
TimeInternal time_tmp;
sub_TimeInternal(ofm, m_to_s_dly, mpd);
pp_diag(ppi, servo, 1, "Offset from master: %s\n", fmt_TI(ofm));
if (ofm->seconds) {
TimeInternal time_tmp;
if (!ofm->seconds)
return 0; /* proceeed with adjust */
SRV(ppi)->obs_drift = 0; /* too long a jump; reset PI value */
if (!pp_can_adjust(ppi))
return 0; /* e.g., a loopback test run... "-t" on cmdline */
/* if secs, reset clock or set freq adjustment to max */
if (pp_can_adjust(ppi)) {
/* Can't use adjust, limited to +/- 2s */
time_tmp = ppi->t4;
add_TimeInternal(&time_tmp, &time_tmp,
&DSCUR(ppi)->meanPathDelay);
ppi->t_ops->set(ppi, &time_tmp);
pp_servo_init(ppi);
}
return 1; /* done */
}
return 0; /* not done: proceed with filtering */
ppi->t_ops->get(ppi, &time_tmp);
sub_TimeInternal(&time_tmp, &time_tmp, ofm);
ppi->t_ops->set(ppi, &time_tmp);
pp_servo_init(ppi);
return 1; /* done */
}
static
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment