rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
controllers
sensors
converters
table_func.h
Go to the documentation of this file.
1
/**
2
* @author Matthew Kennedy, (c) 2021
3
*
4
* A function to convert input voltage output value based on a 2d table.
5
*/
6
7
#pragma once
8
9
#include "
sensor_converter_func.h
"
10
#include "
efi_ratio.h
"
11
12
#include <rusefi/interpolation.h>
13
14
template
<
class
TBin,
class
TValue,
int
TSize,
typename
TOutputScale = efi::ratio<1>>
15
class
TableFunc
final :
public
SensorConverter
{
16
public
:
17
TableFunc
(TBin (&bins)[TSize], TValue (&values)[TSize])
18
:
m_bins
(bins)
19
,
m_values
(values)
20
{
21
}
22
23
SensorResult
convert
(
float
inputValue)
const override
{
24
return
interpolate2d(inputValue,
m_bins
,
m_values
) * TOutputScale::asFloat();
25
}
26
27
void
showInfo
(
float
/*testInputValue*/
)
const override
{ }
28
29
private
:
30
TBin (&
m_bins
)[TSize];
31
TValue (&
m_values
)[TSize];
32
};
TableFunc
Definition
table_func.h:15
TableFunc::convert
SensorResult convert(float inputValue) const override
Definition
table_func.h:23
TableFunc::m_bins
TBin(& m_bins)[TSize]
Definition
table_func.h:30
TableFunc::m_values
TValue(& m_values)[TSize]
Definition
table_func.h:31
TableFunc::showInfo
void showInfo(float) const override
Definition
table_func.h:27
TableFunc::TableFunc
TableFunc(TBin(&bins)[TSize], TValue(&values)[TSize])
Definition
table_func.h:17
efi_ratio.h
SensorResult
expected< float > SensorResult
Definition
sensor.h:46
sensor_converter_func.h
SensorConverter
Definition
sensor_converter_func.h:5
Generated on Sat Sep 27 2025 00:10:06 for rusEFI by
1.9.8