diff --git a/firmware/util/containers/table_helper.h b/firmware/util/containers/table_helper.h index 72f29b7f59..21a5499f83 100644 --- a/firmware/util/containers/table_helper.h +++ b/firmware/util/containers/table_helper.h @@ -17,7 +17,7 @@ class ValueProvider3D { public: - virtual float getValue(float xRpm, float y) = 0; + virtual float getValue(float xRpm, float y) const = 0; }; @@ -30,7 +30,7 @@ public: explicit Map3D(const char*name); Map3D(const char*name, float multiplier); void init(vType table[RPM_BIN_SIZE][LOAD_BIN_SIZE], const kType loadBins[LOAD_BIN_SIZE], const kType rpmBins[RPM_BIN_SIZE]); - float getValue(float xRpm, float y); + float getValue(float xRpm, float y) const; void setAll(vType value); vType *pointers[LOAD_BIN_SIZE]; private: @@ -97,7 +97,7 @@ void Map3D::init(vType table[RPM_BIN_ } template -float Map3D::getValue(float xRpm, float y) { +float Map3D::getValue(float xRpm, float y) const { efiAssert(CUSTOM_ERR_ASSERT, initialized, "map not initialized", NAN); if (cisnan(y)) { warning(CUSTOM_PARAM_RANGE, "%s: y is NaN", name); diff --git a/firmware/util/math/interpolation.h b/firmware/util/math/interpolation.h index c1375407c9..3322f89bd9 100644 --- a/firmware/util/math/interpolation.h +++ b/firmware/util/math/interpolation.h @@ -102,7 +102,7 @@ int findIndexMsgExt(const char *msg, const kType array[], int size, kType value) * @brief Two-dimensional table lookup with linear interpolation */ template -float interpolate3d(float x, const kType xBin[], int xBinSize, float y, const kType yBin[], int yBinSize, vType* map[]) { +float interpolate3d(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;