rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
init.h File Reference

Functions

void initOverrideSensors ()
 
void initNewSensors ()
 
void stopSensors ()
 
void reconfigureSensors ()
 
void initVbatt ()
 
void initMaf ()
 
void initMap ()
 
void initTps ()
 
void initFluidPressure ()
 
void initThermistors ()
 
void initCanSensors ()
 
void initLambda ()
 
void initEgt ()
 
void initFlexSensor (bool isFirstTime)
 
void initFuelLevel ()
 
void initBaro ()
 
void initAuxSensors ()
 
void initVehicleSpeedSensor ()
 
void initTurbochargerSpeedSensor ()
 
void initAuxSpeedSensors ()
 
void initInputShaftSpeedSensor ()
 
void initRangeSensors ()
 
void deinitVbatt ()
 
void deinitTps ()
 
void deinitThermistors ()
 
void deinitFluidPressure ()
 
void deInitFlexSensor ()
 
void deinitAuxSensors ()
 
void deInitVehicleSpeedSensor ()
 
void deinitTurbochargerSpeedSensor ()
 
void deinitMap ()
 
void deinitAuxSpeedSensors ()
 
void deinitInputShaftSpeedSensor ()
 
void stopEgt ()
 
void startEgt ()
 
void sentPressureDecode (SentInput sentCh)
 
void pokeAuxDigital ()
 

Function Documentation

◆ deinitAuxSensors()

void deinitAuxSensors ( )

Definition at line 58 of file init_aux.cpp.

58 {
59 for (size_t i = 0; i < efi::size(engineConfiguration->auxAnalogInputs); i++) {
62 }
63}
static void UnsubscribeSensor(FunctionalSensorBase &sensor)
void unregister()
Definition sensor.cpp:135
static constexpr engine_configuration_s * engineConfiguration
static FunctionalSensor auxSensors[]
Definition init_aux.cpp:10

Referenced by stopSensors().

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

◆ deinitAuxSpeedSensors()

void deinitAuxSpeedSensors ( )

Definition at line 51 of file init_aux_speed_sensor.cpp.

51 {
54 wheelSlipSensor.unregister();
55}
static FrequencySensor auxSpeed2(SensorType::AuxSpeed2, MS2NT(500))
static WheelSlipBasedOnAuxSpeedSensor wheelSlipSensor
static FrequencySensor auxSpeed1(SensorType::AuxSpeed1, MS2NT(500))

Referenced by stopSensors().

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

◆ deInitFlexSensor()

void deInitFlexSensor ( )

Definition at line 98 of file init_flex.cpp.

98 {
101
102#if EFI_PROD_CODE
103 if (!isBrainPinValid(flexPin)) {
104 return;
105 }
106
108
110#endif
111}
@ Unassigned
void efiExtiDisablePin(brain_pin_e brainPin)
static FunctionalSensor flexSensor(SensorType::FuelEthanolPercent, MS2NT(30000))
static Gpio flexPin
Definition init_flex.cpp:55
static StoredValueSensor flexFuelTemp(SensorType::FuelTemperature, MS2NT(30000))
bool isBrainPinValid(brain_pin_e brainPin)

Referenced by stopSensors().

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

◆ deinitFluidPressure()

void deinitFluidPressure ( )

Definition at line 115 of file init_fluid_pressure.cpp.

115 {
123}
static FunctionalSensor auxLinear1Sensor(SensorType::AuxLinear1, MS2NT(50))
static FunctionalSensor oilpSensor(SensorType::OilPressure, MS2NT(50))
static FunctionalSensor auxLinear3Sensor(SensorType::AuxLinear3, MS2NT(50))
static FunctionalSensor auxLinear4Sensor(SensorType::AuxLinear4, MS2NT(50))
static FunctionalSensor fuelPressureSensorLow(SensorType::FuelPressureLow, MS2NT(50))
static FunctionalSensor auxLinear2Sensor(SensorType::AuxLinear2, MS2NT(50))
static FunctionalSensor fuelPressureSensorHigh(SensorType::FuelPressureHigh, MS2NT(50))

Referenced by stopSensors().

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

◆ deinitInputShaftSpeedSensor()

void deinitInputShaftSpeedSensor ( )

Definition at line 26 of file init_input_shaft_speed_sensor.cpp.

