Taring was done with user defined sign, which later resulted in tare
being "resigned" twice. Because of that taring was workign correctly
for one sign, and not the other.
Fix it to disable user sign when tarring, and tare always without
changing sign.
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
ptype of ((int32_t)0 * (uint32_t)0) is (unsigned). "i" counter was
declared unsigned to not make comparision with "unsigned char" in for loop.
This resulted in calculation in average to be implicitly casted to unsigned,
and when negative number was added to it, it turned into huge value.
Change type of "i" to signed, and just cast (unsigned char) to (int)
to fix this.
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>