File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -406,22 +406,25 @@ class ModulinoDistance : public Module {
406406 if (tof_sensor == nullptr ) {
407407 return NAN;
408408 }
409+ float ret = internal;
409410 uint8_t NewDataReady = 0 ;
410411 uint8_t status = tof_sensor->VL53L4CD_CheckForDataReady (&NewDataReady);
411412 if (NewDataReady) {
412413 tof_sensor->VL53L4CD_ClearInterrupt ();
413414 tof_sensor->VL53L4CD_GetResult (&results);
414415 }
415416 if (results.range_status == 0 ) {
416- return results.distance_mm ;
417+ internal = results.distance_mm ;
417418 } else {
418- return NAN;
419+ internal = NAN;
419420 }
421+ return ret;
420422 }
421- bool isValid ( float distance ) {
422- return !isnan (distance );
423+ bool available ( ) {
424+ return !isnan (internal );
423425 }
424426private:
425427 VL53L4CD* tof_sensor = nullptr ;
426428 VL53L4CD_Result_t results;
429+ float internal;
427430};
You can’t perform that action at this time.
0 commit comments