From cbb19df2534d65fa66a476bb32a9494af9609a2b Mon Sep 17 00:00:00 2001 From: Mario Mariete <11509521+melkati@users.noreply.github.com> Date: Tue, 27 Feb 2024 07:00:50 +0100 Subject: [PATCH] Add internal temperature offset initialization and retrieval methods --- src/Sensors.cpp | 15 +++++++++++++++ src/Sensors.hpp | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/src/Sensors.cpp b/src/Sensors.cpp index 65f91946..5bed7daf 100644 --- a/src/Sensors.cpp +++ b/src/Sensors.cpp @@ -353,6 +353,21 @@ void Sensors::tempRegister(bool isCO2temp) { } } +/** + * @brief Initialize internal temperature offset to be used on startup + * + * Positive value for offset to be subtracetd to the temperature. + * Mush be called before the initialization of the sensors. + */ +void Sensors::initTOffset(float offset) { toffset = offset; } + +/** + * @brief Get sensorlib actual internal temperature offset + * @return float with the temperature offset. + * Positive value for offset to be subtracetd to the temperature. + */ +float Sensors::getTOffset() { return toffset; } + /** * @brief Set temperature offset for all temperature sensors * diff --git a/src/Sensors.hpp b/src/Sensors.hpp index 8b78ed58..be2ce711 100644 --- a/src/Sensors.hpp +++ b/src/Sensors.hpp @@ -304,6 +304,10 @@ class Sensors { float getGeigerMicroSievertHour(void); + void initTOffset(float offset); + + float getTOffset(); + void setTempOffset(float offset); float getTempOffset();