We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 37a3984 commit dc4478aCopy full SHA for dc4478a
src/Modulino.h
@@ -402,9 +402,9 @@ class ModulinoDistance : public Module {
402
operator bool() {
403
return (tof_sensor != nullptr);
404
}
405
- float get() {
+ bool available() {
406
if (tof_sensor == nullptr) {
407
- return NAN;
+ return false;
408
409
float ret = internal;
410
uint8_t NewDataReady = 0;
@@ -418,13 +418,13 @@ class ModulinoDistance : public Module {
418
} else {
419
internal = NAN;
420
421
- return ret;
422
- }
423
- bool available() {
424
return !isnan(internal);
425
+ float get() {
+ return internal;
+ }
426
private:
427
VL53L4CD* tof_sensor = nullptr;
428
VL53L4CD_Result_t results;
429
- float internal;
+ float internal = NAN;
430
};
0 commit comments