vl53l1: fix xtalk calib data abnormal.

customer.algo__crosstalk_compensation_plane_offset_kcps = -1907257729
Sometimes get a huge xtalk_calib data. it maybe because glasses are too wonderful.
The data will recovery after retry xtalk_calib test.
For this situation.Setting a default golden data to xtalk calib.

Change-Id: I6d3d2b35ed7ef56502ce13e9446682d94ea36bcc
Signed-off-by: liuyc20 <liuyc20@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1456036
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Qiu Du <duqiu2@motorola.com>
Reviewed-by: Dawei Wang <wangdw10@motorola.com>
Reviewed-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-by: Lei Chen <chenl18@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
liuyc20 2019-11-15 09:47:21 +08:00 • committed by Yuecai Liu
commit 4f663041e8

View file

@ -2977,6 +2977,10 @@ VL53L1_Error VL53L1_PerformXTalkCalibration(VL53L1_DEV Dev,
int16_t CalDistanceMm;
VL53L1_xtalk_calibration_results_t xtalk;
int16_t i;
uint32_t sum = 0;
VL53L1_CalibrationData_t caldata;
LOG_FUNCTION_START("");
switch (CalibrationOption) {
@ -2995,6 +2999,28 @@ VL53L1_Error VL53L1_PerformXTalkCalibration(VL53L1_DEV Dev,
BDTable[VL53L1_TUNING_XTALK_FULL_ROI_TARGET_DISTANCE_MM];
Status = VL53L1_run_hist_xtalk_extraction(Dev, CalDistanceMm,
&UnfilteredStatus);
/*fix for low xtalk coverglass*/
VL53L1_GetCalibrationData(Dev, &caldata);
for (i=0;i<12;i++){
sum += caldata.xtalkhisto.xtalk_shape.bin_data[i];
}
if (((caldata.customer.algo__crosstalk_compensation_plane_offset_kcps) > 1024000)||
((sum>1048) || (sum<1000)))
{
caldata.customer.algo__crosstalk_compensation_plane_offset_kcps= 50;
Dev->LLData.xtalk_cal.algo__crosstalk_compensation_plane_offset_kcps = 50;
caldata.xtalkhisto.xtalk_shape.bin_data[0]=307;
caldata.xtalkhisto.xtalk_shape.bin_data[1]=410;
caldata.xtalkhisto.xtalk_shape.bin_data[2]=410;
caldata.xtalkhisto.xtalk_shape.bin_data[3]=307;
for (i=4;i<12;i++){
caldata.xtalkhisto.xtalk_shape.bin_data[i]=0;
}
VL53L1_SetCalibrationData(Dev, &caldata);
}
/*end of fix for low xtalk coverglass*/
break;
default:
Status = VL53L1_ERROR_INVALID_PARAMS;