GCC Code Coverage Report


Directory: ./
File: firmware/controllers/modules/fan_control/fan_control.h
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 24 0 24
Functions: 100.0% 12 0 12
Branches: -% 0 0 0
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 #pragma once
2
3 #include "fan_control_generated.h"
4
5 enum class RadiatorFanState : uint8_t {
6 None, // 0
7 Cranking, // 1
8 EngineStopped, // 2
9 VehicleIsTooFast, // 3
10 BoardStatus, // 4
11 CltBroken, // 5
12 AC, // 6
13 Hot, // 7
14 Cold, // 8
15 Previous, // 9
16 Bench, // 10
17 BoardForcedOn // 11
18 };
19
20 struct FanController : public EngineModule, public fan_control_s {
21 void onSlowCallback() override;
22 void setDefaultConfiguration() override;
23 private:
24 bool getState(bool acActive, bool lastState);
25
26 protected:
27 virtual OutputPin& getPin() = 0;
28 virtual float getFanOnTemp() = 0;
29 virtual float getFanOffTemp() = 0;
30 virtual bool enableWithAc() = 0;
31 virtual bool disableWhenStopped() = 0;
32 virtual int disableAtSpeed() = 0;
33 };
34
35 struct FanControl1 : public FanController {
36 1099 OutputPin& getPin() {
37 1099 return enginePins.fanRelay;
38 }
39
40 1099 float getFanOnTemp() {
41 1099 return engineConfiguration->fanOnTemperature;
42 }
43
44 1099 float getFanOffTemp() {
45 1099 return engineConfiguration->fanOffTemperature;
46 }
47
48 1099 bool enableWithAc() {
49 1099 return engineConfiguration->enableFan1WithAc;
50 }
51
52 1074 bool disableWhenStopped() {
53 1074 return engineConfiguration->disableFan1WhenStopped;
54 }
55
56 1099 int disableAtSpeed() {
57 1099 return engineConfiguration->disableFan1AtSpeed;
58 }
59 };
60
61 struct FanControl2 : public FanController {
62 1085 OutputPin& getPin() {
63 1085 return enginePins.fanRelay2;
64 }
65
66 1085 float getFanOnTemp() {
67 1085 return engineConfiguration->fan2OnTemperature;
68 }
69
70 1085 float getFanOffTemp() {
71 1085 return engineConfiguration->fan2OffTemperature;
72 }
73
74 1085 bool enableWithAc() {
75 1085 return engineConfiguration->enableFan2WithAc;
76 }
77
78 1061 bool disableWhenStopped() {
79 1061 return engineConfiguration->disableFan2WhenStopped;
80 }
81
82 1085 int disableAtSpeed() {
83 1085 return engineConfiguration->disableFan2AtSpeed;
84 }
85 };
86