2023-02-26 09:57 PM
The functions vl53l5cx_motion_indicator_init and vl53l5cx_motion_indicator_set_resolution rely on code in vl53l5cx_motion_indicator_set_resolution to update the sensor settings. However, the code only executes if an error is encountered prior to the update execution.
The code from the version 1.3.6 in module vl53l5cx_plugin_motion_indicator.c starting at line 113 is:
if(status != (uint8_t)0)
{
status |= vl53l5cx_dci_write_data(p_dev,
(uint8_t*)(p_motion_config),
VL53L5CX_DCI_MOTION_DETECTOR_CFG,
(uint16_t)sizeof(*p_motion_config));
}
In this code, as written, status appears to be non-zero if an error occurs.
I have tested the following code and it appears to work as required:
if (status == VL53L5CX_STATUS_OK)
{
status |= vl53l5cx_dci_write_data(p_dev,
(uint8_t*)(p_motion_config),
VL53L5CX_DCI_MOTION_DETECTOR_CFG,
(uint16_t)sizeof(*p_motion_config));
}
By the way, i believe the example 10 in the 1.3.6 and earlier versions works because a call is make to set the resolution, and in this function the sensor is updated.
Please let me know if you think this analysis is correct. Also, let me know if any addition information work be helpful.
Thank you
2023-03-01 06:22 AM
Thank you for your feedback.
Your question has been asked internally. We will give an answer soon.
Anne
2023-03-01 06:29 AM
Thank you, I'm looking forward to hearing from you and the team.