From 373da8607f22629bf600b23bb61648246a48b3b9 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 8 Dec 2017 20:04:58 -0500 Subject: [PATCH] #490 configuration validation --- firmware/controllers/algo/obd_error_codes.h | 4 ++-- firmware/controllers/core/interpolation.cpp | 2 +- firmware/controllers/trigger/aux_valves.cpp | 7 +++++++ firmware/rusefi.cpp | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index 55c1de2d56..6a9ee6db14 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -1748,9 +1748,9 @@ typedef enum { CUSTOM_OBD_TS_PAGE_MISMATCH = 6052, CUSTOM_OBD_TS_OUTPUT_MISMATCH = 6053, CUSTOM_TOO_LONG_CRANKING_FUEL_INJECTION = 6054, - CUSTOM_OBD_55 = 6055, + CUSTOM_INTERPOLATE_NAN = 6055, ERROR_HISTO_NAME = 6056, - CUSTOM_OBD_57 = 6057, + CUSTOM_AUX_OUT_OF_ORDER = 6057, CUSTOM_OBD_58 = 6058, CUSTOM_OBD_59 = 6059, diff --git a/firmware/controllers/core/interpolation.cpp b/firmware/controllers/core/interpolation.cpp index 2df7475deb..e64828177d 100644 --- a/firmware/controllers/core/interpolation.cpp +++ b/firmware/controllers/core/interpolation.cpp @@ -237,7 +237,7 @@ int findIndex(const float array[], int size, float value) { */ float interpolate2d(const char *msg, float value, float bin[], float values[], int size) { if (isnan(value)) { - firmwareError(CUSTOM_OBD_55, "NaN in interpolate2d %s", msg); + firmwareError(CUSTOM_INTERPOLATE_NAN, "NaN in interpolate2d %s", msg); return NAN; } int index = findIndexMsg("value", bin, size, value); diff --git a/firmware/controllers/trigger/aux_valves.cpp b/firmware/controllers/trigger/aux_valves.cpp index 023fc8619d..e9e9f40a18 100644 --- a/firmware/controllers/trigger/aux_valves.cpp +++ b/firmware/controllers/trigger/aux_valves.cpp @@ -100,5 +100,12 @@ void updateAuxValves(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engine->engineState.auxValveEnd = interpolate2d("aux", x, engineConfiguration->fsioCurve2Bins, engineConfiguration->fsioCurve2, FSIO_CURVE_16); + + if (engine->engineState.auxValveStart >= engine->engineState.auxValveEnd) { + // this is a fatal error to make this really visible + firmwareError(CUSTOM_AUX_OUT_OF_ORDER, "out of order at %f %f %f", x, + engine->engineState.auxValveStart, + engine->engineState.auxValveEnd); + } } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index b655d824df..2a0bb6f208 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -260,5 +260,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20171203; + return 20171208; }