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

Functions

MapAveragergetMapAvg (size_t cylinderBankIndex)
 
static MapCfg getMapCfg (air_pressure_sensor_type_e sensorType)
 
void configureMapFunction (LinearFunc &converter, air_pressure_sensor_type_e sensorType)
 
void initMap ()
 
void deinitMap ()
 

Variables

static LinearFunc baroConverter
 
static FunctionalSensor baroSensor (SensorType::BarometricPressure, MS2NT(50))
 
static LinearFunc mapConverter
 
static FunctionalSensor slowMapSensor (SensorType::MapSlow, MS2NT(50))
 
static FunctionalSensor compressorDischargePress (SensorType::CompressorDischargePressure, MS2NT(50))
 
static FunctionalSensor throttleInletPress (SensorType::ThrottleInletPressure, MS2NT(50))
 
static MapAverager fastMapSensor (SensorType::MapFast, MS2NT(200))
 
static MapAverager fastMapSensor2 (SensorType::MapFast2, MS2NT(200))
 
static FallbackSensor mapCombiner (SensorType::Map, SensorType::MapFast, SensorType::MapSlow)
 
static FallbackSensor mapCombiner2 (SensorType::Map2, SensorType::MapFast2, SensorType::MapSlow2)
 

Function Documentation

◆ configureMapFunction()

void configureMapFunction ( LinearFunc converter,
air_pressure_sensor_type_e  sensorType 
)

Definition at line 92 of file init_map.cpp.

92 {
93 auto cfg = getMapCfg(sensorType);
94
95 converter.configure(
96 cfg.v1,
97 cfg.map1,
98 cfg.v2,
99 cfg.map2,
102 );
103}
static constexpr engine_configuration_s * engineConfiguration
converter
static MapCfg getMapCfg(air_pressure_sensor_type_e sensorType)
Definition init_map.cpp:45

Referenced by initMap().

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

◆ deinitMap()

void deinitMap ( )

Definition at line 144 of file init_map.cpp.

144 {
149}
static void UnsubscribeSensor(FunctionalSensorBase &sensor)
static FunctionalSensor throttleInletPress(SensorType::ThrottleInletPressure, MS2NT(50))
static FunctionalSensor baroSensor(SensorType::BarometricPressure, MS2NT(50))
static FunctionalSensor slowMapSensor(SensorType::MapSlow, MS2NT(50))
static FunctionalSensor compressorDischargePress(SensorType::CompressorDischargePressure, MS2NT(50))

Referenced by stopSensors().

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

◆ getMapAvg()

MapAverager & getMapAvg ( size_t  cylinderBankIndex)

Definition at line 28 of file init_map.cpp.

28 {
29 // May 2025: cylinderBankIndex is always zero, second MAP sensor feature is not finished
30 return cylinderBankIndex == 0 ? fastMapSensor : fastMapSensor2;
31}
static MapAverager fastMapSensor(SensorType::MapFast, MS2NT(200))
static MapAverager fastMapSensor2(SensorType::MapFast2, MS2NT(200))

Referenced by mapAveragingAdcCallback(), and startAveraging().

Here is the caller graph for this function:

◆ getMapCfg()

static MapCfg getMapCfg ( air_pressure_sensor_type_e  sensorType)
static

Definition at line 45 of file init_map.cpp.

45 {
46 switch (sensorType) {
47 case MT_DENSO183:
48 return {0, -6.64, 5, 182.78};
49 case MT_MPX4100:
50 return {0.306, 20, 4.897, 105};
51 case MT_MPX4250:
52 case MT_MPX4250A:
53 return {0.204, 20, 4.896, 250};
54 case MT_HONDA3BAR:
55 return {0.5, 91.422, 3.0, 0};
56 case MT_DODGE_NEON_2003:
57 return {0.4, 15.34, 4.5, 100};
58 case MT_SUBY_DENSO:
59 return {0, 0, 5, 200};
60 case MT_GM_3_BAR:
61 return {0.631, 40, 4.914, 304};
62 case MT_GM_2_BAR:
63 return {0, 8.8, 5, 208};
64 case MT_GM_1_BAR:
65 return {0, 10, 5, 105};
66 case MT_TOYOTA_89420_02010:
67 return {3.7 - 2, 33.32, 3.7, 100};
68 case MT_MAZDA_1_BAR:
69 return {0, 2.5, 5, 117};
70 case MT_BOSCH_2_5:
71 // kpa=54.11764705882353v−1.6470588235294201
72 return {0.4 , 20 , 4.65, 250};
73 case MT_MPXH6400:
74 return {0.2, 20, 4.8, 400};
75 case MT_MPXH6300:
76 return {1.0, 60, 4.5, 270};
77 default:
78 firmwareError(ObdCode::CUSTOM_ERR_MAP_TYPE, "Unknown MAP type: decoder %d", sensorType);
79 // falls through to custom
80 return {};
81 case MT_CUSTOM: {
82 auto& mapConfig = engineConfiguration->map.sensor;
83 return {
85 mapConfig.lowValue,
87 mapConfig.highValue
88 };
89 }}
90}
void firmwareError(ObdCode code, const char *fmt,...)
@ CUSTOM_ERR_MAP_TYPE