26 {
28}
FrequencySensor inputShaftSpeedSensor(SensorType::InputShaftSpeed, MS2NT(500))

Referenced by stopSensors().

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 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:

◆ deinitThermistors()

void deinitThermistors ( )

Definition at line 142 of file init_thermistors.cpp.

142 {
151}
static CCM_OPTIONAL FunctionalSensor fuelTempSensor(SensorType::FuelTemperature, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor aux2(SensorType::AuxTemp2, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor compressorDischargeTemp(SensorType::CompressorDischargeTemperature, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor iat(SensorType::Iat, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor aux1(SensorType::AuxTemp1, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor ambientTempSensor(SensorType::AmbientTemperature, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor oilTempSensor(SensorType::OilTemperature, MS2NT(10))

Referenced by stopSensors().

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

◆ deinitTps()

void deinitTps ( )

Definition at line 278 of file init_tps.cpp.

278 {
281
282 analogTps1.deinit(isFordTps, &fordTps1);
283 tps2.deinit(isFordTps, &fordTps2);
284 pedal.deinit(isFordPps, &fordPps);
285
286#if EFI_SENT_SUPPORT
288#endif
289
290 wastegate.deinit();
291 idlePos.deinit();
292}
engine_configuration_s & activeConfiguration
static FuncSensPair wastegate(1, SensorType::WastegatePosition)
static RedundantFordTps fordTps1(SensorType::Tps1, SensorType::Tps1Primary, SensorType::Tps1Secondary)
static RedundantPair pedal(pedalPrimary, pedalSecondary, SensorType::AcceleratorPedalUnfiltered)
static RedundantPair tps2(tps2p, tps2s, SensorType::Tps2)
static FuncSensPair idlePos(PACK_MULT_VOLTAGE, SensorType::IdlePosition)
static RedundantPair analogTps1(tps1p, tps1s, SensorType::Tps1)
static RedundantFordTps fordPps(SensorType::AcceleratorPedalUnfiltered, SensorType::AcceleratorPedalPrimary, SensorType::AcceleratorPedalSecondary)
SentTps sentTps
Definition init_tps.cpp:181
static RedundantFordTps fordTps2(SensorType::Tps2, SensorType::Tps2Primary, SensorType::Tps2Secondary)

Referenced by stopSensors().

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

◆ deinitTurbochargerSpeedSensor()

void deinitTurbochargerSpeedSensor ( )

Definition at line 20 of file init_turbocharger_speed_sensor.cpp.

20 {
22}
static FrequencySensor turbochargerSpeedSensor(SensorType::TurbochargerSpeed, MS2NT(500))

Referenced by stopSensors().

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

◆ deinitVbatt()

void deinitVbatt ( )

Definition at line 36 of file init_vbatt.cpp.

36 {
39}
static FunctionalSensor ignBattSensor(SensorType::IgnKeyVoltage, MS2NT(100))
static FunctionalSensor vbattSensor(SensorType::BatteryVoltage, MS2NT(100))

Referenced by stopSensors().

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

◆ deInitVehicleSpeedSensor()

void deInitVehicleSpeedSensor ( )

Definition at line 23 of file init_vehicle_speed_sensor.cpp.

23 {
25}
FrequencySensor vehicleSpeedSensor(SensorType::VehicleSpeed, MS2NT(500))

Referenced by stopSensors().

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

◆ initAuxSensors()

void initAuxSensors ( )

Definition at line 36 of file init_aux.cpp.

36 {
37 for (size_t i = 0; i < efi::size(engineConfiguration->auxAnalogInputs); i++) {
39
40 // Skip unconfigured channels
42 continue;
43 }
44
45 auto& sensor = auxSensors[i];
46 sensor.setFunction(identityFunction);
48
50 }
51
52 for (size_t i = 0; i < efi::size(luaGauges); i++) {
53 auto& sensor = luaGauges[i];
55 }
56}
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:23
uint16_t channel
Definition adc_inputs.h:104
static AdcSubscriptionEntry * SubscribeSensor(FunctionalSensorBase &sensor, adc_channel_e channel, float lowpassCutoffHZ, float voltsPerAdcVolt=0.0f)
bool Register()
Definition sensor.cpp:131
IdentityFunction identityFunction
StoredValueSensor luaGauges[]
Definition init_aux.cpp:21
static Lps25Sensor sensor(device)

Referenced by sensorStartUpOrReconfiguration().

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

◆ initAuxSpeedSensors()

void initAuxSpeedSensors ( )

◆ initBaro()

void initBaro ( )

Definition at line 7 of file init_baro.cpp.

7 {
8 // If there's already an external (analog) baro sensor configured,
9 // don't configure the internal one.
11 return;
12 }
13
16 }
17}
bool init(brain_pin_e scl, brain_pin_e sda)
Definition lps25.cpp:37
virtual bool hasSensor() const
Definition sensor.h:141
static Lps25 device
Definition init_baro.cpp:4
@ BarometricPressure

Referenced by initNewSensors().

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

◆ initCanSensors()

void initCanSensors ( )

Definition at line 41 of file init_can_sensors.cpp.

41 {
47 }
48}
void registerCanSensor(CanSensorBase &sensor)
Definition can_rx.cpp:92
ObdCanSensor< 1, ODB_TEMP_EXTRA > obdIatSensor(PID_INTAKE_TEMP, 1, SensorType::Iat)
ObdCanSensor< 1, ODB_TEMP_EXTRA > obdCltSensor(PID_COOLANT_TEMP, 1, SensorType::Clt)
ObdCanSensor< 1, 0 > obdTpsSensor(PID_INTAKE_TEMP, ODB_TPS_BYTE_PERCENT, SensorType::Tps1)
ObdCanSensor< 2, 0 > obdRpmSensor(PID_RPM, ODB_RPM_MULT, SensorType::Rpm)

Referenced by initNewSensors().

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

◆ initEgt()

void initEgt ( )

Definition at line 16 of file init_egt.cpp.

16 {
17#if EFI_CAN_SUPPORT
20 criticalError("CAN read is required to use CAN EGT.");
21 return;
22 }
23
30
31 return;
32 }
33#endif
34
35#if EFI_MAX_31855
37#endif /* EFI_MAX_31855 */
38}
static AemXSeriesEgt aemEgt5(4, SensorType::EGT5)
static AemXSeriesEgt aemEgt6(5, SensorType::EGT6)
static AemXSeriesEgt aemEgt2(1, SensorType::EGT2)
static AemXSeriesEgt aemEgt1(0, SensorType::EGT1)
static AemXSeriesEgt aemEgt4(3, SensorType::EGT4)
static AemXSeriesEgt aemEgt3(2, SensorType::EGT3)
void initMax3185x(spi_device_e device, egt_cs_array_t max31855_cs)
Definition max3185x.cpp:552

