| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #pragma once | |||
| 2 | ||||
| 3 | #include "sensor.h" | |||
| 4 | ||||
| 5 | class RedundantSensor final : public Sensor | |||
| 6 | { | |||
| 7 | public: | |||
| 8 | RedundantSensor( | |||
| 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 | 210 | bool isRedundant() const override { | ||
| 19 | // This sensor is redundant when not ignoring the second channel | |||
| 20 | 210 | return !m_ignoreSecond; | ||
| 21 | } | |||
| 22 | ||||
| 23 | void showInfo(const char* sensorName) const override; | |||
| 24 | ||||
| 25 | private: | |||
| 26 | // The two sensors we interpret to form one redundant sensor | |||
| 27 | const SensorType m_first; | |||
| 28 | const SensorType m_second; | |||
| 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 | }; | |||
| 36 |