less hacky implementation

This commit is contained in:
rusefi 2020-09-03 21:47:50 -04:00
parent eb46386c36
commit 7bb5560150
1 changed files with 7 additions and 6 deletions

View File

@ -120,6 +120,13 @@ public:
*/
const char* getSensorName() { return getSensorName(m_type); }
// Retrieve the current reading from the sensor.
//
// Override this in a particular sensor's implementation. As reading sensors is in many hot paths,
// it is unwise to synchronously read the sensor or do anything otherwise costly here. At the most,
// this should be field lookup and simple math.
virtual SensorResult get() const = 0;
protected:
// Protected constructor - only subclasses call this
explicit Sensor(SensorType type)
@ -128,12 +135,6 @@ protected:
static const char* getSensorName(SensorType type);
private:
// Retrieve the current reading from the sensor.
//
// Override this in a particular sensor's implementation. As reading sensors is in many hot paths,
// it is unwise to synchronously read the sensor or do anything otherwise costly here. At the most,
// this should be field lookup and simple math.
virtual SensorResult get() const = 0;
/*
* Get an unconverted value from the sensor, if available.