rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
ego.cpp File Reference

Functions

bool hasAfrSensor ()
 
float getAfr (SensorType type)
 
static void initEgoSensor (afr_sensor_s *sensor, ego_sensor_e type)
 
void setEgoSensor (ego_sensor_e type)
 

Variables

StoredValueSensor smoothedLambda1Sensor (SensorType::SmoothedLambda1, MS2NT(500))
 
StoredValueSensor smoothedLambda2Sensor (SensorType::SmoothedLambda2, MS2NT(500))
 
ExpAverage expAverageLambda1
 
ExpAverage expAverageLambda2
 

Function Documentation

◆ getAfr()

float getAfr ( SensorType  type)

Definition at line 25 of file ego.cpp.

25 {
27
29 return 0;
30 }
31
32 auto volts = adcGetScaledVoltage("ego", type == SensorType::Lambda1 ? sensor->hwChannel : sensor->hwChannel2);
33
34 float interpolatedAfr = interpolateMsg("AFR", sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts.value_or(0));
35
36 switch (type) {
40 break;
41 }
45 break;
46 }
47 default:
48 break;
49 }
50
51 return interpolateMsg("AFR", sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts.value_or(0))
53}
expected< float > adcGetScaledVoltage(const char *msg, adc_channel_e hwChannel)
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:23
void setSmoothingFactor(float p_smoothingFactor)
Definition exp_average.h:26
float initOrAverage(float value)
Definition exp_average.h:9
void setValidValue(float value, efitick_t timestamp)
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x)
Linear interpolation by two points.
efitick_t getTimeNowNt()
Definition efitime.cpp:19
StoredValueSensor smoothedLambda2Sensor(SensorType::SmoothedLambda2, MS2NT(500))
ExpAverage expAverageLambda2
Definition ego.cpp:13
StoredValueSensor smoothedLambda1Sensor(SensorType::SmoothedLambda1, MS2NT(500))
ExpAverage expAverageLambda1
Definition ego.cpp:12
static constexpr engine_configuration_s * engineConfiguration
static Lps25Sensor sensor(device)
Here is the call graph for this function:

◆ hasAfrSensor()

bool hasAfrSensor ( )

Definition at line 17 of file ego.cpp.

Here is the call graph for this function:

◆ initEgoSensor()

static void initEgoSensor ( afr_sensor_s sensor,
ego_sensor_e  type 
)
static

This decodes BPSX D1 Wideband Controller analog signal

Definition at line 56 of file ego.cpp.

56 {
57
58 switch (type) {
59 case ES_BPSX_D1:
60 /**
61 * This decodes BPSX D1 Wideband Controller analog signal
62 */
63 sensor->v1 = 0;
64 sensor->value1 = 9;
65 sensor->v2 = 5;
66 sensor->value2 = 19;
67 break;
68
69 case ES_Innovate_MTX_L:
70 sensor->v1 = 0;
71 sensor->value1 = 7.35;
72 sensor->v2 = 5;
73 sensor->value2 = 22.39;
74 break;
75 case ES_14Point7_Free:
76 sensor->v1 = 0;
77 sensor->value1 = 9.996;
78 sensor->v2 = 5;
79 sensor->value2 = 19.992;
80 break;
81 // technically 14Point7 and PLX use the same scale
82 case ES_PLX:
83 sensor->v1 = 0;
84 sensor->value1 = 10;
85 sensor->v2 = 5;
86 sensor->value2 = 20;
87 break;
88 case ES_AEM:
89 sensor->v1 = 0.5;
90 sensor->value1 = 8.5;
91 sensor->v2 = 4.5;
92 sensor->value2 = 18;
93 break;
94 default:
95 firmwareError(ObdCode::CUSTOM_EGO_TYPE, "Unexpected EGO %d", type);
96 break;
97 }
98}
void firmwareError(ObdCode code, const char *fmt,...)
@ CUSTOM_EGO_TYPE

Referenced by setEgoSensor().

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

◆ setEgoSensor()

void setEgoSensor ( ego_sensor_e  type)

Definition at line 100 of file ego.cpp.

100 {
103}
static void initEgoSensor(afr_sensor_s *sensor, ego_sensor_e type)
Definition ego.cpp:56

Referenced by setDefaultEngineConfiguration(), and setVwAba().

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

Variable Documentation

◆ expAverageLambda1

ExpAverage expAverageLambda1

Definition at line 12 of file ego.cpp.

Referenced by getAfr(), and AemXSeriesWideband::refreshSmoothedLambda().

◆ expAverageLambda2

ExpAverage expAverageLambda2

Definition at line 13 of file ego.cpp.

Referenced by getAfr(), and AemXSeriesWideband::refreshSmoothedLambda().

◆ smoothedLambda1Sensor

StoredValueSensor smoothedLambda1Sensor(SensorType::SmoothedLambda1, MS2NT(500)) ( SensorType::SmoothedLambda1  ,
MS2NT(500)   
)
Author
Andrey Belomutskiy, (c) 2012-2020

EGO Exhaust Gas Oxygen, also known as AFR Air/Fuel Ratio :) connectet over analog input

Referenced by getAfr(), initLambda(), and AemXSeriesWideband::refreshSmoothedLambda().

◆ smoothedLambda2Sensor

StoredValueSensor smoothedLambda2Sensor(SensorType::SmoothedLambda2, MS2NT(500)) ( SensorType::SmoothedLambda2  ,
MS2NT(500)   
)

Go to the source code of this file.