Referenced by initNewSensors().

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

◆ initFlexSensor()

void initFlexSensor ( bool  isFirstTime)

Definition at line 64 of file init_flex.cpp.

64 {
65#if EFI_PROD_CODE
67 PAL_EVENT_MODE_BOTH_EDGES, flexExtiCallback, nullptr) < 0) {
68 return;
69 }
71#endif
72
73 // 0.01 means filter bandwidth of ~1hz with ~100hz sensor
76
77#if EFI_PROD_CODE
78 if (isFirstTime) {
79 addConsoleAction("flexinfo", []() {
80 efiPrintf("flex counter %d", flexCallbackCounter);
81 efiPrintf("lowFlexCallbackCounter counter %d", lowFlexCallbackCounter);
82 efiPrintf("flex freq %f", frequency);
83 efiPrintf("pulseWidthUs %f", pulseWidthUs);
84 efiPrintf("latestCallbackTime %lld", latestCallbackTime);
85 });
86 }
87
88#endif // EFI_PROD_CODE
89
91
92 // If an analog fuel temp sensor is configured, don't use the flex sensor for fuel temp
95 }
96}
void configureLowpass(float samplingFrequency, float cutoffFrequency, float Q=0.54f)
Definition biquad.cpp:48
void setFunction(ConverterType &func)
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
int efiExtiEnablePin(const char *msg, brain_pin_e brainPin, uint32_t mode, ExtiCallback cb, void *cb_data)
static efitick_t latestCallbackTime
Definition init_flex.cpp:23
static FlexConverter converter
Definition init_flex.cpp:12
static void flexExtiCallback(void *, efitick_t nowNt)
Definition init_flex.cpp:57
static int lowFlexCallbackCounter
Definition init_flex.cpp:20
int flexCallbackCounter
Definition init_flex.cpp:19
static float pulseWidthUs
Definition init_flex.cpp:22
static float frequency
Definition init_flex.cpp:21
static Biquad flexTempFilter
Definition init_flex.cpp:14

