From 74425b020b0dcd4336f9ad70e6152258aa632901 Mon Sep 17 00:00:00 2001 From: Alberto Nidasio <alberto.nidasio@skywarder.eu> Date: Fri, 25 Feb 2022 14:05:05 +0100 Subject: [PATCH] [MAX6675] Changed self test --- src/shared/sensors/MAX6675/MAX6675.cpp | 6 ++++-- src/shared/sensors/MAX6675/MAX6675.h | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shared/sensors/MAX6675/MAX6675.cpp b/src/shared/sensors/MAX6675/MAX6675.cpp index 847d00656..08ca8e301 100644 --- a/src/shared/sensors/MAX6675/MAX6675.cpp +++ b/src/shared/sensors/MAX6675/MAX6675.cpp @@ -42,7 +42,9 @@ SPIBusConfig MAX6675::getDefaultSPIConfig() bool MAX6675::init() { return true; } -bool MAX6675::selfTest() +bool MAX6675::selfTest() { return true; } + +bool MAX6675::checkConnection() { uint16_t sample; @@ -51,7 +53,7 @@ bool MAX6675::selfTest() sample = spi.read16(); } - // The third bit (D2) indicates wheter the termocouple is connected or not. + // The third bit (D2) indicates wheter the termocouple is connected or not // It is high if open if ((sample % 0x2) != 0) { diff --git a/src/shared/sensors/MAX6675/MAX6675.h b/src/shared/sensors/MAX6675/MAX6675.h index ad1245190..127654931 100644 --- a/src/shared/sensors/MAX6675/MAX6675.h +++ b/src/shared/sensors/MAX6675/MAX6675.h @@ -62,6 +62,11 @@ public: */ bool selfTest(); + /** + * @brief Checks whether the thermocouple is connected or not. + */ + bool checkConnection(); + private: TemperatureData sampleImpl() override; -- GitLab