Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | template<class ConverterType> | |||
2 | 53 | FunctionalSensorImpl<ConverterType>::FunctionalSensorImpl(const SensorType type, const efidur_t timeoutPeriod) | ||
3 | 53 | : FunctionalSensorBase(type, timeoutPeriod) { | ||
4 | 53 | } | ||
5 | ||||
6 | template<class ConverterType> | |||
7 | 37 | void FunctionalSensorImpl<ConverterType>::setFunction(ConverterType& func) { | ||
8 | 37 | m_function = &func; | ||
9 | 37 | } | ||
10 | ||||
11 | template<class ConverterType> | |||
12 | 2 | ConverterType* FunctionalSensorImpl<ConverterType>::getFunction() const { | ||
13 | 2 | return m_function; | ||
14 | } | |||
15 | ||||
16 | template<class ConverterType> | |||
17 | 2 | float FunctionalSensorImpl<ConverterType>::getRaw() const { | ||
18 | 2 | return m_rawValue; | ||
19 | } | |||
20 | ||||
21 | template<class ConverterType> | |||
22 | 2023 | void FunctionalSensorImpl<ConverterType>::postRawValue(const float inputValue, const efitick_t timestamp) { | ||
23 | // If no function is set, this sensor isn't valid. | |||
24 |
1/4FunctionalSensorImpl<FuelLevelFunc>::postRawValue(float, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
FunctionalSensorImpl<SensorConverter>::postRawValue(float, long):
✗ Branch 0 not taken.
✓ Branch 1 taken 2023 times.
|
1/4FunctionalSensorImpl<FuelLevelFunc>::postRawValue(float, long):
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
FunctionalSensorImpl<SensorConverter>::postRawValue(float, long):
✗ Decision 'true' not taken.
✓ Decision 'false' taken 2023 times.
|
2023 | if (!m_function) { |
25 | ✗ | invalidate(UnexpectedCode::Configuration); | ||
26 | ✗ | return; | ||
27 | } | |||
28 | ||||
29 | 2023 | m_rawValue = inputValue; | ||
30 | ||||
31 | 2023 | auto r = m_function->convert(inputValue); | ||
32 | ||||
33 | // This has to happen so that we set the valid bit after | |||
34 | // the value is stored, to prevent the data race of reading | |||
35 | // an old invalid value | |||
36 |
2/4FunctionalSensorImpl<FuelLevelFunc>::postRawValue(float, long):
✗ Branch 0 not taken.
✗ Branch 1 not taken.
FunctionalSensorImpl<SensorConverter>::postRawValue(float, long):
✓ Branch 0 taken 2014 times.
✓ Branch 1 taken 9 times.
|
2/4FunctionalSensorImpl<FuelLevelFunc>::postRawValue(float, long):
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
FunctionalSensorImpl<SensorConverter>::postRawValue(float, long):
✓ Decision 'true' taken 2014 times.
✓ Decision 'false' taken 9 times.
|
2023 | if (r.Valid) { |
37 | 2014 | setValidValue(r.Value, timestamp); | ||
38 | } else { | |||
39 | 9 | invalidate(r.Code); | ||
40 | } | |||
41 | } | |||
42 |