better startup handling

This commit is contained in:
rusefi 2017-04-19 07:58:22 -04:00
parent a581749703
commit e876fd2115
2 changed files with 8 additions and 4 deletions

View File

@ -75,9 +75,7 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_F) {
}
sensors.vBatt = hasVBatt(PASS_ENGINE_PARAMETER_F) ? getVBatt(PASS_ENGINE_PARAMETER_F) : 12;
floatms_t injectorLag = getInjectorLag(sensors.vBatt PASS_ENGINE_PARAMETER);
efiAssertVoid(!cisnan(injectorLag), "NaN injectorLag");
engineState.injectorLag = injectorLag;
engineState.injectorLag = getInjectorLag(sensors.vBatt PASS_ENGINE_PARAMETER);
}
void Engine::onTriggerEvent(efitick_t nowNt) {

View File

@ -137,6 +137,7 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_S) {
engineConfiguration->crankingInjectionMode :
engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
if (numberOfCylinders == 0) {
warning(CUSTOM_ERR_6509, "config not ready");
return 0; // we can end up here during configuration reset
}
if (isCranking) {
@ -152,7 +153,12 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_S) {
baseFuel, fuelPerCycle, theoreticalInjectionLength);
#endif /*EFI_PRINTF_FUEL_DETAILS */
}
return theoreticalInjectionLength + ENGINE(engineState.injectorLag);
floatms_t injectorLag = ENGINE(engineState.injectorLag);
if (cisnan(injectorLag)) {
warning(CUSTOM_ERR_6539, "injectorLah not ready");
return 0; // we can end up here during configuration reset
}
return theoreticalInjectionLength + injectorLag;
}
floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_S) {