Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
#pragma once |
2 |
|
|
|
|
3 |
|
|
|
#include "sensor_converter_func.h" |
4 |
|
|
|
|
5 |
|
|
|
class LinearFunc final : public SensorConverter { |
6 |
|
|
|
public: |
7 |
|
|
29 |
LinearFunc(float divideInput = 1.0f) : m_divideInput(divideInput) {} |
8 |
|
|
|
|
9 |
|
|
|
void configure(float in1, float out1, float in2, float out2, float minOutput, float maxOutput); |
10 |
|
|
|
|
11 |
|
|
|
SensorResult convert(float inputValue) const override; |
12 |
|
|
|
|
13 |
|
|
|
void showInfo(float testRawValue) const override; |
14 |
|
|
|
|
15 |
|
|
70 |
float getDivideInput() const { |
16 |
|
|
70 |
return m_divideInput; |
17 |
|
|
|
} |
18 |
|
|
|
|
19 |
|
|
|
private: |
20 |
|
|
|
// Linear equation parameters for equation of form |
21 |
|
|
|
// y = ax + b |
22 |
|
|
|
float m_a = 1; |
23 |
|
|
|
float m_b = 0; |
24 |
|
|
|
|
25 |
|
|
|
float m_minOutput = 0; |
26 |
|
|
|
float m_maxOutput = 0; |
27 |
|
|
|
|
28 |
|
|
|
// Divisor for the input values - some configurations use a ratio'd value for compat |
29 |
|
|
|
const float m_divideInput; |
30 |
|
|
|
}; |
31 |
|
|
|
|