better error handling

This commit is contained in:
rusefi 2017-05-29 00:02:43 -04:00
parent a1f1ecd072
commit f1b65ed4aa
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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];