I don't see the code for some reason, but let's do an overview of the calibration process.
There are two calibrations. Offset and Crosstalk.
if you don't have a coverglass, you can skip the crosstalk - you don't have any.
You can also buy a crosstalk free coverglass from www.hornix.com.tw and skip the crosstalk.
Do the offset first. There is a function call that takes as an argument the correct distance.
Place a bright, flat target at a close distance. 14cm would be good. White paper makes a good target as well.
the sensor will range a lot, average the result and then apply that offset on every range.
Next do the crosstalk - which is a little less defined.
You must find that point where the sensor under-ranges by 10 or 20%. This is an experimental result.
You will find using a dark gray will allow you to use a nearer distance. Keep in mind that the target diameter must be at least half the distance you are using.
The sensor has no persistent memory. So after calibrating extract the cal data for next time. Store it in your device, and load it on rebooting the chip.
- john
If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.