View Single Post
Old 04-06-2014, 12:51 PM   #6409 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,119 Times in 734 Posts
Here's the modified throttleAverage code, as a sample. Thanks for the suggestion, Astro! I'm making the same change to pwmAverage and temperatureAverage. Totally unreadable, but pretty fast. haha:
Code:
throttleAverageTimes1024   //    = (31*throttleAverageTimes1024)/1024 + 1*ADThrottle) / 32 * 1024;
                           //    = 32*(throttleAverageTimes1024/1024) - 1*(throttleAverageTimes1024/1024) + 1*ADThrottle) / 32 * 1024; 

= ((throttleAverageTimes1024 >> 5) - (throttleAverageTimes1024 >> 10) + (long)ADThrottle) << 5;
__________________
kits and boards
  Reply With Quote
The Following User Says Thank You to MPaulHolmes For This Useful Post:
Astro (04-06-2014)