| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 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 | 3 | TableFunc(TBin (&bins)[TSize], TValue (&values)[TSize]) | ||
| 18 | 3 | : m_bins(bins) | ||
| 19 | 3 | , m_values(values) | ||
| 20 | { | |||
| 21 | 3 | } | ||
| 22 | ||||
| 23 | 7 | SensorResult convert(float inputValue) const override { | ||
| 24 |
2/3TableFunc<scaled_channel<unsigned short, 1000, 1>, unsigned char, 3, efi::ratio<1, 100> >::convert(float) const:
✓ Branch 2 taken 2 times.
TableFunc<float, float, 2, efi::ratio<1, 1> >::convert(float) const:
✓ Branch 2 taken 5 times.
TableFunc<float, float, 32, efi::ratio<1, 1> >::convert(float) const:
✗ Branch 2 not taken.
|
7 | 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 | }; | |||
| 33 |