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 {
391391 tof_sensor = new VL53L4CD ((TwoWire*)getWire (), -1 );
392392 auto ret = tof_sensor->InitSensor ();
393393 if (ret == VL53L4CD_ERROR_NONE) {
394- tof_sensor->VL53L4CD_SetRangeTiming (200 , 0 );
394+ tof_sensor->VL53L4CD_SetRangeTiming (20 , 0 );
395395 tof_sensor->VL53L4CD_StartRanging ();
396396 return true ;
397397 } else {
@@ -412,7 +412,11 @@ class ModulinoDistance : public Module {
412412 tof_sensor->VL53L4CD_ClearInterrupt ();
413413 tof_sensor->VL53L4CD_GetResult (&results);
414414 }
415- return results.distance_mm ;
415+ if (results.range_status == 0 ) {
416+ return results.distance_mm ;
417+ } else {
418+ return NAN;
419+ }
416420 }
417421private:
418422 VL53L4CD* tof_sensor = nullptr ;
You can’t perform that action at this time.
0 commit comments