Commit 6ecdf970 authored by Alessandro Rubini's avatar Alessandro Rubini

wr-servo: run twice as fast

The old code used to discard every other tuple, because when "wait for
hardware was set", the code cleared the flag and did nothing. This was
exposed by one of the clean-up passes, but I chose not to change the
behaviour.

Now I do the normal work when wait_for_hw gets cleared.  However, as a
side effect, wr_mon was always saying "wait for hardware", because any
action would set the flag.

Thus, the solution is not setting the flag in TRACK_PHASE, but only
in the initial SYNC_SEC and SYNC_NSEC states. The code then checks
if the hardware is busy, irrespective of any flag.  The result in wr_mon
is matching reality, and the code works twice as fast as it used to.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 11c199bc
......@@ -296,15 +296,11 @@ int wr_servo_update(struct pp_instance *ppi)
* DSPOR(ppi)->doRestart = TRUE; */
}
/*
* After each action on the hardware, we must verify if it is over.
* However, we loose one iteration every two. To be audited later.
*/
if (s->flags & WR_FLAG_WAIT_HW) {
if (!wrp->ops->adjust_in_progress())
s->flags &= ~WR_FLAG_WAIT_HW;
else
pp_diag(ppi, servo, 1, "servo:busy\n");
/* After each action on the hardware, we must verify if it is over. */
if (!wrp->ops->adjust_in_progress()) {
s->flags &= ~WR_FLAG_WAIT_HW;
} else {
pp_diag(ppi, servo, 1, "servo:busy\n");
goto out;
}
......@@ -407,8 +403,6 @@ int wr_servo_update(struct pp_instance *ppi)
s->cur_setpoint);
s->delta_ms_prev = s->delta_ms;
s->flags |= WR_FLAG_WAIT_HW;
s->state = WR_TRACK_PHASE;
}
break;
......
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