helping us trace CUSTOM_INTEPOLATE_ERROR

This commit is contained in:
rusefillc 2021-04-08 16:14:06 -04:00
parent bf41ec354e
commit 6eb68aa4a1
3 changed files with 10 additions and 10 deletions

View File

@ -52,7 +52,7 @@ public:
}
// todo: we have a bit of a mess: in TunerStudio, RPM is X-axis
return interpolate3d<vType, kType>(y, loadBins, LOAD_BIN_SIZE, xRpm, rpmBins, RPM_BIN_SIZE, pointers) * TValueMultiplier::asFloat();
return interpolate3d<vType, kType>(name, y, loadBins, LOAD_BIN_SIZE, xRpm, rpmBins, RPM_BIN_SIZE, pointers) * TValueMultiplier::asFloat();
}
void setAll(vType value) {

View File

@ -173,7 +173,7 @@ int findIndexMsgExt(const char *msg, const kType array[], int size, kType value)
* @brief Two-dimensional table lookup with linear interpolation
*/
template<typename vType, typename kType>
float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kType yBin[], int yBinSize, const vType* const map[]) {
float interpolate3d(const char *msg, float x, const kType xBin[], int xBinSize, float y, const kType yBin[], int yBinSize, const vType* const map[]) {
if (cisnan(x)) {
warning(CUSTOM_INTEPOLATE_ERROR_3, "%.2f: x is NaN in interpolate3d", x);
return NAN;
@ -209,7 +209,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
float rpmMinValue = map[0][yIndex];
float rpmMaxValue = map[0][yIndex + 1];
return interpolateMsg("3d", keyMin, rpmMinValue, keyMax, rpmMaxValue, y);
return interpolateMsg(msg, keyMin, rpmMinValue, keyMax, rpmMaxValue, y);
}
if (yIndex < 0) {
@ -224,7 +224,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
float value1 = map[xIndex][0];
float value2 = map[xIndex + 1][0];
return interpolateMsg("out3d", key1, value1, key2, value2, x);
return interpolateMsg(msg, key1, value1, key2, value2, x);
}
if (xIndex == xBinSize - 1 && yIndex == yBinSize - 1) {
@ -247,7 +247,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
float value1 = map[xIndex][yIndex];
float value2 = map[xIndex][yIndex + 1];
return interpolateMsg("out3d", key1, value1, key2, value2, y);
return interpolateMsg(msg, key1, value1, key2, value2, y);
}
if (yIndex == yBinSize - 1) {
@ -262,7 +262,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
float value1 = map[xIndex][yIndex];
float value2 = map[xIndex + 1][yIndex];
return interpolateMsg("out3d", key1, value1, key2, value2, x);
return interpolateMsg(msg, key1, value1, key2, value2, x);
}
/*
@ -275,7 +275,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
float rpmMinKeyMinValue = map[xIndex][yIndex];
float rpmMaxKeyMinValue = map[xIndex + 1][yIndex];
float keyMinValue = interpolateMsg("", xMin, rpmMinKeyMinValue, xMax, rpmMaxKeyMinValue, x);
float keyMinValue = interpolateMsg(msg, xMin, rpmMinKeyMinValue, xMax, rpmMaxKeyMinValue, x);
#if DEBUG_INTERPOLATION
if (needInterpolationLogging()) {
@ -290,7 +290,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
float rpmMinKeyMaxValue = map[xIndex][keyMaxIndex];
float rpmMaxKeyMaxValue = map[rpmMaxIndex][keyMaxIndex];
float keyMaxValue = interpolateMsg("3d", xMin, rpmMinKeyMaxValue, xMax, rpmMaxKeyMaxValue, x);
float keyMaxValue = interpolateMsg(msg, xMin, rpmMinKeyMaxValue, xMax, rpmMaxKeyMaxValue, x);
#if DEBUG_INTERPOLATION
if (needInterpolationLogging()) {
@ -303,7 +303,7 @@ float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kT
}
#endif /* DEBUG_INTERPOLATION */
return interpolateMsg("3d", keyMin, keyMinValue, keyMax, keyMaxValue, y);
return interpolateMsg(msg, keyMin, keyMinValue, keyMax, keyMaxValue, y);
}
void setCurveValue(float bins[], float values[], int size, float key, float value);
void initInterpolation(Logging *sharedLogger);

View File

@ -24,7 +24,7 @@ float *map[5] = { map0, map1, map2, map3, map4 };
static float getValue(float rpm, float maf) {
return interpolate3d(rpm, rpmBins, 5, maf, mafBins, 4, map);
return interpolate3d("test", rpm, rpmBins, 5, maf, mafBins, 4, map);
}
static void newTestToComfirmInterpolation() {