Referenced by sensorStartUpOrReconfiguration().

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

◆ initFluidPressure()

void initFluidPressure ( )

Definition at line 75 of file init_fluid_pressure.cpp.

75 {
78
79#if EFI_SENT_SUPPORT
83 /* This sensor sends two pressure signals:
84 * Sig0 occupies 3 first nibbles
85 * Sig1 occupies next 3 nibbles
86 * Signals are close, but not identical.
87 * Sig0 shows about 197..198 at 1 Atm (open air) and 282 at 1000 KPa (10 Bar)
88 * Sig1 shows abour 202..203 at 1 Atm (open air) and 283 at 1000 KPa (10 Bar)
89 */
91 200, BAR2KPA(1),
92 283, BAR2KPA(10),
93 BAR2KPA(0), BAR2KPA(1000) /* What is limit of this sensor? */);
94 }
95 } else
96#endif
97 {
99 }
105
110 );
111
113}
void setProxiedSensor(SensorType proxiedSensor)
static LinearFunc auxLinear2Func
static LinearFunc acPressureFunc
void initFluidPressure()
static ProxySensor injectorPressure(SensorType::FuelPressureInjector)
static void initSentLinearSensor(LinearFunc &func, FunctionalSensor &sensor, int in1, float out1, int in2, float out2, float min, float max)
static LinearFunc auxLinear1Func
static FunctionalSensor acPressureSensor(SensorType::AcPressure, MS2NT(50))
static LinearFunc fuelPressureFuncLow
static LinearFunc auxLinear3Func
static LinearFunc oilpSensorFunc
static LinearFunc auxLinear4Func
static LinearFunc fuelPressureFuncHigh
SensorType
Definition sensor_type.h:18

Referenced by initFluidPressure(), and sensorStartUpOrReconfiguration().

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

◆ initFuelLevel()

void initFuelLevel ( )

Definition at line 8 of file init_fuel_level.cpp.

8 {
10
12 return;
13 }
14
15 // noisy data from fuel tank slosh is handled on an higher level
16 AdcSubscription::SubscribeSensor(fuelSensor, channel, /*lowpassCutoff =*/ 100);
18}
static FuelLevelSensor fuelSensor(SensorType::FuelLevel, MS2NT(500))

Referenced by initNewSensors().

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

◆ initInputShaftSpeedSensor()

void initInputShaftSpeedSensor ( )

Definition at line 15 of file init_input_shaft_speed_sensor.cpp.

15 {
17
18 if (parameter < 3 || parameter > 200) {
19 parameter = 3;
20 }
21
22 float filterParameter = 1.0f / parameter;
24}
static InputShaftSpeedConverter inputSpeedConverter

Referenced by sensorStartUpOrReconfiguration().

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

◆ initLambda()

void initLambda ( )

Definition at line 52 of file init_lambda.cpp.

52 {
53 // first we register the smoothed sensors for the early return on the can wbo case
56
57#if EFI_CAN_SUPPORT
60 criticalError("CAN read and write are required to use CAN wideband.");
61 return;
62 }
63
66
67 return;
68 }
69#endif
70
71#if EFI_UNIT_TEST
72 constexpr bool isUnitTest = true;
73#else
74 constexpr bool isUnitTest = false;
75#endif
76
77 // CANbus option is handled above, let's handle analog inputs conditionally to give Lua sensors a chance
80 }
83 }
84}
StoredValueSensor smoothedLambda2Sensor(SensorType::SmoothedLambda2, MS2NT(500))
StoredValueSensor smoothedLambda1Sensor(SensorType::SmoothedLambda1, MS2NT(500))
static FunctionPointerSensor lambdaSensor2(SensorType::Lambda2, []() { return afrWrapper.getLambda2();})
static FunctionPointerSensor lambdaSensor(SensorType::Lambda1, []() { return afrWrapper.getLambda();})
static AemXSeriesWideband aem2(1, SensorType::Lambda2)
static AemXSeriesWideband aem1(0, SensorType::Lambda1)

