Skip to main content
WLai.2
Visitor II
February 25, 2021
Question

Does VL53L0X sample code error ?

  • February 25, 2021
  • 1 reply
  • 543 views

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 */

This topic has been closed for replies.

1 reply

John E KVAM
ST Employee
January 4, 2022

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