| 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 | 181637 | ClosedLoopFuelResult() { | ||
| 13 | // Default is no correction, aka 1.0 multiplier | |||
| 14 |
2/2✓ Branch 0 taken 363274 times.
✓ Branch 1 taken 181637 times.
|
2/2✓ Decision 'true' taken 363274 times.
✓ Decision 'false' taken 181637 times.
|
544911 | for (size_t i = 0; i < FT_BANK_COUNT; i++) { |
| 15 | 363274 | banks[i] = 1.0f; | ||
| 16 | } | |||
| 17 | 181637 | region = ftRegionIdle; | ||
| 18 | 181637 | } | ||
| 19 | ||||
| 20 | float banks[FT_BANK_COUNT]; | |||
| 21 | ft_region_e region; | |||
| 22 | }; | |||
| 23 | ||||
| 24 | struct FuelingBank { | |||
| 25 | ClosedLoopFuelCellImpl cells[STFT_CELL_COUNT]; | |||
| 26 | }; | |||
| 27 | ||||
| 28 | class ShortTermFuelTrim : public EngineModule, public short_term_fuel_trim_state_s { | |||
| 29 | public: | |||
| 30 | void init(stft_s *stftCfg); | |||
| 31 | // EngineModule implementation | |||
| 32 | void onSlowCallback() override; | |||
| 33 | bool needsDelayedShutoff() override; | |||
| 34 | ||||
| 35 | ClosedLoopFuelResult getCorrection(float rpm, float fuelLoad); | |||
| 36 | ||||
| 37 | #if ! EFI_UNIT_TEST | |||
| 38 | private: | |||
| 39 | #endif | |||
| 40 | FuelingBank banks[FT_BANK_COUNT]; | |||
| 41 | ||||
| 42 | Deadband<25> idleDeadband; | |||
| 43 | Deadband<2> overrunDeadband; | |||
| 44 | Deadband<2> loadDeadband; | |||
| 45 | ||||
| 46 | SensorType getSensorForBankIndex(size_t index); | |||
| 47 | ft_region_e computeStftBin(float rpm, float load, stft_s& cfg); | |||
| 48 | stft_state_e getCorrectionState(); | |||
| 49 | stft_state_e getLearningState(SensorType sensor); | |||
| 50 | }; | |||
| 51 | ||||
| 52 | void initStft(void); | |||
| 53 | ||||
| 54 | /* TODO: move out of here */ | |||
| 55 | bool checkIfTuningVeNow(); | |||
| 56 |