GCC Code Coverage Report


Directory: ./
File: firmware/init/sensor/init_range.cpp
Date: 2025-11-16 14:52:24
Coverage Exec Excl Total
Lines: 54.5% 6 0 11
Functions: 100.0% 1 0 1
Branches: 75.0% 3 0 4
Decisions: 75.0% 3 - 4

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 "resistance_func.h"
7
8 #if EFI_TCU
9
10 // These aux sensors just read voltage - so the converter function has nothing to do
11
12 static FunctionalSensor rangeSensors[] = {
13 { SensorType::RangeInput1, MS2NT(50) },
14 { SensorType::RangeInput2, MS2NT(50) },
15 { SensorType::RangeInput3, MS2NT(50) },
16 { SensorType::RangeInput4, MS2NT(50) },
17 { SensorType::RangeInput5, MS2NT(50) },
18 { SensorType::RangeInput6, MS2NT(50) },
19 };
20
21 static ResistanceFunc rangeFuncs[RANGE_INPUT_COUNT];
22
23 static_assert(efi::size(rangeSensors) == RANGE_INPUT_COUNT);
24
25 2 void initRangeSensors() {
26
2/2
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2 times.
2/2
✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 2 times.
14 for (size_t i = 0; i < efi::size(engineConfiguration->tcu_rangeAnalogInput); i++) {
27 12 auto channel = engineConfiguration->tcu_rangeAnalogInput[i];
28
29 // Skip unconfigured channels
30
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
1/2
✓ Decision 'true' taken 12 times.
✗ Decision 'false' not taken.
12 if (!isAdcChannelValid(channel)) {
31 12 continue;
32 }
33
34 rangeFuncs[i].configure(5.0f, engineConfiguration->tcu_rangeSensorBiasResistor, engineConfiguration->tcu_rangeSensorPulldown);
35
36 auto& sensor = rangeSensors[i];
37 sensor.setFunction(rangeFuncs[i]);
38 sensor.Register();
39
40 AdcSubscription::SubscribeSensor(sensor, channel, 10);
41 }
42 2 }
43
44 #endif
45