Referenced by initNewSensors().

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

◆ initMaf()

void initMaf ( )

Definition at line 92 of file init_maf.cpp.

92 {
95}
static FunctionalSensor maf2(SensorType::Maf2, MS2NT(50))
static FunctionalSensor maf(SensorType::Maf, MS2NT(50))
void initMaf()
Definition init_maf.cpp:92

Referenced by initMaf(), and initNewSensors().

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}
void setFunction(SensorConverter &func)
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
static MapAverager fastMapSensor(SensorType::MapFast, MS2NT(200))
static MapAverager fastMapSensor2(SensorType::MapFast2, MS2NT(200))

Referenced by sensorStartUpOrReconfiguration().

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

◆ initNewSensors()

void initNewSensors ( )

Definition at line 112 of file init_sensors.cpp.

112 {
113#if EFI_PROD_CODE && EFI_CAN_SUPPORT
115#endif
116
118
120 // todo:
121 initLambda();
122 // todo: 'isFirstTime' approach for initEgt vs startEgt
123 initEgt();
124 initBaro();
125
127 initMaf();
128
131
132 // Init CLI functionality for sensors (mocking)
134
135#if defined(HARDWARE_CI) && !defined(HW_PROTEUS)
136 chThdSleepMilliseconds(100);
137
139 // Fake that we have battery voltage, some tests rely on it
141 }
142#endif
143
144#if EFI_SIMULATOR
145 // Simulator gets battery voltage so it detects ignition-on
147#endif // EFI_SIMULATOR
148}
static void setMockValue(SensorType type, float value, bool mockRedundant=false)
Definition sensor.cpp:203
static float getOrZero(SensorType type)
Definition sensor.h:83
void initBaro()
Definition init_baro.cpp:7
void initEgt()
Definition init_egt.cpp:16
void initLambda()
void initCanSensors()
void initFuelLevel()
void initMaf()
Definition init_maf.cpp:92
static void sensorStartUpOrReconfiguration(bool isFirstTime)
void initOverrideSensors()
static void initOldAnalogInputs()
static void initSensorCli()
static void initAuxDigital()

Referenced by commonInitEngineController().

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

◆ initOverrideSensors()

void initOverrideSensors ( )

Definition at line 84 of file init_sensors.cpp.

84 {
89}
static LuaOverrideSensor overrideBatteryVoltage(SensorType::DashOverrideBatteryVoltage, SensorType::BatteryVoltage)
static LuaOverrideSensor overrideVehicleSpeed(SensorType::DashOverrideVehicleSpeed, SensorType::VehicleSpeed)
static LuaOverrideSensor overrideClt(SensorType::DashOverrideClt, SensorType::Clt)
static LuaOverrideSensor overrideRpm(SensorType::DashOverrideRpm, SensorType::Rpm)

Referenced by initNewSensors().

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

◆ initRangeSensors()

void initRangeSensors ( )

Definition at line 25 of file init_range.cpp.

25 {
26 for (size_t i = 0; i < efi::size(engineConfiguration->tcu_rangeAnalogInput); i++) {
28
29 // Skip unconfigured channels
31 continue;
32 }
33
35
36 auto& sensor = rangeSensors[i];
37 sensor.setFunction(rangeFuncs[i]);
39
41 }
42}
void configure(float supplyVoltage, float pullupResistor, bool isPulldown)
static ResistanceFunc rangeFuncs[RANGE_INPUT_COUNT]
static FunctionalSensor rangeSensors[]

Referenced by sensorStartUpOrReconfiguration().

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

◆ initThermistors()

void initThermistors ( )

Definition at line 88 of file init_thermistors.cpp.

88 {
91 clt,
92 fclt,
96
98 iat,
99 fiat,
103 }
104
105 configureTempSensor("oil temp",
107 faux2,
109 false);
110
111 configureTempSensor("fuel temp",
113 ffuel,
115 false);
116
117 configureTempSensor("ambient temp",
119 fambient,
121 false);
122
123 configureTempSensor("compressor discharge temp",
125 fcdt,
127 false);
128
129 configureTempSensor("aux1",
130 aux1,
131 faux1,
133 false);
134
135 configureTempSensor("aux2",
136 aux2,
137 faux2,
139 false);
140}
static FuncPair fiat
static void configureTempSensor(const char *msg, FunctionalSensor &sensor, FuncPair &p, ThermistorConf &p_config, bool isLinear, bool isPulldown=false)
static FuncPair ffuel
static FuncPair fcdt
static FuncPair fambient
static FuncPair faux1
static FuncPair fclt
static FuncPair faux2

