| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #include "pch.h" | |||
| 2 | ||||
| 3 | #include "init.h" | |||
| 4 | #include "adc_subscription.h" | |||
| 5 | #include "functional_sensor.h" | |||
| 6 | #include "identity_func.h" | |||
| 7 | ||||
| 8 | // These aux sensors just read voltage - so the converter function has nothing to do | |||
| 9 | ||||
| 10 | static FunctionalSensor auxSensors[] = { | |||
| 11 | { SensorType::AuxAnalog1, MS2NT(50) }, | |||
| 12 | { SensorType::AuxAnalog2, MS2NT(50) }, | |||
| 13 | { SensorType::AuxAnalog3, MS2NT(50) }, | |||
| 14 | { SensorType::AuxAnalog4, MS2NT(50) }, | |||
| 15 | { SensorType::AuxAnalog5, MS2NT(50) }, | |||
| 16 | { SensorType::AuxAnalog6, MS2NT(50) }, | |||
| 17 | { SensorType::AuxAnalog7, MS2NT(50) }, | |||
| 18 | { SensorType::AuxAnalog8, MS2NT(50) }, | |||
| 19 | }; | |||
| 20 | ||||
| 21 | StoredValueSensor luaGauges[] = { | |||
| 22 | { SensorType::LuaGauge1, MS2NT(5000) }, | |||
| 23 | { SensorType::LuaGauge2, MS2NT(5000) }, | |||
| 24 | { SensorType::LuaGauge3, MS2NT(5000) }, | |||
| 25 | { SensorType::LuaGauge4, MS2NT(5000) }, | |||
| 26 | { SensorType::LuaGauge5, MS2NT(5000) }, | |||
| 27 | { SensorType::LuaGauge6, MS2NT(5000) }, | |||
| 28 | { SensorType::LuaGauge7, MS2NT(5000) }, | |||
| 29 | { SensorType::LuaGauge8, MS2NT(5000) }, | |||
| 30 | }; | |||
| 31 | ||||
| 32 | ||||
| 33 | static_assert(efi::size(auxSensors) == LUA_ANALOG_INPUT_COUNT); | |||
| 34 | static_assert(efi::size(luaGauges) == LUA_GAUGE_COUNT); | |||
| 35 | ||||
| 36 | 2 | void initAuxSensors() { | ||
| 37 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 2 taken 2 times.
|
2/2✓ Decision 'true' taken 16 times.
✓ Decision 'false' taken 2 times.
|
18 | for (size_t i = 0; i < efi::size(engineConfiguration->auxAnalogInputs); i++) { |
| 38 | 16 | auto channel = engineConfiguration->auxAnalogInputs[i]; | ||
| 39 | ||||
| 40 | // Skip unconfigured channels | |||
| 41 |
1/2✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
|
1/2✓ Decision 'true' taken 16 times.
✗ Decision 'false' not taken.
|
16 | if (!isAdcChannelValid(channel)) { |
| 42 | 16 | continue; | ||
| 43 | } | |||
| 44 | ||||
| 45 | ✗ | auto& sensor = auxSensors[i]; | ||
| 46 | ✗ | sensor.setFunction(identityFunction); | ||
| 47 | ✗ | sensor.Register(); | ||
| 48 | ||||
| 49 | ✗ | AdcSubscription::SubscribeSensor(sensor, channel, 10); | ||
| 50 | } | |||
| 51 | ||||
| 52 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 2 taken 2 times.
|
2/2✓ Decision 'true' taken 16 times.
✓ Decision 'false' taken 2 times.
|
18 | for (size_t i = 0; i < efi::size(luaGauges); i++) { |
| 53 | 16 | auto& sensor = luaGauges[i]; | ||
| 54 | 16 | sensor.Register(); | ||
| 55 | } | |||
| 56 | 2 | } | ||
| 57 | ||||
| 58 | ✗ | void deinitAuxSensors() { | ||
| 59 | ✗ | for (size_t i = 0; i < efi::size(engineConfiguration->auxAnalogInputs); i++) { | ||
| 60 | ✗ | AdcSubscription::UnsubscribeSensor(auxSensors[i]); | ||
| 61 | ✗ | auxSensors[i].unregister(); | ||
| 62 | } | |||
| 63 | ✗ | } | ||
| 64 |