2020-06-15 07:31 PM
Hello,
I am using the VL53L0x Library with a 53L0A1 sensor and am trying to understand the difference between what the API refers to as "State" and "Mode"
In the doc on page 16:
VL53L0X_API VL53L0X_Error VL53L0X_SetPowerMode (VL53L0X_DEV Dev, VL53L0X_PowerModes PowerMode)
Set the power mode for a given Device The power mode can be Standby or Idle.
Different level of both Standby and Idle can exists. This function should not be used when device is in Ranging state.
"This function should not be used when device is in Ranging state." I would think would refer to:
VL53L0X_API VL53L0X_Error VL53L0X_SetDeviceMode (VL53L0X_DEV Dev, VL53L0X_DeviceModes DeviceMode)
Set a new device mode.
Function Description
Set device to a new mode (ranging, histogram ...)
But this provides the following options:
New device mode to apply Valid values are: VL53L0X_DEVICEMODE_SINGLE_RANGING VL53L0X_DEVICEMODE_CONTINUOUS_RANGING VL53L0X_DEVICEMODE_CONTINUOUS_TIMED_RANGING VL53L0X_DEVICEMODE_SINGLE_HISTOGRAM VL53L0X_HISTOGRAMMODE_REFERENCE_ONLY VL53L0X_HISTOGRAMMODE_RETURN_ONLY VL53L0X_HISTOGRAMMODE_BOTH
So my question is:
"What is VL53L0X_SetPowerMode referring it when it specifies "Ranging state" and is this different to the "_DEVICEMODE_" set by VL53L0X_SetDeviceMode"
2020-06-17 05:12 PM
I give you points for digging deep in the code.
Standby is a very low power state that retains your calibration numbers, and almost nothing else.
Idle is the state the sensor is in between ranges. Say you are doing Continuous_Timed and have a Timing budget of 30 ms and an Intermesurement period of 60ms - you will be in idle for 30ms between ranges. It's really only running the clocks looking for when to start back up and do another range.
So these refer to power consumption.
Don't mess with this unless you are 'stopped'.
But I wouldn't mess with them at all. The API we give out for free handles all this.
The Ranging states are what kind of ranging you want to do when you range. (Don't use the Historgram modes. by the way, they don't work well on the VL53L0X. If you want histograms you need a VL53L3CX, where we fixed them. That sensor is only a few cents more, and is in an identical package.
Please stick to the modes in the datasheet. The code has some stuff that was proven not to work. Or worse, it works on most chips but not on all others. We should have removed the code.
The datasheet supports 3 modes. Please stick to these.
Single - do one and stop.
Continuous - Just keep going, back to back
Continuous_timed - do one, wait a bit, do another...
Good luck