From 859220d33f6e4b55e78e3dcb65f879a4d67f2599 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Fri, 28 Aug 2020 17:55:07 +0200 Subject: [PATCH] Added missing getter --- src/HwTools.cpp | 11 +++++++++++ src/HwTools.h | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/HwTools.cpp b/src/HwTools.cpp index 23678229..cb07d4d6 100644 --- a/src/HwTools.cpp +++ b/src/HwTools.cpp @@ -16,6 +16,17 @@ void HwTools::setTempSensorPin(int tempSensorPin) { } } +void HwTools::setTempAnalogSensorPin(int tempAnalogSensorPin) { + if(tempAnalogSensorPin != this->tempAnalogSensorPin) { + if(tempAnalogSensorPin > 0 && tempAnalogSensorPin < 40) { + this->tempAnalogSensorPin = tempAnalogSensorPin; + pinMode(tempAnalogSensorPin, INPUT); + } else { + this->tempAnalogSensorPin = 0xFF; + } + } +} + void HwTools::setVccPin(int vccPin) { if(vccPin > 0 && vccPin < 40) { pinMode(vccPin, INPUT); diff --git a/src/HwTools.h b/src/HwTools.h index b97c2894..d414cbff 100644 --- a/src/HwTools.h +++ b/src/HwTools.h @@ -39,7 +39,7 @@ public: TempSensorData* getTempSensorData(uint8_t i); bool updateTemperatures(); double getTemperature(); - double getTemperature(); + double getTemperatureAnalog(); double getTemperature(uint8_t address[8]); int getWifiRssi(); void setLed(uint8_t ledPin, bool ledInverted); @@ -50,9 +50,9 @@ public: HwTools() {}; private: - uint8_t tempSensorPin = -1, tempAnalogSensorPin = -1; - uint8_t vccPin = -1; - uint8_t ledPin = -1, ledPinRed = -1, ledPinGreen = -1, ledPinBlue = -1; + uint8_t tempSensorPin = 0xFF, tempAnalogSensorPin = 0xFF; + uint8_t vccPin = 0xFF; + uint8_t ledPin = 0xFF, ledPinRed = 0xFF, ledPinGreen = 0xFF, ledPinBlue = 0xFF; bool ledInverted, ledRgbInverted; double vccOffset = 0.0; double vccMultiplier = 1.0;