Don't always step clock on PI servo reset.

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 <mlichvar@redhat.com>
master
Miroslav Lichvar 2014-03-12 12:51:02 +01:00 committed by Richard Cochran
parent 91e240679b
commit 72a9212600
1 changed files with 2 additions and 2 deletions

4
pi.c
View File

@ -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