Skip to content

Commit 2e6da04

Browse files
committed
Correctly return 0 in begin() if sensor not mounted
1 parent 59bc129 commit 2e6da04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/HS300x.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ HS300xClass::HS300xClass(TwoWire& wire) :
8888
int HS300xClass::begin()
8989
{
9090
_wire->begin();
91+
if (_measurementReq() <= 0) {
92+
return 0;
93+
}
9194
return 1;
9295
}
9396

0 commit comments

Comments
 (0)