Skip to main content
DHrynyk
Associate
February 27, 2023
Question

VL53L5CX Motion Detection (vl53l5cx_plugin_motion_indicator) does not appear to update sensor for vl53l5cx_motion_indicator_init and vl53l5cx_motion_indicator_set_resolution data initializations and changes

  • February 27, 2023
  • 2 replies
  • 1089 views

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

This topic has been closed for replies.

2 replies

Anne BIGOT
Technical Moderator
March 1, 2023

Thank you for your feedback.

Your question has been asked internally. We will give an answer soon.

Anne

Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised. ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'
DHrynyk
DHrynykAuthor
Associate
March 1, 2023

Thank you, I'm looking forward to hearing from you and the team.