Thread: MPH code?
View Single Post
Old 12-08-2011, 12:10 PM   #2 (permalink)
Sebastian
EcoModding Lurker
 
Join Date: Oct 2009
Location: Austria
Posts: 28
Thanks: 0
Thanked 1 Time in 1 Post
My Version of MPGuino Code uses this small code. Only change to MPGuino original should be the use of standard math functions:

Code:
unsigned long instantfuelperhour(){
  unsigned long instInjDur = instInjEnd - instInjStart;
  if (instInjDur == 0) return 0;
  return (instInjTot * 3600000000ull) * 1000ull / parms[MICRO_SECONDS_PER_LITER_IDX] / instInjDur;  
}
Works just fine.
  Reply With Quote