diff --git a/firmware/util/containers/table_helper.cpp b/firmware/util/containers/table_helper.cpp index 01bb9434cb..1dcfec6aaa 100644 --- a/firmware/util/containers/table_helper.cpp +++ b/firmware/util/containers/table_helper.cpp @@ -10,19 +10,6 @@ #include "efilib.h" #include "interpolation.h" -/** - * @param precision for example '0.1' for one digit fractional part - */ -void setLinearCurve(float array[], int size, float from, float to, float precision) { - for (int i = 0; i < size; i++) { - float value = interpolateMsg("setLinearCurve", 0, from, size - 1, to, i); - /** - * rounded values look nicer, also we want to avoid precision mismatch with Tuner Studio - */ - array[i] = efiRound(value, precision); - } -} - void setRpmBin(float array[], int size, float idleRpm, float topRpm) { array[0] = idleRpm - 150; int rpmStep = (int)(efiRound((topRpm - idleRpm) / (size - 2), 50) - 150); diff --git a/firmware/util/containers/table_helper.h b/firmware/util/containers/table_helper.h index 62b5bfd57b..789cc53ce8 100644 --- a/firmware/util/containers/table_helper.h +++ b/firmware/util/containers/table_helper.h @@ -158,7 +158,21 @@ void setTableBin(float array[], int size, float from, float to); #define setArrayValues(array, size, value) setTableBin(array, size, value, value) -void setLinearCurve(float array[], int size, float from, float to, float precision); +/** + * @param precision for example '0.1' for one digit fractional part + */ +template +void setLinearCurveAny(vType array[], int size, float from, float to, float precision) { + for (int i = 0; i < size; i++) { + float value = interpolateMsg("setLinearCurve", 0, from, size - 1, to, i); + /** + * rounded values look nicer, also we want to avoid precision mismatch with Tuner Studio + */ + array[i] = efiRound(value, precision); + } +} + +#define setLinearCurve setLinearCurveAny void setRpmTableBin(float array[], int size); #endif /* TABLE_HELPER_H_ */