GCC Code Coverage Report


Directory: ./
File: firmware/controllers/sensors/impl/maf.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 91.8% 45 0 49
Functions: 83.3% 5 0 6
Branches: 100.0% 2 0 2
Decisions: 100.0% 2 - 2

Line Branch Decision Exec Source
1 #include "pch.h"
2
3 16504 static int addMafPoint(int index, float kgHrValue, float voltage) {
4 16504 config->mafDecoding[index] = kgHrValue;
5 16504 config->mafDecodingBins[index] = voltage;
6 16504 return index + 1;
7 }
8
9 51 static int addMafPointByVoltage(int index, float voltage, float kgHrValue) {
10 51 return addMafPoint(index, kgHrValue, voltage);
11 }
12
13 589 static void fillTheRest(int i) {
14 /**
15 * unrealistic values just to make binary search happy
16 */
17
2/2
✓ Branch 0 taken 15281 times.
✓ Branch 1 taken 589 times.
2/2
✓ Decision 'true' taken 15281 times.
✓ Decision 'false' taken 589 times.
15870 while (i < MAF_DECODING_COUNT) {
18 15281 i = addMafPoint(i, 3000, 2010 + i);
19 }
20 589 }
21
22 /**
23 * Hot-film air-mass meter, Type HFM 5
24 */
25 586 void setBosch0280218037() {
26 586 int i = 0;
27 586 i = addMafPoint(i, -34.5, 0);
28 586 i = addMafPoint(i, -6, 0.78125);
29
30 586 config->mafDecoding[i] = 10.5;
31 586 config->mafDecodingBins[i++] = 1.38671875;
32
33 586 config->mafDecoding[i] = 105.3;
34 586 config->mafDecodingBins[i++] = 2.91015625;
35
36 586 config->mafDecoding[i] = 387.5;
37 586 config->mafDecodingBins[i++] = 4.2578125;
38
39 586 config->mafDecoding[i] = 738;
40 586 config->mafDecodingBins[i++] = 4.98046875;
41
42 586 fillTheRest(i);
43 586 }
44
45 void setBosch0280218004() {
46 int i = 0;
47
48 fillTheRest(i);
49 }
50
51 3 void setNissanMAF0031() {
52 3 int i = 0;
53 // I am copy-pasting from a spreadsheet, it works better if voltage goes first
54 3 i = addMafPointByVoltage(i, 0.29, 3.1768838175);
55 3 i = addMafPointByVoltage(i, 0.49, 3.6987752861);
56 3 i = addMafPointByVoltage(i, 0.72, 5.8013108424);
57 3 i = addMafPointByVoltage(i, 1, 11.1849);
58 3 i = addMafPointByVoltage(i, 1.37, 24.5646673361);
59 3 i = addMafPointByVoltage(i, 1.66, 41.453048941);
60 3 i = addMafPointByVoltage(i, 1.91, 61.5847903829);
61 3 i = addMafPointByVoltage(i, 2.09, 79.7924502089);
62 3 i = addMafPointByVoltage(i, 2.34, 110.961012317);
63 3 i = addMafPointByVoltage(i, 2.89, 208.198652496);
64 3 i = addMafPointByVoltage(i, 3.11, 260.1030585044);
65 3 i = addMafPointByVoltage(i, 3.54, 387.150427974);
66 3 i = addMafPointByVoltage(i, 3.81, 486.5363959026);
67 3 i = addMafPointByVoltage(i, 4, 566.628);
68 3 i = addMafPointByVoltage(i, 4.32, 722.3485684449);
69 3 i = addMafPointByVoltage(i, 4.65, 913.0847954331);
70 3 i = addMafPointByVoltage(i, 4.98, 1137.8746972553);
71 3 fillTheRest(i);
72 3 }
73