Referenced by sensorStartUpOrReconfiguration().

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

◆ initTps()

void initTps ( )

Definition at line 206 of file init_tps.cpp.

206 {
207 criticalAssertVoid(engineConfiguration != nullptr, "null engineConfiguration");
210
214
215 float tpsSecondaryMaximum = engineConfiguration->tpsSecondaryMaximum;
216 if (tpsSecondaryMaximum < 20) {
217 // don't allow <20% split point
218 tpsSecondaryMaximum = 20;
219 }
220
221
222#if EFI_SENT_SUPPORT
223 if (isDigitalTps1()) {
225 } else
226#endif
227 {
228 analogTps1.init(isFordTps, &fordTps1, tpsSecondaryMaximum,
231 );
232 }
233
234 tps2.init(isFordTps, &fordTps2, tpsSecondaryMaximum,
237 );
238
239 float ppsSecondaryMaximum = engineConfiguration->ppsSecondaryMaximum;
240 if (ppsSecondaryMaximum < 20) {
241 // don't allow <20% split point
242 ppsSecondaryMaximum = 20;
243 }
244
245 // Pedal sensors
246 pedal.init(isFordPps, &fordPps, ppsSecondaryMaximum,
250 );
253 if (!arg) {
254 return arg;
255 }
256 static ExpAverage ppsExpAverage;
258 SensorResult result = ppsExpAverage.initOrAverage(arg.Value);
259 return result;
260 });
262
263 // TPS-like stuff that isn't actually a TPS
266 }
267
268 // Route the pedal or TPS to driverIntent as appropriate
271 } else {
273 }
274
276}
void setSmoothingFactor(float p_smoothingFactor)
Definition exp_average.h:26
float initOrAverage(float value)
Definition exp_average.h:9
void setConverter(functionFunctionPtr p_converter)
static ProxySensor ppsFilterSensor(SensorType::AcceleratorPedal)
static ProxySensor driverIntent(SensorType::DriverThrottleIntent)
float percent_t
expected< float > SensorResult
Definition sensor.h:46
@ AcceleratorPedalUnfiltered
bool isDigitalTps1()
Definition tps.cpp:83

Referenced by sensorStartUpOrReconfiguration().

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

◆ initTurbochargerSpeedSensor()

void initTurbochargerSpeedSensor ( )

Definition at line 15 of file init_turbocharger_speed_sensor.cpp.

Referenced by sensorStartUpOrReconfiguration().

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

◆ initVbatt()

void initVbatt ( )

Definition at line 11 of file init_vbatt.cpp.

11 {
12 {
13 static LinearFunc vbattFunc; // static with scoped visibility just to reduce change of code defect
14 vbattFunc.configure(0, 0, 1, engineConfiguration->vbattDividerCoeff, 0, 50);
15 vbattSensor.setFunction(vbattFunc);
16 }
17
19 static LinearFunc ignBattFunc; // static with scoped visibility just to reduce change of code defect
20 ignBattFunc.configure(0, 0, 1, engineConfiguration->ignKeyAdcDivider, 0, 50);
21 ignBattSensor.setFunction(ignBattFunc);
22 }
23
25 // adcVoltsPerVolt is set to 1.0 because vbatt doesn't go thru the analog input divider
26 AdcSubscription::SubscribeSensor(vbattSensor, engineConfiguration->vbattAdcChannel, /* filter HZ = */ 20, /* adcVoltsPerVolt = */ 1.0f);
28 }
29
31 AdcSubscription::SubscribeSensor(ignBattSensor, engineConfiguration->ignKeyAdcChannel, /* filter HZ = */ 20, /* adcVoltsPerVolt = */ 1.0f);
33 }
34}
void configure(float in1, float out1, float in2, float out2, float minOutput, float maxOutput)

Referenced by sensorStartUpOrReconfiguration().

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

