GCC Code Coverage Report


Directory: ./
File: firmware/controllers/math/closed_loop_fuel.h
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 4 0 4
Functions: 100.0% 1 0 1
Branches: 100.0% 2 0 2
Decisions: 100.0% 2 - 2

Line Branch Decision Exec Source
1 // closed_loop_fuel.h
2
3 #pragma once
4
5 #include "closed_loop_fuel_cell.h"
6 #include "deadband.h"
7 #include "short_term_fuel_trim_state_generated.h"
8
9 struct stft_s;
10
11 struct ClosedLoopFuelResult {
12 2247 ClosedLoopFuelResult() {
13 // Default is no correction, aka 1.0 multiplier
14
2/2
✓ Branch 0 taken 4494 times.
✓ Branch 1 taken 2247 times.
2/2
✓ Decision 'true' taken 4494 times.
✓ Decision 'false' taken 2247 times.
6741 for (size_t i = 0; i < FT_BANK_COUNT; i++) {
15 4494 banks[i] = 1.0f;
16 }
17 2247 }
18
19 float banks[FT_BANK_COUNT];
20 };
21
22 struct FuelingBank {
23 ClosedLoopFuelCellImpl cells[STFT_CELL_COUNT];
24 };
25
26 class ShortTermFuelTrim : public EngineModule, public short_term_fuel_trim_state_s {
27 public:
28 void init(stft_s *stftCfg);
29 // EngineModule implementation
30 void onSlowCallback() override;
31 bool needsDelayedShutoff() override;
32
33 ClosedLoopFuelResult getCorrection(float rpm, float fuelLoad);
34
35 #if ! EFI_UNIT_TEST
36 private:
37 #endif
38 FuelingBank banks[FT_BANK_COUNT];
39
40 Deadband<25> idleDeadband;
41 Deadband<2> overrunDeadband;
42 Deadband<2> loadDeadband;
43
44 SensorType getSensorForBankIndex(size_t index);
45 size_t computeStftBin(float rpm, float load, stft_s& cfg);
46 stft_state_e getCorrectionState();
47 stft_state_e getLearningState(SensorType sensor);
48 };
49
50 void initStft(void);
51
52 /* TODO: move out of here */
53 bool checkIfTuningVeNow();
54