rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions
FunctionalSensor Class Reference

Class for sensors that convert from some raw floating point value (ex: voltage, frequency, pulse width) to a sensor reading. More...

#include <functional_sensor.h>

Inheritance diagram for FunctionalSensor:
Inheritance graph
[legend]
Collaboration diagram for FunctionalSensor:
Collaboration graph
[legend]

Public Member Functions

 FunctionalSensor (SensorType type, efidur_t timeoutPeriod)
 
void showInfo (const char *sensorName) const override
 
- Public Member Functions inherited from FunctionalSensorImpl< SensorConverter >
 FunctionalSensorImpl (SensorType type, efidur_t timeoutPeriod)
 
void postRawValue (float inputValue, efitick_t timestamp) override
 
void setFunction (SensorConverter &func)
 
SensorConvertergetFunction () const
 
float getRaw () const override final
 
- Public Member Functions inherited from StoredValueSensor
SensorResult get () const final override
 
 StoredValueSensor (SensorType type, efidur_t timeoutNt)
 
void invalidate ()
 
void invalidate (UnexpectedCode why)
 
void setValidValue (float value, efitick_t timestamp)
 
void showInfo (const char *sensorName) const override
 
virtual void setTimeout (int timeoutMs)
 
- Public Member Functions inherited from Sensor
bool Register ()
 
const chargetSensorName () const
 
virtual bool hasSensor () const
 
virtual bool isRedundant () const
 
void unregister ()
 
SensorType type () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Sensor
static void showAllSensorInfo ()
 
static void showInfo (SensorType type)
 
static void resetRegistry ()
 
static const SensorgetSensorOfType (SensorType type)
 
static SensorResult get (SensorType type)
 
static float getOrZero (SensorType type)
 
static float getRaw (SensorType type)
 
static bool isRedundant (SensorType type)
 
static bool hasSensor (SensorType type)
 
static void setMockValue (SensorType type, float value, bool mockRedundant=false)
 
static void setInvalidMockValue (SensorType type)
 
static void resetMockValue (SensorType type)
 
static void resetAllMocks ()
 
static void inhibitTimeouts (bool inhibit)
 
static const chargetSensorName (SensorType type)
 
- Protected Member Functions inherited from FunctionalSensorBase
 FunctionalSensorBase (SensorType type, efidur_t timeoutPeriod)
 
- Protected Member Functions inherited from Sensor
 Sensor (SensorType type)
 
- Static Protected Attributes inherited from Sensor
static bool s_inhibitSensorTimeouts = false
 

Detailed Description

Class for sensors that convert from some raw floating point value (ex: voltage, frequency, pulse width) to a sensor reading.

To use this class, implement the conversion operation for your sensor as a class that inherits from SensorConverter, and implement convert to convert a raw reading from the sensor to a usable value (and valid bit).

Register an instance of the new class with an interface that provides and posts raw values so the sensor can update.

Definition at line 24 of file functional_sensor.h.

Constructor & Destructor Documentation

◆ FunctionalSensor()

FunctionalSensor::FunctionalSensor ( SensorType  type,
efidur_t  timeoutPeriod 
)

Definition at line 9 of file functional_sensor.cpp.

10 : FunctionalSensorImpl(type, timeoutPeriod) {
11}
SensorType type() const
Definition sensor.h:162

Member Function Documentation

◆ showInfo()

void FunctionalSensor::showInfo ( const char sensorName) const
overridevirtual

Implements Sensor.

Definition at line 26 of file sensor_info_printing.cpp.

26 {
27 const auto value = get();
28 efiPrintf("Sensor \"%s\": Raw value: %.2f Valid: %s Converted value %.2f", sensorName, getRaw(), boolToString(value.Valid), value.Value);
29
30 // now print out the underlying function's info
31 if (auto func = getFunction()) {
32 func->showInfo(getRaw());
33 }
34}
SensorResult get() const final override
const char * boolToString(bool value)
Definition efilib.cpp:19
Here is the call graph for this function:

The documentation for this class was generated from the following files: