Commit a6b46a9e authored by Alessandro Rubini's avatar Alessandro Rubini

servo: remove wrong and needless average in owd

The "Use the average between current value and previous one" in the
"one way delay" calculation was actually a running-average of two
samples. This happened before the real (and properly implemented)
running average of the value.  By removing the first one we better
respect the configured width of the filter.

As a side effect the default (64 samples) is now effective, while earlier
it behaved like a 128-sample running average. It converges faster.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent ac6542d1
......@@ -133,10 +133,6 @@ void pp_servo_got_resp(struct pp_instance *ppi)
else if (owd_fltr->s_exp > 1 << s)
owd_fltr->s_exp = 1 << s;
/* Use the average between current value and previous one */
owd->nanoseconds = (owd->nanoseconds + owd_fltr->nsec_prev) / 2;
owd_fltr->nsec_prev = owd->nanoseconds;
/* filter 'oneWayDelay' (running average) */
owd_fltr->y = (owd_fltr->y * (owd_fltr->s_exp - 1)
+ owd->nanoseconds)
......
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