From f1b65ed4aa1896766e75759acdaa81723b5d1184 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 29 May 2017 00:02:43 -0400 Subject: [PATCH] better error handling --- firmware/controllers/sensors/hip9011_lookup.cpp | 4 ++-- firmware/controllers/sensors/hip9011_lookup.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/sensors/hip9011_lookup.cpp b/firmware/controllers/sensors/hip9011_lookup.cpp index 3c24fca0f3..98f4c99eba 100644 --- a/firmware/controllers/sensors/hip9011_lookup.cpp +++ b/firmware/controllers/sensors/hip9011_lookup.cpp @@ -65,7 +65,7 @@ float getRpmByAngleWindowAndTimeUs(int timeUs, float angleWindowWidth) { } int getIntegrationIndexByRpm(float rpm) { - int i = findIndex(rpmLookup, INT_LOOKUP_SIZE, (rpm)); + int i = findIndexMsg("getIbR", rpmLookup, INT_LOOKUP_SIZE, (rpm)); return i == -1 ? INT_LOOKUP_SIZE - 1 : INT_LOOKUP_SIZE - i - 1; } @@ -79,7 +79,7 @@ int getHip9011GainIndex(float gain) { * @param frequency knock frequencey, in kHz */ int getHip9011BandIndex(float frequency) { - return findIndex(bandFreqLookup, BAND_LOOKUP_SIZE, frequency); + return findIndexMsg("freq", bandFreqLookup, BAND_LOOKUP_SIZE, frequency); } EXTERN_ENGINE; diff --git a/firmware/controllers/sensors/hip9011_lookup.h b/firmware/controllers/sensors/hip9011_lookup.h index 47f9a4effc..ce62d5819e 100644 --- a/firmware/controllers/sensors/hip9011_lookup.h +++ b/firmware/controllers/sensors/hip9011_lookup.h @@ -25,7 +25,7 @@ int getHip9011GainIndex(float gain); int getHip9011BandIndex(float frequency); void prepareHip9011RpmLookup(float angleWindowWidth); -#define GAIN_INDEX(gain) (GAIN_LOOKUP_SIZE - 1 - findIndex(gainLookupInReverseOrder, GAIN_LOOKUP_SIZE, (gain))) +#define GAIN_INDEX(gain) (GAIN_LOOKUP_SIZE - 1 - findIndexMsg("fGain", gainLookupInReverseOrder, GAIN_LOOKUP_SIZE, (gain))) #define BAND(bore) (900 / (PIF * (bore) / 2)) extern float rpmLookup[INT_LOOKUP_SIZE];