Discussion:
[Linuxptp-devel] [PATCH] Don't always step clock on PI servo reset.
Miroslav Lichvar
2014-03-12 11:51:02 UTC
Permalink
The initial check if the clock should be stepped always passed after the
servo was reset (e.g. from clock sanity check). Fix the condition to
step only when the threshold is exceeded.

Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
pi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pi.c b/pi.c
index 171ff55..52d4c2f 100644
--- a/pi.c
+++ b/pi.c
@@ -116,8 +116,8 @@ static double pi_sample(struct servo *servo,
else if (s->drift > s->maxppb)
s->drift = s->maxppb;

- if (!s->first_update ||
- (s->max_f_offset && (s->max_f_offset < fabs(offset))) ||
+ if ((s->first_update &&
+ s->max_f_offset && (s->max_f_offset < fabs(offset))) ||
(s->max_offset && (s->max_offset < fabs(offset))))
*state = SERVO_JUMP;
else
--
1.8.4.2
Ken ICHIKAWA
2014-03-13 04:28:31 UTC
Permalink
Post by Miroslav Lichvar
The initial check if the clock should be stepped always passed after the
servo was reset (e.g. from clock sanity check). Fix the condition to
step only when the threshold is exceeded.
Looks good to me.

Thanks,
Ken Ichikawa
Post by Miroslav Lichvar
---
pi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pi.c b/pi.c
index 171ff55..52d4c2f 100644
--- a/pi.c
+++ b/pi.c
@@ -116,8 +116,8 @@ static double pi_sample(struct servo *servo,
else if (s->drift > s->maxppb)
s->drift = s->maxppb;
- if (!s->first_update ||
- (s->max_f_offset && (s->max_f_offset < fabs(offset))) ||
+ if ((s->first_update &&
+ s->max_f_offset && (s->max_f_offset < fabs(offset))) ||
(s->max_offset && (s->max_offset < fabs(offset))))
*state = SERVO_JUMP;
else
Richard Cochran
2014-03-13 15:27:09 UTC
Permalink
Post by Miroslav Lichvar
The initial check if the clock should be stepped always passed after the
servo was reset (e.g. from clock sanity check). Fix the condition to
step only when the threshold is exceeded.
Applied.

Thanks,
Richard

Loading...