◆ initVehicleSpeedSensor()

void initVehicleSpeedSensor ( )

Definition at line 11 of file init_vehicle_speed_sensor.cpp.

11 {
13
14 if (parameter < VSS_FILTER_MIN || parameter > VSS_FILTER_MAX) {
15 parameter = VSS_FILTER_MIN;
16 }
17
18 float filterParameter = 1.0f / parameter;
19
21}
static VehicleSpeedConverter vehicleSpeedConverter

Referenced by sensorStartUpOrReconfiguration().

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

◆ pokeAuxDigital()

void pokeAuxDigital ( )

Definition at line 65 of file init_sensors.cpp.

65 {
66#if EFI_PROD_CODE
67 for (size_t i = 0;i<efi::size(engineConfiguration->luaDigitalInputPins);i++) {
69 }
70#endif // EFI_PROD_CODE
71}
SimpleSwitchedState luaDigitalInputState[LUA_DIGITAL_INPUT_COUNT]
Definition engine.h:217
bool update(bool newState)
Definition efi_output.cpp:9
static EngineAccessor engine
Definition engine.h:413
bool getAuxDigital(int index)
SwitchedState state
Definition efi_output.h:36
switch_input_pin_e luaDigitalInputPins[LUA_DIGITAL_INPUT_COUNT]

Referenced by Engine::updateSwitchInputs().

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

◆ reconfigureSensors()

void reconfigureSensors ( )

Definition at line 168 of file init_sensors.cpp.

168 {
170 startEgt();
171
173}
void startEgt()
Definition init_egt.cpp:47

Referenced by applyNewHardwareSettings().

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

◆ sentPressureDecode()

void sentPressureDecode ( SentInput  sentCh)

Definition at line 130 of file init_fluid_pressure.cpp.

130 {
132 return;
133 }
134
136 uint16_t sig0, sig1;
137 int ret = getSentValues(sentCh, &sig0, &sig1);
138
139 if (ret) {
140 return;
141 }
142
143 /* This sensor sends two pressure signals - average */
144 fuelPressureSensorHigh.postRawValue(((float)sig0 + (float)sig1) / 2, getTimeNowNt());
145 }
146}
void postRawValue(float inputValue, efitick_t timestamp) override
efitick_t getTimeNowNt()
Definition efitime.cpp:19
int getSentValues(SentInput input, uint16_t *sig0, uint16_t *sig1)
Definition sent.cpp:153

Referenced by SentDecoderThread().

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

◆ startEgt()

void startEgt ( )

Definition at line 47 of file init_egt.cpp.

47 {
48 /* TODO: also start CAN sensors */
49#if EFI_MAX_31855
51#else
52 criticalAssertVoid(SPI_NONE == engineConfiguration->max31855spiDevice, "not EFI_MAX_31855");
53#endif /* EFI_MAX_31855 */
54}
void startMax3185x(spi_device_e device, egt_cs_array_t max31855_cs)
Definition max3185x.cpp:563

Referenced by reconfigureSensors().

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

◆ stopEgt()

void stopEgt ( )

Definition at line 40 of file init_egt.cpp.

40 {
41 /* TODO: also stop CAN sensors */
42#if EFI_MAX_31855
44#endif /* EFI_MAX_31855 */
45}
void stopMax3185x()
Definition max3185x.cpp:559

Referenced by stopSensors().

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

◆ stopSensors()

void stopSensors ( )

Definition at line 150 of file init_sensors.cpp.

150 {
153
154 deinitVbatt();
155 deinitTps();
163 deinitMap();
165 stopEgt();
166}
void deInitVehicleSpeedSensor()
void deinitTurbochargerSpeedSensor()
void stopEgt()
Definition init_egt.cpp:40
void deInitFlexSensor()
Definition init_flex.cpp:98
void deinitAuxSensors()
Definition init_aux.cpp:58
void deinitTps()
Definition init_tps.cpp:278
void deinitInputShaftSpeedSensor()
void deinitFluidPressure()
void deinitAuxSpeedSensors()
void deinitThermistors()
void deinitVbatt()
void deinitMap()
Definition init_map.cpp:144
static void deInitAuxDigital()
static void deInitOldAnalogInputs()

Referenced by applyNewHardwareSettings().

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

Go to the source code of this file.