tsproc: Allow clock synchronization immediately after jump.

After a servo jump, the call to tsproc_reset() clears tsp->t3.  This
causes the next call to tsproc_update_offset() to fail.  However the
offset calculation does not necessarily depend on t3, i.e. when
filtered_delay is available and neither raw nor weighting is used.

This patch fixes the issue by allowing the stored filtered delay to be
used when appropriate.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Burkhard Ilsen <burkhardilsen@gmail.com>
master
Richard Cochran 2017-04-08 20:36:24 +02:00
parent a0cbeb7367
commit 2d5d8a0395
1 changed files with 10 additions and 2 deletions

View File

@ -180,20 +180,28 @@ int tsproc_update_offset(struct tsproc *tsp, tmv_t *offset, double *weight)
{ {
tmv_t delay = 0, raw_delay = 0; tmv_t delay = 0, raw_delay = 0;
if (tmv_is_zero(tsp->t1) || tmv_is_zero(tsp->t2) || if (tmv_is_zero(tsp->t1) || tmv_is_zero(tsp->t2))
tmv_is_zero(tsp->t3))
return -1; return -1;
switch (tsp->mode) { switch (tsp->mode) {
case TSPROC_FILTER: case TSPROC_FILTER:
if (!tsp->filtered_delay_valid) {
return -1;
}
delay = tsp->filtered_delay; delay = tsp->filtered_delay;
break; break;
case TSPROC_RAW: case TSPROC_RAW:
case TSPROC_RAW_WEIGHT: case TSPROC_RAW_WEIGHT:
if (tmv_is_zero(tsp->t3)) {
return -1;
}
raw_delay = get_raw_delay(tsp); raw_delay = get_raw_delay(tsp);
delay = raw_delay; delay = raw_delay;
break; break;
case TSPROC_FILTER_WEIGHT: case TSPROC_FILTER_WEIGHT:
if (tmv_is_zero(tsp->t3) || !tsp->filtered_delay_valid) {
return -1;
}
raw_delay = get_raw_delay(tsp); raw_delay = get_raw_delay(tsp);
delay = tsp->filtered_delay; delay = tsp->filtered_delay;
break; break;