rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
redundant_sensor.h
Go to the documentation of this file.
1#pragma once
2
3#include "sensor.h"
4
5class RedundantSensor final : public Sensor
6{
7public:
9 SensorType outputType,
10 SensorType firstSensor,
11 SensorType secondSensor
12 );
13
14 void configure(float maxDifference, bool ignoreSecondSensor);
15
16 SensorResult get() const override;
17
18 bool isRedundant() const override {
19 // This sensor is redundant when not ignoring the second channel
20 return !m_ignoreSecond;
21 }
22
23 void showInfo(const char* sensorName) const override;
24
25private:
26 // The two sensors we interpret to form one redundant sensor
29
30 // How far apart do we allow the sensors to be before reporting an issue?
31 float m_maxDifference = 0;
32
33 // Should we ignore the second sensor? (disable redundancy)
34 bool m_ignoreSecond = false;
35};
const SensorType m_first
void configure(float maxDifference, bool ignoreSecondSensor)
SensorResult get() const override
const SensorType m_second
bool isRedundant() const override
void showInfo(const char *sensorName) const override
Base class for sensors. Inherit this class to implement a new type of sensor.
expected< float > SensorResult
Definition sensor.h:46
SensorType
Definition sensor_type.h:18