View Single Post
Old 04-05-2014, 07:03 AM   #6400 (permalink)
EcoModding Lurker
Join Date: Mar 2014
Location: New Zeland
Posts: 4
Thanks: 0
Thanked 2 Times in 2 Posts
Originally Posted by MPaulHolmes View Post
I'm getting close to being done with a complete rewrite of the code. I'm pretty sure there's a bug in the original software for the pwm filter. It tries to take sort of a running average for pwm, but look at this:

pwmAverage = (127*pwmAverage + 1*pwmNewValue)/128

Let's say, for instance, pwmAverage is 10, and pwmNewValue is 20. pwmAverage will never be able to creep toward 20. If the new value of pwm average is 10 < pwmAverage < 11, it will be truncated to 10, and won't ever get to 20.
Hi Paul,
I could look though the code if you would like. Is the source in version controller somewhere public?
  Reply With Quote