rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions
NitrousController Class Reference

#include <nitrous_controller.h>

Inheritance diagram for NitrousController:
Inheritance graph
[legend]
Collaboration diagram for NitrousController:
Collaboration graph
[legend]

Public Types

using interface_t = NitrousController
 

Public Member Functions

void onSlowCallback () override
 
float getFuelCoefficient () const
 
- Public Member Functions inherited from EngineModule
virtual void initNoConfiguration ()
 
virtual void setDefaultConfiguration ()
 
virtual void onConfigurationChange (engine_configuration_s const *)
 
virtual void onFastCallback ()
 
virtual void onEngineStop ()
 
virtual void onIgnitionStateChanged (bool)
 
virtual bool needsDelayedShutoff ()
 
virtual void onEnginePhase (float, efitick_t, angle_t, angle_t)
 

Private Member Functions

void updateArmingState ()
 
void updateSpeedConditionSatisfied ()
 
void updateTpsConditionSatisfied ()
 
void updateCltConditionSatisfied ()
 
void updateMapConditionSatisfied ()
 
void updateAfrConditionSatisfied ()
 
void updateRpmConditionSatisfied ()
 
bool checkTriggerPinState () const
 
bool checkLuaGauge () const
 
SensorType getLuaGauge () const
 

Additional Inherited Members

- Data Fields inherited from nitrous_control_state_s
bool isNitrousArmed: 1 {}
 
bool isNitrousSpeedCondition: 1 {}
 
bool isNitrousTpsCondition: 1 {}
 
bool isNitrousCltCondition: 1 {}
 
bool isNitrousMapCondition: 1 {}
 
bool isNitrousAfrCondition: 1 {}
 
bool isNitrousRpmCondition: 1 {}
 
bool isNitrousCondition: 1 {}
 
bool unusedBit_8_8: 1 {}
 
bool unusedBit_8_9: 1 {}
 
bool unusedBit_8_10: 1 {}
 
bool unusedBit_8_11: 1 {}
 
bool unusedBit_8_12: 1 {}
 
bool unusedBit_8_13: 1 {}
 
bool unusedBit_8_14: 1 {}
 
bool unusedBit_8_15: 1 {}
 
bool unusedBit_8_16: 1 {}
 
bool unusedBit_8_17: 1 {}
 
bool unusedBit_8_18: 1 {}
 
bool unusedBit_8_19: 1 {}
 
bool unusedBit_8_20: 1 {}
 
bool unusedBit_8_21: 1 {}
 
bool unusedBit_8_22: 1 {}
 
bool unusedBit_8_23: 1 {}
 
bool unusedBit_8_24: 1 {}
 
bool unusedBit_8_25: 1 {}
 
bool unusedBit_8_26: 1 {}
 
bool unusedBit_8_27: 1 {}
 
bool unusedBit_8_28: 1 {}
 
bool unusedBit_8_29: 1 {}
 
bool unusedBit_8_30: 1 {}
 
bool unusedBit_8_31: 1 {}
 

Detailed Description

Definition at line 9 of file nitrous_controller.h.

Member Typedef Documentation

◆ interface_t

Definition at line 11 of file nitrous_controller.h.

Member Function Documentation

◆ checkLuaGauge()

bool NitrousController::checkLuaGauge ( ) const
private

Definition at line 138 of file nitrous_controller.cpp.

138 {
139 bool result = false;
140 const SensorResult currentSensorResult = Sensor::get(getLuaGauge());
141 if (currentSensorResult.Valid) {
142 const float currentValue = currentSensorResult.Value;
143 const float armingValue = engineConfiguration->nitrousLuaGaugeArmingValue;
145 case LUA_GAUGE_LOWER_BOUND: {
146 result = (armingValue <= currentValue);
147 break;
148 }
149 case LUA_GAUGE_UPPER_BOUND: {
150 result = (currentValue <= armingValue);
151 break;
152 }
153 }
154 }
155 return result;
156}
SensorType getLuaGauge() const
virtual SensorResult get() const =0
static constexpr engine_configuration_s * engineConfiguration
expected< float > SensorResult
Definition sensor.h:46

Referenced by updateArmingState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkTriggerPinState()

bool NitrousController::checkTriggerPinState ( ) const
private

Definition at line 126 of file nitrous_controller.cpp.

126 {
127 bool result = false;
128#if !EFI_SIMULATOR
131 if (isBrainPinValid(triggerPin)) {
132 result = efiReadPin(triggerPin, triggerPinMode);
133 }
134#endif // !EFI_SIMULATOR
135 return result;
136}
bool efiReadPin(brain_pin_e pin)
Definition io_pins.cpp:89
bool isBrainPinValid(brain_pin_e brainPin)
pin_input_mode_e

