From 1fce0201a55c45f8333883cc95589c701d5723d5 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 6 Jul 2019 20:45:47 -0400 Subject: [PATCH] user is unable to start with zero fuel - at least showing a warning https://rusefi.com/forum/viewtopic.php?p=33761#p33760 --- firmware/controllers/algo/fuel_math.cpp | 7 ++++++- firmware/controllers/algo/obd_error_codes.h | 4 ++-- firmware/controllers/engine_controller.cpp | 2 +- firmware/controllers/map_averaging.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index dc56837ff9..d34323598d 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -350,7 +350,12 @@ floatms_t getCrankingFuel3(float coolantTemperature, float tpsCoef = cisnan(tps) ? 1 : interpolate2d("crankTps", tps, engineConfiguration->crankingTpsBins, engineConfiguration->crankingTpsCoef, CRANKING_CURVE_SIZE); - return baseCrankingFuel * durationCoef * coolantTempCoef * tpsCoef; + floatms_t result = baseCrankingFuel * durationCoef * coolantTempCoef * tpsCoef; + + if (result <= 0) { + warning(CUSTOM_ERR_ZERO_CRANKING_FUEL, "Cranking fuel value %f", result); + } + return result; } float getFuelRate(floatms_t totalInjDuration, efitick_t timePeriod DECLARE_ENGINE_PARAMETER_SUFFIX) { diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index 8361894a05..91e134ac76 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -2051,10 +2051,10 @@ typedef enum { CUSTOM_ERR_6689 = 6689, CUSTOM_ERR_6690 = 6690, - CUSTOM_ERR_6691 = 6691, + CUSTOM_ERR_MAP_AVG_OFFSET = 6691, CUSTOM_ERR_6692 = 6692, CUSTOM_ERR_6693 = 6693, - CUSTOM_ERR_6694 = 6694, + CUSTOM_ERR_ZERO_CRANKING_FUEL = 6694, CUSTOM_ERR_6695 = 6695, CUSTOM_ERR_6696 = 6696, CUSTOM_ERR_6697 = 6697, diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 976f4a6e41..718c27250e 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -810,6 +810,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20190630; + return 20190706; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index 05bb5fed43..57c76e5a01 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -232,7 +232,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) { efiAssertVoid(CUSTOM_ERR_6690, !cisnan(start), "start"); angle_t offsetAngle = TRIGGER_SHAPE(eventAngles[CONFIG(mapAveragingSchedulingAtIndex)]); - efiAssertVoid(CUSTOM_ERR_6691, !cisnan(offsetAngle), "offsetAngle"); + efiAssertVoid(CUSTOM_ERR_MAP_AVG_OFFSET, !cisnan(offsetAngle), "offsetAngle"); for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { angle_t cylinderOffset = getEngineCycle(engineConfiguration->operationMode) * i / engineConfiguration->specs.cylindersCount;