bugfix: servo: don't throw out precision
When calculating the running average (and the average between two as
well), we must first add all items and then divide. Everyone does like
this, so we should as well, to avoid loosing the low bits
Example: 3 and 5, average is 4: (3+5) / 2 = 4, but 3/2 + 5/2 = 3.
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Showing
Please
register
or
sign in
to comment