From 650a3c45f0138d65558d1bd9f6fd0b2f2a4c2cd8 Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Fri, 28 Jun 2024 10:25:17 +0200 Subject: [PATCH] 0.3.3 DS18B20_INT --- libraries/DS18B20_INT/CHANGELOG.md | 6 +++++- libraries/DS18B20_INT/README.md | 5 +++-- .../DS18B20_performance/DS18B20_performance.ino | 10 ++++++++++ libraries/DS18B20_INT/library.json | 2 +- libraries/DS18B20_INT/library.properties | 2 +- libraries/DS18B20_INT/src/DS18B20_INT.cpp | 11 +++++++---- libraries/DS18B20_INT/src/DS18B20_INT.h | 6 +++--- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/libraries/DS18B20_INT/CHANGELOG.md b/libraries/DS18B20_INT/CHANGELOG.md index 64801842..bff8df1a 100644 --- a/libraries/DS18B20_INT/CHANGELOG.md +++ b/libraries/DS18B20_INT/CHANGELOG.md @@ -6,11 +6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.3] - 2024-06-27 +- add connectCheck parameter to getTempC() +- update readme.md +- minor edits + ## [0.3.2] - 2024-01-03 - fix examples - minor edits - ## [0.3.1] - 2023-10-19 - update readme.md diff --git a/libraries/DS18B20_INT/README.md b/libraries/DS18B20_INT/README.md index 38efcaca..3e6be5b1 100644 --- a/libraries/DS18B20_INT/README.md +++ b/libraries/DS18B20_INT/README.md @@ -57,8 +57,9 @@ There will be a number of retries to connect, default 3. There will be a number of retries to connect, default 3. - **void requestTemperatures()** trigger temperature conversion. - **bool isConversionComplete()** check if conversion is complete. -- **int16_t getTempC()** returns temperature in whole degrees only. -55..125 -or -127 = DEVICE_DISCONNECTED +- **int16_t getTempC(bool connectCheck = true)** returns temperature in whole degrees only. +-55..125 or -127 = DEVICE_DISCONNECTED +Is faster when connectCheck is set to false. Default true = backwards compatible. - **bool getAddress()** returns true if the sensor is configured (available). diff --git a/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino b/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino index 0d049d4e..fb4401ad 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino @@ -97,6 +97,16 @@ void setup() Serial.println(stop - start); delay(10); + + start = micros(); + temp = sensor.getTempC(false); + stop = micros(); + Serial.print("\ngetTempC(false): \t"); + Serial.println(temp); + Serial.print("Time: \t"); + Serial.println(stop - start); + delay(10); + } diff --git a/libraries/DS18B20_INT/library.json b/libraries/DS18B20_INT/library.json index 80290e32..baf262f2 100644 --- a/libraries/DS18B20_INT/library.json +++ b/libraries/DS18B20_INT/library.json @@ -23,7 +23,7 @@ "version": "^2.3.5" } ], - "version": "0.3.2", + "version": "0.3.3", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/libraries/DS18B20_INT/library.properties b/libraries/DS18B20_INT/library.properties index 16c87b4e..a55a8bec 100644 --- a/libraries/DS18B20_INT/library.properties +++ b/libraries/DS18B20_INT/library.properties @@ -1,5 +1,5 @@ name=DS18B20_int -version=0.3.2 +version=0.3.3 author=Rob Tillaart maintainer=Rob Tillaart sentence=Library for DS18B20 restricted to a single sensor per pin. diff --git a/libraries/DS18B20_INT/src/DS18B20_INT.cpp b/libraries/DS18B20_INT/src/DS18B20_INT.cpp index cd818cb0..b3cdb777 100644 --- a/libraries/DS18B20_INT/src/DS18B20_INT.cpp +++ b/libraries/DS18B20_INT/src/DS18B20_INT.cpp @@ -1,7 +1,7 @@ // // FILE: DS18B20_INT.cpp // AUTHOR: Rob.Tillaart -// VERSION: 0.3.2 +// VERSION: 0.3.3 // DATE: 2017-07-25 // PURPOSE: library for DS18B20 temperature sensor - integer only. // URL: https://github.com/RobTillaart/DS18B20_INT @@ -72,11 +72,14 @@ bool DS18B20_INT::isConversionComplete(void) } -int16_t DS18B20_INT::getTempC(void) +int16_t DS18B20_INT::getTempC(bool connectCheck) { - if (isConnected(3) == false) + if (connectCheck) { - return DEVICE_DISCONNECTED; + if (isConnected(3) == false) + { + return DEVICE_DISCONNECTED; + } } int16_t rawTemperature = _readRaw(); rawTemperature >>= 4; diff --git a/libraries/DS18B20_INT/src/DS18B20_INT.h b/libraries/DS18B20_INT/src/DS18B20_INT.h index f7ae647b..e0117d5b 100644 --- a/libraries/DS18B20_INT/src/DS18B20_INT.h +++ b/libraries/DS18B20_INT/src/DS18B20_INT.h @@ -2,7 +2,7 @@ // // FILE: DS18B20_INT.h // AUTHOR: Rob.Tillaart -// VERSION: 0.3.2 +// VERSION: 0.3.3 // DATE: 2017-07-25 // PURPOSE: Minimalistic library for DS18B20 temperature sensor // uses only integer math (no float to minimize footprint) @@ -25,7 +25,7 @@ #include "OneWire.h" -#define DS18B20_INT_LIB_VERSION (F("0.3.2")) +#define DS18B20_INT_LIB_VERSION (F("0.3.3")) // Error Code #define DEVICE_DISCONNECTED -127 @@ -42,7 +42,7 @@ public: bool isConnected(uint8_t retries = 3); void requestTemperatures(void); - int16_t getTempC(void); + int16_t getTempC(bool connectCheck = true); bool isConversionComplete(void); bool getAddress(uint8_t* buf);