Replace floating-point arithmetic with integer weighted average.
This eliminates soft-float library calls on platforms without FPU
(e.g., ESP8266), reducing the function from 352 bytes.
The integer version uses uint16_t weighted average which matches
the float version's output in 99.96% of cases (off-by-one in
the remaining 0.04% due to float precision differences).