custom-board-bundle-sample-.../firmware/controllers/core/table_helper.cpp

30 lines
796 B
C++
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file table_helper.cpp
* @brief Helper methods related to 3D & 2D tables manipulation (maps and curves)
*
* @date Jul 6, 2014
2015-12-31 13:02:30 -08:00
* @author Andrey Belomutskiy, (c) 2012-2016
2015-07-10 06:01:56 -07:00
*/
#include "table_helper.h"
#include "efilib.h"
#include "interpolation.h"
void setTableBin2(float array[], int size, float l, float r, float precision) {
for (int i = 0; i < size; i++) {
2016-01-09 12:01:41 -08:00
float value = interpolateMsg("setTable", 0, l, size - 1, r, i);
2015-07-10 06:01:56 -07:00
/**
* rounded values look nicer, also we want to avoid precision mismatch with Tuner Studio
*/
array[i] = efiRound(value, precision);
}
}
void setTableBin(float array[], int size, float from, float to) {
setTableBin2(array, size, from, to, 0.01);
}
void setRpmTableBin(float array[], int size) {
2016-01-01 16:02:59 -08:00
setTableBin2(array, size, 800, 7000, 100);
2015-07-10 06:01:56 -07:00
}