cancel
Showing results for 
Search instead for 
Did you mean: 

Does VL53L0X sample code error ?

WLai.2
Associate

According the official API code

in vl53l0x_api.c , comment says enter standby

but the code was set idle ?

Which one is correct ?

VL53L0X_Error VL53L0X_StaticInit(VL53L0X_DEV Dev) {
 
     ...
 
     /* Set PAL State to standby */
 
	if (Status == VL53L0X_ERROR_NONE)
 
		PALDevDataSet(Dev, PalState, VL53L0X_STATE_IDLE);
 
   ...
 
}

and the define was different

#define VL53L0X_STATE_STANDBY		 ((VL53L0X_State)  2)
	/*!< Device is in Low power Standby mode   */
#define VL53L0X_STATE_IDLE			 ((VL53L0X_State)  3)
	/*!< Device has been initialized and ready to do measurements  */

1 REPLY 1
John E KVAM
ST Employee

I was told long ago to never trust the comments.

Programmers frequently change the code to make it work, but never go back an update the comments to reflect those changes.

ST's Time-of-Flight group has come a long way since the early days of the VL53L0X, but we've never had time to go back an polish the code the way we should.

I'm pretty sure it's just the comment that is in error here.

  • john

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.