You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instant MPG seemingly randomly reports fuel flow (g/h for my settings) instead of MPG. Affects every screen as well as serial output. It seems to be working correctly about 20% of the time, and showing fuel flow the other 80%. It usually starts working, and then stops working after coming to a stop. Sometimes though it doesn't start in a working condition, and sometimes it will come back after driving (usually after coming to a halt).
From what I can tell, fuel economy is calculated in prgmFuelEcon() in functions.h.
static const uint8_t prgmFuelEcon[] PROGMEM = {
instrLdRegTripVarIndexed, 0x02, rvVSSpulseIdx, // fetch the accumulated number of VSS pulses counted
instrMul2byMain, mpCyclesPerVolumeIdx, // multiply by cycles per unit volume to get the denominator for fuel economy
instrLdReg, 0x21, // save denominator for later
instrLdRegTripVarIndexed, 0x02, rvInjCycleIdx, // fetch the accumulated fuel injector open cycle measurement
instrMul2byEEPROM, pPulsesPerDistanceIdx, // multiply by the pulses per unit distance factor to get the numerator for fuel economy
instrBranchIfFuelOverDist, 6, // if MPGuino is in metric mode, skip ahead
instrSwapReg, 0x21, // swap the numerator and denominator terms around
instrMul2byConst, idxDecimalPoint, // put in the decimal point constant used for output formatting (for mi/gal or km/L)
instrSkip, 2, // go skip ahead
//fecont1:
instrMul2byConst, idxMetricFE, // put in the output formatting decimal point constant, multiplied by 100 (for L/100km or gal/100mi)
//fecont2:
instrDiv2by1, // divide the numerator by the denominator
instrAdjustQuotient, // bump up quotient by adjustment term (0 if remainder/divisor < 0.5, 1 if remainder/divisor >= 0.5)
instrDone // exit to caller
};
So it seems like it calculates (amount of fuel/amount of distance) and then swaps the numerator and denominator to get (distance/fuel). (I'm using U.S. settings). So if I'm only getting (amount of fuel) reported instead of (distance/fuel), it seems like the code must be first calculating (fuel/distance), somehow loosing (distance) (or setting it = 1?) and then not swapping the numerator and denominator before returning the value.
I'll start looking here.
The text was updated successfully, but these errors were encountered:
Interesting. I found that I can put the car in park/neutral and wait 5-10 seconds, and it will correctly show instant mpg after that every time. Then when I come to stop again, and the screen goes to the "park" screen (no vehicle movement) if I don't shift to park/neutral, it will continue to read the g/h rate which replaces mpg on the "park" screen. I wonder if there is a fuel rate threshold for stopping/restarting the instant mpg reading? Because that's the only thing really noticeably different from idling in gear (idle in gear at 0.78-0.88g/h, idle in neutral 0.47-0.68g/h).
Instant MPG seemingly randomly reports fuel flow (g/h for my settings) instead of MPG. Affects every screen as well as serial output. It seems to be working correctly about 20% of the time, and showing fuel flow the other 80%. It usually starts working, and then stops working after coming to a stop. Sometimes though it doesn't start in a working condition, and sometimes it will come back after driving (usually after coming to a halt).
From what I can tell, fuel economy is calculated in prgmFuelEcon() in functions.h.
So it seems like it calculates (amount of fuel/amount of distance) and then swaps the numerator and denominator to get (distance/fuel). (I'm using U.S. settings). So if I'm only getting (amount of fuel) reported instead of (distance/fuel), it seems like the code must be first calculating (fuel/distance), somehow loosing (distance) (or setting it = 1?) and then not swapping the numerator and denominator before returning the value.
I'll start looking here.
The text was updated successfully, but these errors were encountered: