Skip to content

Commit 7cf2c24

Browse files
committed
Fix deep debugging on SDI-12
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
1 parent a45df5a commit 7cf2c24

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/sensors/SDI12Sensors.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,19 @@ bool SDI12Sensors::addSingleMeasurementResult(void) {
552552
while ((millis() - timerStart) < (1000 * (wait))) {
553553
// sensor can interrupt us to let us know it is done early
554554
if (_SDI12Internal.available()) {
555+
#ifdef MS_SDI12SENSORS_DEBUG_DEEP
556+
// if we're debugging print out early response
555557
MS_DEEP_DBG(F(" <<<"),
556558
_SDI12Internal.readStringUntil('\n'));
557559
_SDI12Internal.clearBuffer();
558560
break;
561+
#else
562+
// if we're not debugging, just read the response to make
563+
// sure it's removed from the buffer
564+
_SDI12Internal.readStringUntil('\n');
565+
_SDI12Internal.clearBuffer();
566+
break;
567+
#endif
559568
}
560569
}
561570
// Wait for anything else and clear it out

0 commit comments

Comments
 (0)