#include "init.h" #include "adc_inputs.h" #include "adc_subscription.h" #include "engine_configuration.h" #include "functional_sensor.h" #include "table_func.h" EXTERN_CONFIG; static FunctionalSensor fuelSensor(SensorType::FuelLevel, /* timeout = */ MS2NT(500)); #if !EFI_UNIT_TEST // extract the type of the elements in the bin/value arrays using BinType = std::remove_extent_t; using ValueType = std::remove_extent_t; static TableFunc , // Values are stored in percent efi::ratio<1>> fuelCurve(CONFIG(fuelLevelBins), CONFIG(fuelLevelValues)); void initFuelLevel(DECLARE_CONFIG_PARAMETER_SIGNATURE) { adc_channel_e channel = CONFIG(fuelLevelSensor); if (!isAdcChannelValid(channel)) { return; } fuelSensor.setFunction(fuelCurve); // Filtering with such a small bandwidth helps prevent noisy data from fuel tank slosh AdcSubscription::SubscribeSensor(fuelSensor, channel, /*lowpassCutoff =*/ 0.05f); fuelSensor.Register(); } #endif // ! EFI_UNIT_TEST