2 byte table axis #3045

This commit is contained in:
Andrey 2021-12-19 23:23:33 -05:00
parent 3789d570f7
commit e0b5352cbe
3 changed files with 16 additions and 28 deletions

View File

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

View File

@ -128,8 +128,6 @@ typedef Map3D<IAC_PID_MULT_SIZE, IAC_PID_MULT_SIZE, uint8_t, uint8_t, uint8_t> i
typedef Map3D<GPPWM_RPM_COUNT, GPPWM_LOAD_COUNT, uint8_t, uint8_t, uint8_t> gppwm_Map3D_t;
typedef Map3D<FUEL_RPM_COUNT, FUEL_LOAD_COUNT, uint16_t, uint16_t, uint16_t, efi::ratio<1, PACK_MULT_MAP_ESTIMATE>> 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<typename kType>
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<typename kType>
void setRpmTableBin(kType array[], int size) {
setRpmBin(array, size, 800, 7000);
}

View File

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