ToF sensor code by Pololu translated from Arduino to mbed

Files at this revision

API Documentation at this revision

Comitter:
jvfausto
Date:
Wed Aug 01 18:45:48 2018 +0000
Parent:
3:20f0c879da8c
Commit message:
Timeout fix

Changed in this revision

VL53L1X.h Show annotated file Show diff for this revision Revisions of this file
diff -r 20f0c879da8c -r cbf407c53998 VL53L1X.h
--- a/VL53L1X.h	Wed Aug 01 18:42:33 2018 +0000
+++ b/VL53L1X.h	Wed Aug 01 18:45:48 2018 +0000
@@ -1372,10 +1372,10 @@
     DistanceMode distance_mode;
  
     // Record the current time to check an upcoming timeout against
-    void startTimeout() { timeout_start_ms = t.read()/10000; }
+    void startTimeout() { timeout_start_ms = t.read()*1000; }
  
     // Check if timeout is enabled (set to nonzero value) and has expired
-    bool checkTimeoutExpired() {return (io_timeout > 0) && ((uint16_t)(t.read()/10000 - timeout_start_ms) > io_timeout); }
+    bool checkTimeoutExpired() {return (io_timeout > 0) && ((uint16_t)(t.read()*1000 - timeout_start_ms) > io_timeout); }
  
     void setupManualCalibration();
     void readResults();