GCC Code Coverage Report


Directory: ./
File: firmware/controllers/gauges/speedometer.cpp
Date: 2025-10-24 14:26:41
Coverage Exec Excl Total
Lines: 46.7% 7 0 15
Functions: 100.0% 2 0 2
Branches: 33.3% 2 0 6
Decisions: 33.3% 2 - 6

Line Branch Decision Exec Source
1 #include "pch.h"
2
3 #include "speedometer.h"
4
5 static SimplePwm speedoPwm("speedo");
6
7 static bool hasSpeedoInit = false;
8
9 1101 void speedoUpdate() {
10
1/2
✓ Branch 0 taken 1101 times.
✗ Branch 1 not taken.
1/2
✓ Decision 'true' taken 1101 times.
✗ Decision 'false' not taken.
1101 if (!hasSpeedoInit) {
11 1101 return;
12 }
13
14 float kph = Sensor::getOrZero(SensorType::VehicleSpeed);
15 float kps = kph * (1. / 3600);
16 float freq = kps * engineConfiguration->speedometerPulsePerKm;
17
18 if (freq < 1) {
19 freq = NAN;
20 }
21
22 speedoPwm.setFrequency(freq);
23 }
24
25 585 void initSpeedometer() {
26 585 hasSpeedoInit = false;
27
28
1/2
✓ Branch 1 taken 585 times.
✗ Branch 2 not taken.
1/2
✓ Decision 'true' taken 585 times.
✗ Decision 'false' not taken.
585 if (!isBrainPinValid(engineConfiguration->speedometerOutputPin)) {
29 585 return;
30 }
31
32 startSimplePwm(&speedoPwm,
33 "Speedometer",
34 &engine->scheduler,
35 &enginePins.speedoOut,
36 NAN, 0.5f);
37
38 hasSpeedoInit = true;
39 }
40