Skip to content

Commit 03e45af

Browse files
committed
Allow a non-zero wait time for SDI-12 sensors
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
1 parent 1af387b commit 03e45af

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3939
### Fixed
4040
- Fixed non-concurrent data fetch for SDI-12 when *NOT* using debugging.
4141
- Fixed internet connection when in "testing mode"
42+
- Allow a non-zero wait time for SDI-12 sensors
4243

4344
***
4445

src/sensors/SDI12Sensors.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ int8_t SDI12Sensors::startSDI12Measurement(bool isConcurrent) {
268268
// Try up to 3 times to start a measurement
269269
uint8_t numVariables = 0;
270270
uint8_t ntries = 0;
271-
int8_t wait = 0;
271+
int8_t wait = -1; // NOTE: The wait time can be 0!
272272
while (numVariables != (_numReturnedValues - _incCalcValues) &&
273273
ntries < 5) {
274274
if (isConcurrent) {
@@ -358,7 +358,7 @@ bool SDI12Sensors::startSingleMeasurement(void) {
358358
if (!wasActive) _SDI12Internal.end();
359359

360360
// Set the times we've activated the sensor and asked for a measurement
361-
if (wait > 0) {
361+
if (wait >= 0) {
362362
MS_DBG(F(" Concurrent measurement started."));
363363
// Update the time that a measurement was requested
364364
_millisMeasurementRequested = millis();
@@ -537,7 +537,7 @@ bool SDI12Sensors::addSingleMeasurementResult(void) {
537537
int8_t wait = startSDI12Measurement(false);
538538

539539
// Set the times we've activated the sensor and asked for a measurement
540-
if (wait > 0) {
540+
if (wait >= 0) {
541541
MS_DBG(F(" NON-concurrent measurement started."));
542542
// Update the time that a measurement was requested
543543
_millisMeasurementRequested = millis();

0 commit comments

Comments
 (0)