Thanks John, This scaling factor of 2048 works!
I am considering using a large gain factor like 6.5 (UM2133 says it must be <7) to increase the granularity of the distance measurement. The normal data output is to the nearest mm but if I increase the gain to 6.5 and then divide the results by 6.5 in the host, I'm able to get 1mm/6.5 granularity. Do you see any problem with this approach?
For my application, I only need to detect objects up to a max distance of about 300mm. I'm using multiple ROIs and comparing the results. I'm looking to get the highest accuracy possible at close range (80-250mm). Thanks.
Here's the code snippet I'm using to get and modify histogram_ranging_gain_factor in case other users may find it helpful:
VL53L1_CalibrationData_t CalibrationData;
VL53L1_CalibrationData_t *pCalibrationData = &CalibrationData;
status = VL53L1_GetCalibrationData(Dev, pCalibrationData);
if(status){
printf("VL53L1_GetCalibrationData failed: error = %d\r\n", status);
while(1);
}
printf("original histogram_ranging_gain_factor: %f\r\n",
pCalibrationData->gain_cal.histogram_ranging_gain_factor/2048.0);
float gain = .970215; //default is 0.970215
pCalibrationData->gain_cal.histogram_ranging_gain_factor = gain * 2048;
printf("new histogram_ranging_gain_factor: %f\r\n",
pCalibrationData->gain_cal.histogram_ranging_gain_factor/2048.0);