File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ class ModulinoDistance : public Module {
391
391
tof_sensor = new VL53L4CD ((TwoWire*)getWire (), -1 );
392
392
auto ret = tof_sensor->InitSensor ();
393
393
if (ret == VL53L4CD_ERROR_NONE) {
394
- tof_sensor->VL53L4CD_SetRangeTiming (200 , 0 );
394
+ tof_sensor->VL53L4CD_SetRangeTiming (20 , 0 );
395
395
tof_sensor->VL53L4CD_StartRanging ();
396
396
return true ;
397
397
} else {
@@ -412,7 +412,11 @@ class ModulinoDistance : public Module {
412
412
tof_sensor->VL53L4CD_ClearInterrupt ();
413
413
tof_sensor->VL53L4CD_GetResult (&results);
414
414
}
415
- return results.distance_mm ;
415
+ if (results.range_status == 0 ) {
416
+ return results.distance_mm ;
417
+ } else {
418
+ return NAN;
419
+ }
416
420
}
417
421
private:
418
422
VL53L4CD* tof_sensor = nullptr ;
You can’t perform that action at this time.
0 commit comments