From e0b5352cbe354fe484f956add592f88335fafa09 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 19 Dec 2021 23:23:33 -0500 Subject: [PATCH] 2 byte table axis #3045 --- firmware/util/containers/table_helper.cpp | 24 ----------------------- firmware/util/containers/table_helper.h | 19 +++++++++++++++--- firmware/util/util.mk | 1 - 3 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 firmware/util/containers/table_helper.cpp diff --git a/firmware/util/containers/table_helper.cpp b/firmware/util/containers/table_helper.cpp deleted file mode 100644 index c187492250..0000000000 --- a/firmware/util/containers/table_helper.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @file table_helper.cpp - * @brief Helper methods related to 3D & 2D tables manipulation (maps and curves) - * - * @date Jul 6, 2014 - * @author Andrey Belomutskiy, (c) 2012-2020 - */ - -#include "pch.h" - -void setRpmBin(float array[], int size, float idleRpm, float topRpm) { - array[0] = idleRpm - 150; - int rpmStep = (int)(efiRound((topRpm - idleRpm) / (size - 2), 50) - 150); - for (int i = 1; i < size - 1;i++) - array[i] = idleRpm + rpmStep * (i - 1); - array[size - 1] = topRpm; -} - -/** - * initialize RPM table axis using default RPM range - */ -void setRpmTableBin(float array[], int size) { - setRpmBin(array, size, 800, 7000); -} diff --git a/firmware/util/containers/table_helper.h b/firmware/util/containers/table_helper.h index 2d9da8c9c9..303a7d0a9c 100644 --- a/firmware/util/containers/table_helper.h +++ b/firmware/util/containers/table_helper.h @@ -128,8 +128,6 @@ typedef Map3D i typedef Map3D gppwm_Map3D_t; typedef Map3D> mapEstimate_Map3D_t; -void setRpmBin(float array[], int size, float idleRpm, float topRpm); - /** * @param precision for example '0.1' for one digit fractional part. Default to 0.01, two digits. */ @@ -170,4 +168,19 @@ constexpr void copyTable(TDest (&dest)[N][M], const TSource (&source)[N][M], flo } } -void setRpmTableBin(float array[], int size); +template +void setRpmBin(kType array[], int size, float idleRpm, float topRpm) { + array[0] = idleRpm - 150; + int rpmStep = (int)(efiRound((topRpm - idleRpm) / (size - 2), 50) - 150); + for (int i = 1; i < size - 1;i++) + array[i] = idleRpm + rpmStep * (i - 1); + array[size - 1] = topRpm; +} + +/** + * initialize RPM table axis using default RPM range + */ +template +void setRpmTableBin(kType array[], int size) { + setRpmBin(array, size, 800, 7000); +} diff --git a/firmware/util/util.mk b/firmware/util/util.mk index c972d5692e..bf8d1e2885 100644 --- a/firmware/util/util.mk +++ b/firmware/util/util.mk @@ -9,7 +9,6 @@ UTILSRC_CPP = \ $(UTIL_DIR)/histogram.cpp \ $(UTIL_DIR)/containers/listener_array.cpp \ $(UTIL_DIR)/containers/local_version_holder.cpp \ - $(UTIL_DIR)/containers/table_helper.cpp \ $(UTIL_DIR)/math/biquad.cpp \ $(UTIL_DIR)/math/error_accumulator.cpp \ $(UTIL_DIR)/math/pid.cpp \