Referenced by configureMapFunction().

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

◆ initMap()

void initMap ( )

Definition at line 105 of file init_map.cpp.

105 {
106 // Set up the conversion function
108
110// unfinished/dead? slowMapSensor2.setFunction(mapConverter);
115
116 auto mapChannel = engineConfiguration->map.sensor.hwChannel;
117 if (isAdcChannelValid(mapChannel)) {
119// unfinished/dead? slowMapSensor2.Register();
124
125 // Configure slow MAP as a normal analog sensor
126 // it's possible/probably that slow and fast both read from same physical pin, apparently that's fine?!
128 }
129
132
133 auto baroChannel = engineConfiguration->baroSensor.hwChannel;
134 if (isAdcChannelValid(baroChannel)) {
136
139
141 }
142}
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:23
static AdcSubscriptionEntry * SubscribeSensor(FunctionalSensorBase &sensor, adc_channel_e channel, float lowpassCutoffHZ, float voltsPerAdcVolt=0.0f)
void setFunction(ConverterType &func)
void setFunction(SensorConverter &func)
bool Register()
Definition sensor.cpp:131
static FallbackSensor mapCombiner(SensorType::Map, SensorType::MapFast, SensorType::MapSlow)
static FallbackSensor mapCombiner2(SensorType::Map2, SensorType::MapFast2, SensorType::MapSlow2)
static LinearFunc mapConverter
Definition init_map.cpp:14
static LinearFunc baroConverter
Definition init_map.cpp:9
void configureMapFunction(LinearFunc &converter, air_pressure_sensor_type_e sensorType)
Definition init_map.cpp:92

Referenced by sensorStartUpOrReconfiguration().

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

Variable Documentation

◆ baroConverter

LinearFunc baroConverter
static

Definition at line 9 of file init_map.cpp.

Referenced by initMap().

◆ baroSensor

FunctionalSensor baroSensor(SensorType::BarometricPressure, MS2NT(50)) ( SensorType::BarometricPressure  ,
MS2NT(50)   
)
static

Referenced by deinitMap(), and initMap().

◆ compressorDischargePress

FunctionalSensor compressorDischargePress(SensorType::CompressorDischargePressure, MS2NT(50)) ( SensorType::CompressorDischargePressure  ,
MS2NT(50)   
)
static

Referenced by deinitMap(), and initMap().

◆ fastMapSensor

MapAverager fastMapSensor(SensorType::MapFast, MS2NT(200)) ( SensorType::MapFast  ,
MS2NT(200)   
)
static

Referenced by getMapAvg(), and initMap().

◆ fastMapSensor2

MapAverager fastMapSensor2(SensorType::MapFast2, MS2NT(200)) ( SensorType::MapFast2  ,
MS2NT(200)   
)
static

Referenced by getMapAvg(), and initMap().

◆ mapCombiner

Referenced by initMap().

◆ mapCombiner2

Referenced by initMap().

◆ mapConverter

LinearFunc mapConverter
static

Definition at line 14 of file init_map.cpp.

Referenced by initMap().

◆ slowMapSensor

FunctionalSensor slowMapSensor(SensorType::MapSlow, MS2NT(50)) ( SensorType::MapSlow  ,
MS2NT(50)   
)
static

Referenced by deinitMap(), and initMap().

◆ throttleInletPress

FunctionalSensor throttleInletPress(SensorType::ThrottleInletPressure, MS2NT(50)) ( SensorType::ThrottleInletPressure  ,
MS2NT(50)   
)
static

Referenced by deinitMap(), and initMap().

Go to the source code of this file.