GCC Code Coverage Report


Directory: ./
File: firmware/controllers/sensors/sensor_info_printing.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 0.0% 0 0 59
Functions: 0.0% 0 0 16
Branches: 0.0% 0 0 8
Decisions: 0.0% 0 - 2

Line Branch Decision Exec Source
1 #include "pch.h"
2 #include "stored_value_sensor.h"
3 #include "proxy_sensor.h"
4 #include "functional_sensor.h"
5 #include "fuel_level_sensor.h"
6 #include "redundant_sensor.h"
7 #include "redundant_ford_tps.h"
8 #include "fallback_sensor.h"
9 #include "frequency_sensor.h"
10 #include "Lps25Sensor.h"
11 #include "linear_func.h"
12 #include "resistance_func.h"
13 #include "thermistor_func.h"
14 #include "identity_func.h"
15 #include "map_averaging.h"
16
17 void StoredValueSensor::showInfo(const char* sensorName) const {
18 const auto value = get();
19 efiPrintf("StoredValue Sensor \"%s\": valid: %s, value: %.2f", sensorName, boolToString(value.Valid), value.Value);
20 }
21
22 void ProxySensor::showInfo(const char* sensorName) const {
23 efiPrintf("Sensor \"%s\" proxied from sensor \"%s\"", sensorName, getSensorName(m_proxiedSensor));
24 }
25
26 void FunctionalSensor::showInfo(const char* sensorName) const {
27 const auto value = get();
28 efiPrintf("Sensor \"%s\": Raw value: %.2f Valid: %s Converted value %.2f", sensorName, getRaw(), boolToString(value.Valid), value.Value);
29
30 // now print out the underlying function's info
31 if (auto func = getFunction()) {
32 func->showInfo(getRaw());
33 }
34 }
35
36 void FuelLevelSensor::showInfo(const char* sensorName) const {
37 const auto value = get();
38 efiPrintf("Sensor \"%s\": Raw value: %.2f Valid: %s Converted value %.2f", sensorName, getRaw(), boolToString(value.Valid), value.Value);
39 }
40
41 #if EFI_CAN_SUPPORT || EFI_UNIT_TEST
42 #include "can_sensor.h"
43
44 void CanSensorBase::showInfo(const char* sensorName) const {
45 const auto value = get();
46 efiPrintf("CAN Sensor \"%s\": valid: %s value: %.2f", sensorName, boolToString(value.Valid), value.Value);
47 }
48 #endif // EFI_CAN_SUPPORT
49
50 void RedundantSensor::showInfo(const char* sensorName) const {
51 efiPrintf("Sensor \"%s\" is redundant combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
52 }
53
54 void FrequencySensor::showInfo(const char* sensorName) const {
55 efiPrintf("FrequencySensor \"%s\" counter %d", sensorName, eventCounter);
56 }
57
58 void RedundantFordTps::showInfo(const char* sensorName) const {
59 efiPrintf("Sensor \"%s\" is Ford-type redundant TPS combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
60 }
61
62 void FallbackSensor::showInfo(const char* sensorName) const {
63 efiPrintf("Sensor \"%s\" is fallback sensor with primary \"%s\" and fallback \"%s\"", sensorName, getSensorName(m_primary), getSensorName(m_fallback));
64 }
65
66 void RpmCalculator::showInfo(const char* /*sensorName*/) const {
67 #if EFI_SHAFT_POSITION_INPUT
68 efiPrintf("RPM sensor: stopped: %d spinning up: %d cranking: %d running: %d rpm: %f",
69 isStopped(),
70 isSpinningUp(),
71 isCranking(),
72 isRunning(),
73 get().value_or(0)
74 );
75 #endif // EFI_SHAFT_POSITION_INPUT
76 }
77
78 void Lps25Sensor::showInfo(const char* sensorName) const {
79 efiPrintf("%s: LPS25 baro %.2f kPa", sensorName, get().Value);
80 }
81
82 void MapAverager::showInfo(const char* sensorName) const {
83 const auto value = get();
84 efiPrintf("Sensor \"%s\" is MAP averager: valid: %s value: %.2f averaged sample count: %d", sensorName, boolToString(value.Valid), value.Value, m_lastCounter);
85 }
86
87 void LinearFunc::showInfo(float testRawValue) const {
88 efiPrintf(" Linear function slope: %.2f offset: %.2f min: %.1f max: %.1f", m_a, m_b, m_minOutput, m_maxOutput);
89 const auto value = convert(testRawValue);
90 efiPrintf(" raw value %.2f converts to %.2f valid: %s", testRawValue, value.Value, boolToString(value.Valid));
91 }
92
93 void ResistanceFunc::showInfo(float testInputValue) const {
94 const auto result = convert(testInputValue);
95 efiPrintf(" %.2f volts -> %.1f ohms with supply voltage %.2f and pullup %.1f.", testInputValue, result.Value, m_supplyVoltage, m_pullupResistor);
96 }
97
98 void ThermistorFunc::showInfo(float testInputValue) const {
99 const auto value = convert(testInputValue);
100 efiPrintf(" %.1f ohms -> valid: %s. %.1f deg C", testInputValue, boolToString(value.Valid), value.Value);
101 }
102
103 void IdentityFunction::showInfo(float /*testInputValue*/) const {
104 efiPrintf(" Identity function passes along value.");
105 }
106