Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
// |
2 |
|
|
|
// Created by kifir on 11/18/24. |
3 |
|
|
|
// |
4 |
|
|
|
|
5 |
|
|
|
#pragma once |
6 |
|
|
|
|
7 |
|
|
|
#include "batt_lag_corr_curve.h" |
8 |
|
|
|
|
9 |
|
|
|
class EngineConfig { |
10 |
|
|
|
public: |
11 |
|
|
|
EngineConfig clone() const; |
12 |
|
|
|
|
13 |
|
|
|
// Other Sensor Inputs |
14 |
|
|
129 |
std::optional<switch_input_pin_e> getClutchDownPin() const { return m_clutchDownPin; } |
15 |
|
|
129 |
std::optional<pin_input_mode_e> getClutchDownPinMode() const { return m_clutchDownPinMode; } |
16 |
|
|
129 |
std::optional<switch_input_pin_e> getClutchUpPin() const { return m_clutchUpPin; } |
17 |
|
|
129 |
std::optional<pin_input_mode_e> getClutchUpPinMode() const { return m_clutchUpPinMode; } |
18 |
|
|
|
|
19 |
|
|
|
// Launch Control |
20 |
|
|
129 |
std::optional<switch_input_pin_e> getLaunchActivatePin() const { return m_launchActivatePin; } |
21 |
|
|
129 |
std::optional<pin_input_mode_e> getLaunchActivatePinMode() const { return m_launchActivatePinMode; } |
22 |
|
|
129 |
std::optional<bool> getLaunchControlEnabled() const { return m_launchControlEnabled; } |
23 |
|
|
|
|
24 |
|
|
129 |
std::optional<int> getLaunchRpm() const { return m_launchRpm; } |
25 |
|
|
129 |
std::optional<int> getLaunchRpmWindow() const { return m_launchRpmWindow; } |
26 |
|
|
129 |
std::optional<int> getLaunchCorrectionsEndRpm() const { return m_launchCorrectionsEndRpm; } |
27 |
|
|
|
|
28 |
|
|
129 |
std::optional<bool> getIgnitionRetardEnable() const { return m_ignitionRetardEnable; } |
29 |
|
|
129 |
std::optional<float> getIgnitionRetard() const { return m_ignitionRetard; } |
30 |
|
|
129 |
std::optional<bool> getSmoothRetardMode() const { return m_smoothRetardMode; } |
31 |
|
|
|
|
32 |
|
|
129 |
std::optional<bool> getEnableIgnitionCut() const { return m_enableIgnitionCut; } |
33 |
|
|
129 |
std::optional<int> getInitialIgnitionCut() const { return m_initialIgnitionCut; } |
34 |
|
|
129 |
std::optional<int> getFinalIgnitionCutBeforeLaunch() const { return m_finalIgnitionCutBeforeLaunch; } |
35 |
|
|
|
|
36 |
|
|
|
// Shift Torque Reduction (Flat Shift) |
37 |
|
|
129 |
std::optional<bool> getTorqueReductionEnabled() const { return m_isTorqueReductionEnabled; } |
38 |
|
|
129 |
std::optional<torqueReductionActivationMode_e> getTorqueReductionActivationMode() const { |
39 |
|
|
129 |
return m_torqueReductionActivationMode; |
40 |
|
|
|
} |
41 |
|
|
129 |
std::optional<switch_input_pin_e> getTorqueReductionTriggerPin() const { return m_torqueReductionTriggerPin; } |
42 |
|
|
129 |
std::optional<pin_input_mode_e> getTorqueReductionTriggerPinMode() const { return m_torqueReductionTriggerPinMode; } |
43 |
|
|
129 |
std::optional<bool> getLimitTorqueReductionTime() const { return m_limitTorqueReductionTime; } |
44 |
|
|
129 |
std::optional<float> getTorqueReductionTime() const { return m_torqueReductionTime; } |
45 |
|
|
129 |
std::optional<float> getTorqueReductionArmingRpm() const { return m_torqueReductionArmingRpm; } |
46 |
|
|
129 |
std::optional<float> getTorqueReductionArmingApp() const { return m_torqueReductionArmingApp; } |
47 |
|
|
129 |
std::optional<int8_t> getTorqueReductionIgnitionCut() const { return m_torqueReductionIgnitionCut; } |
48 |
|
|
129 |
std::optional<float> getTorqueReductionIgnitionRetard() const { return m_torqueReductionIgnitionRetard; } |
49 |
|
|
|
|
50 |
|
|
129 |
std::optional<fuel_pressure_sensor_mode_e> getFuelPressureSensorMode() const { return m_fuelPressureSensorMode; }; |
51 |
|
|
|
|
52 |
|
|
|
// Injector |
53 |
|
|
129 |
std::optional<float> getInjectorFlow() const { return m_injectorFlow; } |
54 |
|
|
129 |
std::optional<BattLagCorrTable> getInjectorBattLagCorr() const { return m_injectorBattLagCorrCurve; } |
55 |
|
|
129 |
std::optional<bool> getInjectorFlowAsMassFlow() const { return m_injectorFlowAsMassFlow; } |
56 |
|
|
129 |
std::optional<float> getFuelReferencePressure() const { return m_fuelReferencePressure; } |
57 |
|
|
129 |
std::optional<injector_compensation_mode_e> getInjectorCompensationMode() const { return m_injectorCompensationMode; } |
58 |
|
|
|
|
59 |
|
|
|
// Secondary injector |
60 |
|
|
129 |
std::optional<float> getInjectorSecondaryFlow() const { return m_injectorSecondaryFlow; } |
61 |
|
|
129 |
std::optional<BattLagCorrTable> getInjectorSecondaryBattLagCorr() const { return m_injectorSecondaryBattLagCorrCurve; } |
62 |
|
|
129 |
std::optional<float> getSecondaryInjectorFuelReferencePressure() const { return m_secondaryInjectorFuelReferencePressure; } |
63 |
|
|
129 |
std::optional<injector_compensation_mode_e> getSecondaryInjectorCompensationMode() const { return m_secondaryInjectorCompensationMode; } |
64 |
|
|
|
|
65 |
|
|
|
// Staged injection |
66 |
|
|
129 |
std::optional<bool> getStagedInjectionEnabled() const { return m_isStagedInjectionEnabled; } |
67 |
|
|
|
|
68 |
|
|
|
// Nitrous control |
69 |
|
|
129 |
std::optional<bool> getNitrousControlEnabled() const { return m_nitrousControlEnabled; } |
70 |
|
|
129 |
std::optional<nitrous_arming_method_e> getNitrousControlArmingMethod() const { return m_nitrousControlArmingMethod; } |
71 |
|
|
129 |
std::optional<switch_input_pin_e> getNitrousControlTriggerPin() const { return m_nitrousControlTriggerPin; } |
72 |
|
|
258 |
std::optional<pin_input_mode_e> getNitrousControlTriggerPinMode() const { return m_nitrousControlTriggerPinMode; } |
73 |
|
|
129 |
std::optional<lua_gauge_e> getNitrousLuaGauge() const { return m_nitrousLuaGauge; } |
74 |
|
|
129 |
std::optional<lua_gauge_meaning_e> getNitrousLuaGaugeMeaning() const { return m_nitrousLuaGaugeMeaning; } |
75 |
|
|
129 |
std::optional<float> getNitrousLuaGaugeArmingValue() const { return m_nitrousLuaGaugeArmingValue; } |
76 |
|
|
|
|
77 |
|
|
129 |
std::optional<uint16_t> getNitrousMinimumVehicleSpeed() const { return m_nitrousMinimumVehicleSpeed; } |
78 |
|
|
129 |
std::optional<int> getNitrousMinimumTps() const { return m_nitrousMinimumTps; } |
79 |
|
|
129 |
std::optional<uint8_t> getNitrousMinimumClt() const { return m_nitrousMinimumClt; } |
80 |
|
|
129 |
std::optional<uint16_t> getNitrousMaximumMap() const { return m_nitrousMaximumMap; } |
81 |
|
|
129 |
std::optional<float> getNitrousMaximumAfr() const { return m_nitrousMaximumAfr; } |
82 |
|
|
129 |
std::optional<uint16_t> getNitrousActivationRpm() const { return m_nitrousActivationRpm; } |
83 |
|
|
129 |
std::optional<uint16_t> getNitrousDeactivationRpm() const { return m_nitrousDeactivationRpm; } |
84 |
|
|
129 |
std::optional<uint16_t> getNitrousDeactivationRpmWindow() const { return m_nitrousDeactivationRpmWindow; } |
85 |
|
|
129 |
std::optional<int8_t> getNitrousFuelAdderPercent() const { return m_nitrousFuelAdderPercent; } |
86 |
|
|
129 |
std::optional<float> getNitrousIgnitionRetard() const { return m_nitrousIgnitionRetard; } |
87 |
|
|
|
|
88 |
|
|
129 |
std::optional<float> getFuelLevelAveragingAlpha() const { return m_fuelLevelAveragingAlpha; } |
89 |
|
|
129 |
std::optional<float> getFuelLevelUpdatePeriodSec() const { return m_fuelLevelUpdatePeriodSec; } |
90 |
|
|
129 |
std::optional<float> getFuelLevelLowThresholdVoltage() const { return m_fuelLevelLowThresholdVoltage; } |
91 |
|
|
129 |
std::optional<float> getFuelLevelHighThresholdVoltage() const { return m_fuelLevelHighThresholdVoltage; } |
92 |
|
|
|
|
93 |
|
|
|
// We do not core about performance in tests, but we want to use builder-like style, so setters return new instance |
94 |
|
|
|
// of configuration: |
95 |
|
|
|
|
96 |
|
|
|
// Other Sensor Inputs |
97 |
|
|
|
EngineConfig setClutchDownPin(std::optional<switch_input_pin_e> value); |
98 |
|
|
|
EngineConfig setClutchDownPinMode(const std::optional<pin_input_mode_e> value); |
99 |
|
|
|
EngineConfig setClutchUpPin(std::optional<switch_input_pin_e> value); |
100 |
|
|
|
EngineConfig setClutchUpPinMode(std::optional<pin_input_mode_e> value); |
101 |
|
|
|
|
102 |
|
|
|
// Launch Control |
103 |
|
|
|
EngineConfig setLaunchActivatePin(std::optional<switch_input_pin_e> value); |
104 |
|
|
|
EngineConfig setLaunchActivatePinMode(const std::optional<pin_input_mode_e> value); |
105 |
|
|
|
EngineConfig setLaunchControlEnabled(std::optional<bool> value); |
106 |
|
|
|
EngineConfig setLaunchRpm(std::optional<int> value); |
107 |
|
|
|
EngineConfig setLaunchRpmWindow(std::optional<int> value); |
108 |
|
|
|
EngineConfig setLaunchCorrectionsEndRpm(std::optional<int> value); |
109 |
|
|
|
EngineConfig setIgnitionRetardEnable(std::optional<bool> value); |
110 |
|
|
|
EngineConfig setIgnitionRetard(std::optional<float> value); |
111 |
|
|
|
EngineConfig setSmoothRetardMode(std::optional<bool> value); |
112 |
|
|
|
EngineConfig setEnableIgnitionCut(std::optional<bool> value); |
113 |
|
|
|
EngineConfig setInitialIgnitionCut(std::optional<int> value); |
114 |
|
|
|
EngineConfig setFinalIgnitionCutBeforeLaunch(std::optional<int> value); |
115 |
|
|
|
|
116 |
|
|
|
// Shift Torque Reduction (Flat Shift) |
117 |
|
|
|
EngineConfig setTorqueReductionEnabled(std::optional<bool> value); |
118 |
|
|
|
EngineConfig setTorqueReductionActivationMode(std::optional<torqueReductionActivationMode_e> value); |
119 |
|
|
|
EngineConfig setTorqueReductionTriggerPin(std::optional<switch_input_pin_e> value); |
120 |
|
|
|
EngineConfig setTorqueReductionTriggerPinMode(std::optional<pin_input_mode_e> value); |
121 |
|
|
|
EngineConfig setLimitTorqueReductionTime(std::optional<bool> value); |
122 |
|
|
|
EngineConfig setTorqueReductionTime(std::optional<float> value); |
123 |
|
|
|
EngineConfig setTorqueReductionArmingRpm(std::optional<float> value); |
124 |
|
|
|
EngineConfig setTorqueReductionArmingApp(std::optional<float> value); |
125 |
|
|
|
EngineConfig setTorqueReductionIgnitionCut(std::optional<int8_t> value); |
126 |
|
|
|
EngineConfig setTorqueReductionIgnitionRetard(std::optional<float> value); |
127 |
|
|
|
|
128 |
|
|
|
EngineConfig setFuelPressureSensorMode(std::optional<fuel_pressure_sensor_mode_e> value); |
129 |
|
|
|
|
130 |
|
|
|
// Injector |
131 |
|
|
|
EngineConfig setInjectorFlowAsMassFlow(std::optional<bool> injectorFlowAsMassFlow); |
132 |
|
|
|
EngineConfig setInjectorFlow(std::optional<float> flow); |
133 |
|
|
|
EngineConfig setInjectorBattLagCorr(std::optional<BattLagCorrTable> battLagCorr); |
134 |
|
|
|
EngineConfig setFuelReferencePressure(std::optional<float> value); |
135 |
|
|
|
EngineConfig setInjectorCompensationMode(std::optional<injector_compensation_mode_e> value); |
136 |
|
|
|
|
137 |
|
|
|
// Secondary injector |
138 |
|
|
|
EngineConfig setInjectorSecondaryFlow(std::optional<float> flow); |
139 |
|
|
|
EngineConfig setInjectorSecondaryBattLagCorr(std::optional<BattLagCorrTable> battLagCorr); |
140 |
|
|
|
EngineConfig setSecondaryInjectorFuelReferencePressure(std::optional<float> value); |
141 |
|
|
|
EngineConfig setSecondaryInjectorCompensationMode(std::optional<injector_compensation_mode_e> value); |
142 |
|
|
|
|
143 |
|
|
|
// Staged injection |
144 |
|
|
|
EngineConfig setStagedInjectionEnabled(std::optional<bool> value); |
145 |
|
|
|
|
146 |
|
|
|
// Nitrous control |
147 |
|
|
|
EngineConfig setNitrousControlEnabled(std::optional<bool> value); |
148 |
|
|
|
EngineConfig setNitrousControlArmingMethod(std::optional<nitrous_arming_method_e> value); |
149 |
|
|
|
EngineConfig setNitrousControlTriggerPin(std::optional<switch_input_pin_e> value); |
150 |
|
|
|
EngineConfig setNitrousControlTriggerPinMode(std::optional<pin_input_mode_e> value); |
151 |
|
|
|
EngineConfig setNitrousLuaGauge(std::optional<lua_gauge_e> value); |
152 |
|
|
|
EngineConfig setNitrousLuaGaugeMeaning(std::optional<lua_gauge_meaning_e> value); |
153 |
|
|
|
EngineConfig setNitrousLuaGaugeArmingValue(std::optional<float> value); |
154 |
|
|
|
|
155 |
|
|
|
EngineConfig setNitrousMinimumVehicleSpeed(std::optional<uint16_t> value); |
156 |
|
|
|
EngineConfig setNitrousMinimumTps(std::optional<int> value); |
157 |
|
|
|
EngineConfig setNitrousMinimumClt(std::optional<uint8_t> value); |
158 |
|
|
|
EngineConfig setNitrousMaximumMap(std::optional<uint16_t> value); |
159 |
|
|
|
EngineConfig setNitrousMaximumAfr(std::optional<float> value); |
160 |
|
|
|
EngineConfig setNitrousActivationRpm(std::optional<uint16_t> value); |
161 |
|
|
|
EngineConfig setNitrousDeactivationRpm(std::optional<uint16_t> value); |
162 |
|
|
|
EngineConfig setNitrousDeactivationRpmWindow(std::optional<uint16_t> value); |
163 |
|
|
|
EngineConfig setNitrousFuelAdderPercent(std::optional<int8_t> value); |
164 |
|
|
|
EngineConfig setNitrousIgnitionRetard(std::optional<float> value); |
165 |
|
|
|
|
166 |
|
|
|
EngineConfig setFuelLevelAveragingAlpha(std::optional<float> value); |
167 |
|
|
|
EngineConfig setFuelLevelUpdatePeriodSec(std::optional<float> value); |
168 |
|
|
|
EngineConfig setFuelLevelLowThresholdVoltage(std::optional<float> value); |
169 |
|
|
|
EngineConfig setFuelLevelHighThresholdVoltage(std::optional<float> value); |
170 |
|
|
|
private: |
171 |
|
|
|
// Other Sensor Inputs |
172 |
|
|
|
std::optional<switch_input_pin_e> m_clutchDownPin; |
173 |
|
|
|
std::optional<pin_input_mode_e> m_clutchDownPinMode; |
174 |
|
|
|
std::optional<switch_input_pin_e> m_clutchUpPin; |
175 |
|
|
|
std::optional<pin_input_mode_e> m_clutchUpPinMode; |
176 |
|
|
|
|
177 |
|
|
|
// Launch Control |
178 |
|
|
|
std::optional<switch_input_pin_e> m_launchActivatePin; |
179 |
|
|
|
std::optional<pin_input_mode_e> m_launchActivatePinMode; |
180 |
|
|
|
std::optional<bool> m_launchControlEnabled; |
181 |
|
|
|
std::optional<int> m_launchRpm; |
182 |
|
|
|
std::optional<int> m_launchRpmWindow; |
183 |
|
|
|
std::optional<int> m_launchCorrectionsEndRpm; |
184 |
|
|
|
std::optional<bool> m_ignitionRetardEnable; |
185 |
|
|
|
std::optional<float> m_ignitionRetard; |
186 |
|
|
|
std::optional<bool> m_smoothRetardMode; |
187 |
|
|
|
std::optional<bool> m_enableIgnitionCut; |
188 |
|
|
|
std::optional<int> m_initialIgnitionCut; |
189 |
|
|
|
std::optional<int> m_finalIgnitionCutBeforeLaunch; |
190 |
|
|
|
|
191 |
|
|
|
// Shift Torque Reduction (Flat Shift) |
192 |
|
|
|
std::optional<bool> m_isTorqueReductionEnabled; |
193 |
|
|
|
std::optional<torqueReductionActivationMode_e> m_torqueReductionActivationMode; |
194 |
|
|
|
std::optional<switch_input_pin_e> m_torqueReductionTriggerPin; |
195 |
|
|
|
std::optional<pin_input_mode_e> m_torqueReductionTriggerPinMode; |
196 |
|
|
|
std::optional<bool> m_limitTorqueReductionTime; |
197 |
|
|
|
std::optional<float> m_torqueReductionTime; |
198 |
|
|
|
std::optional<float> m_torqueReductionArmingRpm; |
199 |
|
|
|
std::optional<float> m_torqueReductionArmingApp; |
200 |
|
|
|
std::optional<int8_t> m_torqueReductionIgnitionCut; |
201 |
|
|
|
std::optional<float> m_torqueReductionIgnitionRetard; |
202 |
|
|
|
|
203 |
|
|
|
std::optional<fuel_pressure_sensor_mode_e> m_fuelPressureSensorMode; |
204 |
|
|
|
|
205 |
|
|
|
// Injector |
206 |
|
|
|
std::optional<float> m_injectorFlow; |
207 |
|
|
|
std::optional<BattLagCorrTable> m_injectorBattLagCorrCurve; |
208 |
|
|
|
std::optional<bool> m_injectorFlowAsMassFlow;; |
209 |
|
|
|
std::optional<float> m_fuelReferencePressure; |
210 |
|
|
|
std::optional<injector_compensation_mode_e> m_injectorCompensationMode; |
211 |
|
|
|
|
212 |
|
|
|
// Secondary injector |
213 |
|
|
|
std::optional<float> m_injectorSecondaryFlow; |
214 |
|
|
|
std::optional<BattLagCorrTable> m_injectorSecondaryBattLagCorrCurve; |
215 |
|
|
|
std::optional<float> m_secondaryInjectorFuelReferencePressure; |
216 |
|
|
|
std::optional<injector_compensation_mode_e> m_secondaryInjectorCompensationMode; |
217 |
|
|
|
|
218 |
|
|
|
// Staged injection |
219 |
|
|
|
std::optional<bool> m_isStagedInjectionEnabled; |
220 |
|
|
|
|
221 |
|
|
|
// Nitrous control |
222 |
|
|
|
std::optional<bool> m_nitrousControlEnabled; |
223 |
|
|
|
std::optional<nitrous_arming_method_e> m_nitrousControlArmingMethod; |
224 |
|
|
|
std::optional<switch_input_pin_e> m_nitrousControlTriggerPin; |
225 |
|
|
|
std::optional<pin_input_mode_e> m_nitrousControlTriggerPinMode; |
226 |
|
|
|
std::optional<lua_gauge_e> m_nitrousLuaGauge; |
227 |
|
|
|
std::optional<lua_gauge_meaning_e> m_nitrousLuaGaugeMeaning; |
228 |
|
|
|
std::optional<float> m_nitrousLuaGaugeArmingValue; |
229 |
|
|
|
|
230 |
|
|
|
std::optional<uint16_t> m_nitrousMinimumVehicleSpeed; |
231 |
|
|
|
std::optional<int> m_nitrousMinimumTps; |
232 |
|
|
|
std::optional<uint8_t> m_nitrousMinimumClt; |
233 |
|
|
|
std::optional<uint16_t> m_nitrousMaximumMap; |
234 |
|
|
|
std::optional<float> m_nitrousMaximumAfr; |
235 |
|
|
|
std::optional<uint16_t> m_nitrousActivationRpm; |
236 |
|
|
|
std::optional<uint16_t> m_nitrousDeactivationRpm; |
237 |
|
|
|
std::optional<uint16_t> m_nitrousDeactivationRpmWindow; |
238 |
|
|
|
std::optional<int8_t> m_nitrousFuelAdderPercent; |
239 |
|
|
|
std::optional<float> m_nitrousIgnitionRetard; |
240 |
|
|
|
|
241 |
|
|
|
std::optional<float> m_fuelLevelAveragingAlpha; |
242 |
|
|
|
std::optional<float> m_fuelLevelUpdatePeriodSec; |
243 |
|
|
|
std::optional<float> m_fuelLevelLowThresholdVoltage; |
244 |
|
|
|
std::optional<float> m_fuelLevelHighThresholdVoltage; |
245 |
|
|
|
}; |
246 |
|
|
|
|