Question concerning issues developing drivers for VL6180X tof sensor

Hello,

I recently purchased the VL6180X Time-of-Flight Distance Sensor Carrier with Voltage Regulator for short-distance measurement in a personal project. I am using the sensor on the Jetson Nano developer kit and developed my code based off the JetsonHacks VL53L0X library and Pololu VL6180X library. After I was able to successfully read measurement inputs from the sensor I encountered an issue where it could only read a measurement of 135mm. Regardless of if I had an object over the sensor or nothing at all a measurement of 135mm was read in.

In a previous post I made, VL6180X Range-reading Issue, support assisted me with determining that my code was the root of the problem. My belief is that I’m making mistakes in writing and reading to the sensors registers, however, I can’t quite seem to grasp the i2c_smbus_write/read functions to troubleshoot the issue.

I’ve uploaded the code to a github repo here: https://github.com/adani111/VL6180X-Jetson-Nano-Drivers
If you have any experience in using i2c and sensors please feel free to help out, any advice will be greatly appreciated.

Update: I’ve realized that the issue with consistently reading a range val of 135mm from the result_range_val register is not the only issue. I’ve tried reading outputs from other registers and found that they all return 135, therefore, I’m not sure if the issue is only in me incorrectly reading/writing to the registers.