From 7ea5521760aa5b3a2bd812738b8ff5e7f8084a41 Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Wed, 3 Jan 2024 12:36:16 +0100 Subject: [PATCH] 0.3.2 DS18B20_INT --- libraries/DS18B20_INT/CHANGELOG.md | 6 ++- libraries/DS18B20_INT/LICENSE | 2 +- libraries/DS18B20_INT/README.md | 4 +- .../examples/DS18B20_INT/DS18B20_INT.ino | 3 +- .../DS18B20_INT_getTempCentiC.ino | 4 +- .../DS18B20_getAddress/DS18B20_getAddress.ino | 6 +-- .../DS18B20_minimum/DS18B20_minimum.ino | 2 +- .../DS18B20_performance.ino | 6 +-- .../DS18B20_simple/DS18B20_simple.ino | 11 +++-- .../examples/oneWireSearch/oneWireSearch.ino | 42 ++++++++++--------- libraries/DS18B20_INT/library.json | 2 +- libraries/DS18B20_INT/library.properties | 2 +- libraries/DS18B20_INT/src/DS18B20_INT.cpp | 9 ++-- libraries/DS18B20_INT/src/DS18B20_INT.h | 11 ++--- 14 files changed, 62 insertions(+), 48 deletions(-) diff --git a/libraries/DS18B20_INT/CHANGELOG.md b/libraries/DS18B20_INT/CHANGELOG.md index fac287f2..64801842 100644 --- a/libraries/DS18B20_INT/CHANGELOG.md +++ b/libraries/DS18B20_INT/CHANGELOG.md @@ -6,10 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.2] - 2024-01-03 +- fix examples +- minor edits + + ## [0.3.1] - 2023-10-19 - update readme.md - ## [0.3.0] - 2023-03-05 - fix #15 infinite loop - move sources to src folder to comply with PlatformIO dependency system. diff --git a/libraries/DS18B20_INT/LICENSE b/libraries/DS18B20_INT/LICENSE index 562b0ffe..a4357241 100644 --- a/libraries/DS18B20_INT/LICENSE +++ b/libraries/DS18B20_INT/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2023 Rob Tillaart +Copyright (c) 2017-2024 Rob Tillaart Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/libraries/DS18B20_INT/README.md b/libraries/DS18B20_INT/README.md index 99af9fe8..38efcaca 100644 --- a/libraries/DS18B20_INT/README.md +++ b/libraries/DS18B20_INT/README.md @@ -65,7 +65,7 @@ or -127 = DEVICE_DISCONNECTED #### CentiC part The following functions are experimental since 0.2.0 and not tested a lot by me. -They allow to use a higher resolution while not using floats. +They allow to use a higher resolution while **not using floats**. Goal is to keep the footprint of the library small. - **bool setResolution(uint8_t resolution = 9)** sets the internal resolution to 9, 10, 11 or 12 bits. @@ -148,7 +148,7 @@ Measured with DS18B20_performance.ino ## Credits Miles Burton who originally developed the Arduino Temperature Control Library. -and all people who contributed to that lib. +and all people who contributed to that library. ## Future diff --git a/libraries/DS18B20_INT/examples/DS18B20_INT/DS18B20_INT.ino b/libraries/DS18B20_INT/examples/DS18B20_INT/DS18B20_INT.ino index 8b032560..05d0bef9 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_INT/DS18B20_INT.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_INT/DS18B20_INT.ino @@ -7,6 +7,7 @@ #include "DS18B20_INT.h" + #define ONE_WIRE_BUS 2 OneWire oneWire(ONE_WIRE_BUS); @@ -45,4 +46,4 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/examples/DS18B20_INT_getTempCentiC/DS18B20_INT_getTempCentiC.ino b/libraries/DS18B20_INT/examples/DS18B20_INT_getTempCentiC/DS18B20_INT_getTempCentiC.ino index 42fa1612..7147790f 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_INT_getTempCentiC/DS18B20_INT_getTempCentiC.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_INT_getTempCentiC/DS18B20_INT_getTempCentiC.ino @@ -7,11 +7,13 @@ #include "DS18B20_INT.h" + #define ONE_WIRE_BUS 2 OneWire oneWire(ONE_WIRE_BUS); DS18B20_INT sensor(&oneWire); + uint32_t start, stop; @@ -47,4 +49,4 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/examples/DS18B20_getAddress/DS18B20_getAddress.ino b/libraries/DS18B20_INT/examples/DS18B20_getAddress/DS18B20_getAddress.ino index fe663c8d..30abec5c 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_getAddress/DS18B20_getAddress.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_getAddress/DS18B20_getAddress.ino @@ -4,8 +4,8 @@ // PURPOSE: DS18B20 lib getAddress demo // URL: https://github.com/RobTillaart/DS18B20_INT -#include -#include + +#include "DS18B20_INT.h" #define ONE_WIRE_BUS 2 @@ -52,5 +52,5 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/examples/DS18B20_minimum/DS18B20_minimum.ino b/libraries/DS18B20_INT/examples/DS18B20_minimum/DS18B20_minimum.ino index 3fec2db5..2d648f74 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_minimum/DS18B20_minimum.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_minimum/DS18B20_minimum.ino @@ -37,5 +37,5 @@ void loop(void) } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino b/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino index eb93036d..0d049d4e 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_performance/DS18B20_performance.ino @@ -5,8 +5,7 @@ // URL: https://github.com/RobTillaart/DS18B20_INT -#include -#include +#include "DS18B20_INT.h" #define ONE_WIRE_BUS 2 @@ -16,6 +15,7 @@ DS18B20_INT sensor(&oneWire); DeviceAddress da; + uint32_t start, stop; @@ -105,4 +105,4 @@ void loop() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/examples/DS18B20_simple/DS18B20_simple.ino b/libraries/DS18B20_INT/examples/DS18B20_simple/DS18B20_simple.ino index f43596fb..0017511f 100644 --- a/libraries/DS18B20_INT/examples/DS18B20_simple/DS18B20_simple.ino +++ b/libraries/DS18B20_INT/examples/DS18B20_simple/DS18B20_simple.ino @@ -5,8 +5,7 @@ // URL: https://github.com/RobTillaart/DS18B20_INT -#include -#include +#include "DS18B20_INT.h" #define ONE_WIRE_BUS 2 @@ -33,12 +32,16 @@ void loop(void) { sensor.requestTemperatures(); - while (!sensor.isConversionComplete()); // (BLOCKING!!) wait until sensor is ready + // BLOCKING!! blocks until sensor is ready + while (!sensor.isConversionComplete()) + { + delay(1); + } Serial.print("Temp: "); Serial.println(sensor.getTempC()); } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/examples/oneWireSearch/oneWireSearch.ino b/libraries/DS18B20_INT/examples/oneWireSearch/oneWireSearch.ino index 69da95f7..bf6b6c3c 100644 --- a/libraries/DS18B20_INT/examples/oneWireSearch/oneWireSearch.ino +++ b/libraries/DS18B20_INT/examples/oneWireSearch/oneWireSearch.ino @@ -27,25 +27,7 @@ const int startPin = 2; const int endPin = 20; -#include - - -void setup() -{ - Serial.begin(115200); - Serial.println("//\n// Start oneWireSearch.ino \n//"); - - for (uint8_t pin = startPin; pin < endPin; pin++) - { - findDevices(pin); - } - Serial.println("\n//\n// End oneWireSearch.ino \n//"); -} - - -void loop() -{ -} +#include "OneWire.h" uint8_t findDevices(int pin) @@ -92,5 +74,25 @@ uint8_t findDevices(int pin) } -// -- END OF FILE -- + +void setup() +{ + Serial.begin(115200); + Serial.println("//\n// Start oneWireSearch.ino \n//"); + + for (uint8_t pin = startPin; pin < endPin; pin++) + { + findDevices(pin); + } + Serial.println("\n//\n// End oneWireSearch.ino \n//"); +} + + +void loop() +{ +} + + + +// -- END OF FILE -- diff --git a/libraries/DS18B20_INT/library.json b/libraries/DS18B20_INT/library.json index 48b5d6f8..80290e32 100644 --- a/libraries/DS18B20_INT/library.json +++ b/libraries/DS18B20_INT/library.json @@ -23,7 +23,7 @@ "version": "^2.3.5" } ], - "version": "0.3.1", + "version": "0.3.2", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/libraries/DS18B20_INT/library.properties b/libraries/DS18B20_INT/library.properties index 595bcc8d..16c87b4e 100644 --- a/libraries/DS18B20_INT/library.properties +++ b/libraries/DS18B20_INT/library.properties @@ -1,5 +1,5 @@ name=DS18B20_int -version=0.3.1 +version=0.3.2 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 218d405f..cd818cb0 100644 --- a/libraries/DS18B20_INT/src/DS18B20_INT.cpp +++ b/libraries/DS18B20_INT/src/DS18B20_INT.cpp @@ -1,9 +1,9 @@ // // FILE: DS18B20_INT.cpp -// AUTHOR: Rob.Tillaart@gmail.com -// VERSION: 0.3.1 +// AUTHOR: Rob.Tillaart +// VERSION: 0.3.2 // DATE: 2017-07-25 -// PUPROSE: library for DS18B20 temperature sensor - integer only. +// PURPOSE: library for DS18B20 temperature sensor - integer only. // URL: https://github.com/RobTillaart/DS18B20_INT // https://github.com/RobTillaart/DS18B20_RT @@ -88,7 +88,7 @@ int16_t DS18B20_INT::getTempC(void) } -bool DS18B20_INT::getAddress(uint8_t* buf) +bool DS18B20_INT::getAddress(uint8_t * buf) { if (_addressFound) { @@ -146,6 +146,7 @@ int16_t DS18B20_INT::_readRaw(void) _oneWire->reset(); _oneWire->select(_deviceAddress); _oneWire->write(READSCRATCH); + int16_t rawTemperature = ((int16_t)_oneWire->read()); rawTemperature |= _oneWire->read() << 8; _oneWire->reset(); diff --git a/libraries/DS18B20_INT/src/DS18B20_INT.h b/libraries/DS18B20_INT/src/DS18B20_INT.h index 202f531b..f7ae647b 100644 --- a/libraries/DS18B20_INT/src/DS18B20_INT.h +++ b/libraries/DS18B20_INT/src/DS18B20_INT.h @@ -1,10 +1,10 @@ #pragma once // // FILE: DS18B20_INT.h -// AUTHOR: Rob.Tillaart@gmail.com -// VERSION: 0.3.1 +// AUTHOR: Rob.Tillaart +// VERSION: 0.3.2 // DATE: 2017-07-25 -// PUPROSE: Minimalistic library for DS18B20 temperature sensor +// PURPOSE: Minimalistic library for DS18B20 temperature sensor // uses only integer math (no float to minimize footprint) // URL: https://github.com/RobTillaart/DS18B20_INT // https://github.com/RobTillaart/DS18B20_RT @@ -21,11 +21,12 @@ // -#define DS18B20_INT_LIB_VERSION (F("0.3.1")) - #include "Arduino.h" #include "OneWire.h" + +#define DS18B20_INT_LIB_VERSION (F("0.3.2")) + // Error Code #define DEVICE_DISCONNECTED -127