RPM refactoring

This commit is contained in:
rusefi 2017-07-06 17:26:32 -04:00
parent 1c63adcd55
commit ba42a98c2f
2 changed files with 3 additions and 4 deletions

View File

@ -63,8 +63,6 @@ void setFlatInjectorLag(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
floatms_t getCrankshaftRevolutionTimeMs(int rpm);
floatms_t getEngineCycleDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
#define isCrankingR(rpm) ((rpm) > 0 && (rpm) < CONFIG(cranking.rpm))
float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE);
floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -217,13 +217,14 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
printf("fuel fuelMs=%f adjusted=%f\t\n", ENGINE(fuelMs), injectionDuration);
#endif /*EFI_PRINTF_FUEL_DETAILS */
bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE);
/**
* todo: pre-calculate 'numberOfInjections'
* see also injectorDutyCycle
*/
if (!isCrankingR(rpm) && injectionDuration * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX) > getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX)) {
if (!isCranking && injectionDuration * getNumberOfInjections(engineConfiguration->injectionMode PASS_ENGINE_PARAMETER_SUFFIX) > getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX)) {
warning(CUSTOM_TOO_LONG_FUEL_INJECTION, "Too long fuel injection %fms", injectionDuration);
} else if (isCrankingR(rpm) && injectionDuration * getNumberOfInjections(engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER_SUFFIX) > getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX)) {
} else if (isCranking && injectionDuration * getNumberOfInjections(engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER_SUFFIX) > getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX)) {
warning(CUSTOM_TOO_LONG_CRANKING_FUEL_INJECTION, "Too long cranking fuel injection %fms", injectionDuration);
}