Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of X_NUCLEO_53L0A1 by
Revision 3:613d7f1ef60e, committed 2016-12-02
- Comitter:
- johnAlexander
- Date:
- Fri Dec 02 10:44:40 2016 +0000
- Parent:
- 2:58b5e9097aa3
- Child:
- 5:c82a48da3c9e
- Commit message:
- UpDate GetDistance() to return an error upon invalid range.
Changed in this revision
| Components/VL53L0X/vl53l0x_class.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Components/VL53L0X/vl53l0x_class.h Thu Dec 01 14:17:46 2016 +0000
+++ b/Components/VL53L0X/vl53l0x_class.h Fri Dec 02 10:44:40 2016 +0000
@@ -721,7 +721,6 @@
*/
virtual int GetDistance(uint32_t *piData)
{
-// return VL6180x_RangeGetResult(Device, piData);
int status=0;
VL53L0X_RangingMeasurementData_t pRangingMeasurementData;
@@ -729,8 +728,15 @@
if (!status) {
status=GetMeasurement(range_single_shot_polling, &pRangingMeasurementData);
}
+ if (pRangingMeasurementData.RangeStatus == 0) {
+ // we have a valid range.
+ *piData = pRangingMeasurementData.RangeMilliMeter;
+ }
+ else {
+ *piData = 0;
+ status = VL53L0X_ERROR_RANGE_ERROR;
+ }
StopMeasurement(range_single_shot_polling);
- *piData = pRangingMeasurementData.RangeMilliMeter;
return status;
}