Referenced by updateArmingState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFuelCoefficient()

float NitrousController::getFuelCoefficient ( ) const

Definition at line 29 of file nitrous_controller.cpp.

Referenced by getRunningFuel().

Here is the caller graph for this function:

◆ getLuaGauge()

SensorType NitrousController::getLuaGauge ( ) const
private

Definition at line 158 of file nitrous_controller.cpp.

158 {
161 case LUA_GAUGE_1: {
162 break;
163 }
164 case LUA_GAUGE_2: {
165 result = SensorType::LuaGauge2;
166 break;
167 }
168 case LUA_GAUGE_3: {
169 result = SensorType::LuaGauge3;
170 break;
171 }
172 case LUA_GAUGE_4: {
173 result = SensorType::LuaGauge4;
174 break;
175 }
176 case LUA_GAUGE_5: {
177 result = SensorType::LuaGauge5;
178 break;
179 }
180 case LUA_GAUGE_6: {
181 result = SensorType::LuaGauge6;
182 break;
183 }
184 case LUA_GAUGE_7: {
185 result = SensorType::LuaGauge7;
186 break;
187 }
188 case LUA_GAUGE_8: {
189 result = SensorType::LuaGauge8;
190 break;
191 }
192 }
193 return result;
194}
SensorType
Definition sensor_type.h:18

Referenced by checkLuaGauge().

Here is the caller graph for this function:

◆ onSlowCallback()

void NitrousController::onSlowCallback ( )
overridevirtual

Reimplemented from EngineModule.

Definition at line 10 of file nitrous_controller.cpp.

10 {
22 );
23 } else {
24 isNitrousCondition = false;
25 }
27}
RegisteredOutputPin nitrousRelay
Definition efi_gpio.h:92
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
EnginePins enginePins
Definition efi_gpio.cpp:24
Here is the call graph for this function:

◆ updateAfrConditionSatisfied()

void NitrousController::updateAfrConditionSatisfied ( )
private

Definition at line 90 of file nitrous_controller.cpp.

90 {
91 if (static_cast<float>(engineConfiguration->nitrousMaximumAfr) != 0.0f) {
92 const expected<float> lambda1 = Sensor::get(SensorType::Lambda1);
93 if (lambda1.Valid) {
94 const float afr = lambda1.Value * STOICH_RATIO;
95 isNitrousAfrCondition = (afr <= static_cast<float>(engineConfiguration->nitrousMaximumAfr));
96 } else {
98 }
99 } else {
101 }
102}

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateArmingState()

void NitrousController::updateArmingState ( )
private

Definition at line 37 of file nitrous_controller.cpp.

37 {
39 case DIGITAL_SWITCH_INPUT: {
41 break;
42 }
43 case LUA_GAUGE: {
45 break;
46 }
47 default: { // Unexpected value!!!
48 isNitrousArmed = false;
49 break;
50 }
51 }
52}
bool checkTriggerPinState() const

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateCltConditionSatisfied()

void NitrousController::updateCltConditionSatisfied ( )
private

Definition at line 72 of file nitrous_controller.cpp.

72 {
74 const expected<float> clt = Sensor::get(SensorType::Clt);
76 } else {
78 }
79}
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateMapConditionSatisfied()

void NitrousController::updateMapConditionSatisfied ( )
private

Definition at line 81 of file nitrous_controller.cpp.

81 {
83 const expected<float> map = Sensor::get(SensorType::Map);
84 isNitrousMapCondition = map.Valid && (map.Value <= engineConfiguration->nitrousMaximumMap);
85 } else {
87 }
88}

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRpmConditionSatisfied()

void NitrousController::updateRpmConditionSatisfied ( )
private

Definition at line 108 of file nitrous_controller.cpp.

108 {
109 const expected<float> rpmSensorReading = Sensor::get(SensorType::Rpm);
110 if (rpmSensorReading.Valid) {
111 const float rpm = rpmSensorReading.Value;
112 if (rpmHysteresis.checkIfLimitIsExceeded(
113 rpm,
116 )) {
117 isNitrousRpmCondition = false;
118 } else {
120 }
121 } else {
122 isNitrousRpmCondition = false;
123 }
124}

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateSpeedConditionSatisfied()

void NitrousController::updateSpeedConditionSatisfied ( )
private

Definition at line 54 of file nitrous_controller.cpp.

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTpsConditionSatisfied()

void NitrousController::updateTpsConditionSatisfied ( )
private

Definition at line 63 of file nitrous_controller.cpp.

Referenced by onSlowCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: