Skip to content

Commit dc4478a

Browse files
committed
ModulinoDistance: reverse get() and available()
1 parent 37a3984 commit dc4478a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Modulino.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ class ModulinoDistance : public Module {
402402
operator bool() {
403403
return (tof_sensor != nullptr);
404404
}
405-
float get() {
405+
bool available() {
406406
if (tof_sensor == nullptr) {
407-
return NAN;
407+
return false;
408408
}
409409
float ret = internal;
410410
uint8_t NewDataReady = 0;
@@ -418,13 +418,13 @@ class ModulinoDistance : public Module {
418418
} else {
419419
internal = NAN;
420420
}
421-
return ret;
422-
}
423-
bool available() {
424421
return !isnan(internal);
425422
}
423+
float get() {
424+
return internal;
425+
}
426426
private:
427427
VL53L4CD* tof_sensor = nullptr;
428428
VL53L4CD_Result_t results;
429-
float internal;
429+
float internal = NAN;
430430
};

0 commit comments

Comments
 (0)