mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 04:12:04 -04:00
vl53l0: improve offset/xtalk calibration time
reduce vl53l0 calibration time to less than 1s Change-Id: Ia7ce65797e5b88d46ed883bb2e360be0d66a86b2 Signed-off-by: wangdw10 <wangdw10@lenovo.com> Reviewed-on: https://gerrit.mot.com/1380167 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Dawei Wang <wangdw10@motorola.com> Reviewed-by: <liuwang1@lenovo.com> Reviewed-by: Chuanxin Guo <guocx4@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
572485df96
commit
3f79599b45
1 changed files with 17 additions and 4 deletions
|
|
@ -80,13 +80,13 @@ VL53L0_Error VL53L0_perform_xtalk_calibration(VL53L0_DEV Dev,
|
|||
VL53L0_CHECKENABLE_RANGE_IGNORE_THRESHOLD, 0);
|
||||
}
|
||||
|
||||
/* Perform 50 measurements and compute the averages */
|
||||
/* Perform 12 measurements and compute the averages */
|
||||
if (Status == VL53L0_ERROR_NONE) {
|
||||
sum_ranging = 0;
|
||||
sum_spads = 0;
|
||||
sum_signalRate = 0;
|
||||
total_count = 0;
|
||||
for (xtalk_meas = 0; xtalk_meas < 50; xtalk_meas++) {
|
||||
for (xtalk_meas = 0; xtalk_meas < 12; xtalk_meas++) {
|
||||
Status = VL53L0_PerformSingleRangingMeasurement(Dev,
|
||||
&RangingMeasurementData);
|
||||
|
||||
|
|
@ -203,6 +203,8 @@ VL53L0_Error VL53L0_perform_offset_calibration(VL53L0_DEV Dev,
|
|||
uint32_t CalDistanceAsInt_mm;
|
||||
uint8_t SequenceStepEnabled;
|
||||
int meas = 0;
|
||||
uint32_t oldMeasurementTimingBudgetMicroSeconds;
|
||||
uint32_t MeasurementTimingBudgetMicroSeconds = 100000;
|
||||
|
||||
if (CalDistanceMilliMeter <= 0)
|
||||
Status = VL53L0_ERROR_INVALID_PARAMS;
|
||||
|
|
@ -228,11 +230,19 @@ VL53L0_Error VL53L0_perform_offset_calibration(VL53L0_DEV Dev,
|
|||
Status = VL53L0_SetLimitCheckEnable(Dev,
|
||||
VL53L0_CHECKENABLE_RANGE_IGNORE_THRESHOLD, 0);
|
||||
|
||||
/* Perform 50 measurements and compute the averages */
|
||||
if (Status == VL53L0_ERROR_NONE)
|
||||
Status = VL53L0_GetMeasurementTimingBudgetMicroSeconds(Dev,
|
||||
&oldMeasurementTimingBudgetMicroSeconds);
|
||||
|
||||
if (Status == VL53L0_ERROR_NONE)
|
||||
Status = VL53L0_SetMeasurementTimingBudgetMicroSeconds(Dev,
|
||||
MeasurementTimingBudgetMicroSeconds);
|
||||
|
||||
/* Perform 3 measurements and compute the averages */
|
||||
if (Status == VL53L0_ERROR_NONE) {
|
||||
sum_ranging = 0;
|
||||
total_count = 0;
|
||||
for (meas = 0; meas < 50; meas++) {
|
||||
for (meas = 0; meas < 3; meas++) {
|
||||
Status = VL53L0_PerformSingleRangingMeasurement(Dev,
|
||||
&RangingMeasurementData);
|
||||
|
||||
|
|
@ -252,6 +262,9 @@ VL53L0_Error VL53L0_perform_offset_calibration(VL53L0_DEV Dev,
|
|||
Status = VL53L0_ERROR_RANGE_ERROR;
|
||||
}
|
||||
|
||||
if (Status == VL53L0_ERROR_NONE)
|
||||
Status = VL53L0_SetMeasurementTimingBudgetMicroSeconds(Dev,
|
||||
oldMeasurementTimingBudgetMicroSeconds);
|
||||
|
||||
if (Status == VL53L0_ERROR_NONE) {
|
||||
/* FixPoint1616_t / uint16_t = FixPoint1616_t */
|
||||
|
|
|
|||
Loading…
Reference in a new issue