rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
init_aux.cpp
Go to the documentation of this file.
1#include "pch.h"
2
3#include "init.h"
4#include "adc_subscription.h"
5#include "functional_sensor.h"
6#include "identity_func.h"
7
8// These aux sensors just read voltage - so the converter function has nothing to do
9
11 { SensorType::AuxAnalog1, MS2NT(50) },
12 { SensorType::AuxAnalog2, MS2NT(50) },
13 { SensorType::AuxAnalog3, MS2NT(50) },
14 { SensorType::AuxAnalog4, MS2NT(50) },
15 { SensorType::AuxAnalog5, MS2NT(50) },
16 { SensorType::AuxAnalog6, MS2NT(50) },
17 { SensorType::AuxAnalog7, MS2NT(50) },
18 { SensorType::AuxAnalog8, MS2NT(50) },
19};
20
22 { SensorType::LuaGauge1, MS2NT(5000) },
23 { SensorType::LuaGauge2, MS2NT(5000) },
24 { SensorType::LuaGauge3, MS2NT(5000) },
25 { SensorType::LuaGauge4, MS2NT(5000) },
26 { SensorType::LuaGauge5, MS2NT(5000) },
27 { SensorType::LuaGauge6, MS2NT(5000) },
28 { SensorType::LuaGauge7, MS2NT(5000) },
29 { SensorType::LuaGauge8, MS2NT(5000) },
30};
31
32
33static_assert(efi::size(auxSensors) == LUA_ANALOG_INPUT_COUNT);
34static_assert(efi::size(luaGauges) == LUA_GAUGE_COUNT);
35
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}
57
59 for (size_t i = 0; i < efi::size(engineConfiguration->auxAnalogInputs); i++) {
62 }
63}
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)
static void UnsubscribeSensor(FunctionalSensorBase &sensor)
Class for sensors that convert from some raw floating point value (ex: voltage, frequency,...
bool Register()
Definition sensor.cpp:131
void unregister()
Definition sensor.cpp:135
Base class for sensors that compute a value on one thread, and want to make it available to consumers...
static constexpr engine_configuration_s * engineConfiguration
IdentityFunction identityFunction
static FunctionalSensor auxSensors[]
Definition init_aux.cpp:10
void deinitAuxSensors()
Definition init_aux.cpp:58
void initAuxSensors()
Definition init_aux.cpp:36
StoredValueSensor luaGauges[]
Definition init_aux.cpp:21
static Lps25Sensor sensor(device)