GCC Code Coverage Report


Directory: ./
File: firmware/controllers/math/closed_loop_fuel_cell.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: -% 0 0 0
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 #pragma once
2
3 #include "sensor.h"
4
5 class ClosedLoopFuelCellBase {
6 public:
7 // Update the cell's internal state - adjusting fuel up/down as appropriate
8 void update(float lambdaDeadband, bool ignoreErrorMagnitude);
9
10 // Get the current adjustment amount, without altering internal state.
11 float getAdjustment() const;
12
13 virtual float getLambdaError() const = 0;
14 protected:
15 // Helpers - virtual for mocking
16 virtual float getMaxAdjustment() const = 0;
17 virtual float getMinAdjustment() const = 0;
18 virtual float getIntegratorGain() const = 0;
19
20 private:
21 // Current fueling adjustment.
22 // 0 = no adjustment.
23 // 0.1 = add 10% fuel.
24 float m_adjustment = 0;
25 };
26
27 struct stft_cell_cfg_s;
28
29 class ClosedLoopFuelCellImpl final : public ClosedLoopFuelCellBase {
30 public:
31 4688 void configure(const stft_cell_cfg_s* configuration, SensorType lambdaSensor) {
32 4688 m_config = configuration;
33 4688 m_lambdaSensor = lambdaSensor;
34 4688 }
35
36 float getLambdaError() const override;
37 private:
38 const stft_cell_cfg_s *m_config = nullptr;
39 SensorType m_lambdaSensor = SensorType::Invalid;
40
41 protected:
42 float getMaxAdjustment() const override;
43 float getMinAdjustment() const override;
44 float getIntegratorGain() const override;
45 };
46