This commit is contained in:
Jason2866 2020-08-24 11:41:11 +02:00
parent 50e88038c3
commit 00dad36b08
10 changed files with 20 additions and 37 deletions

View File

@ -1,24 +0,0 @@
language: python
cache:
directories:
- "~/.platformio"
install:
- pip install -U platformio
env:
- BOARD=uno
- BOARD=leonardo
- BOARD=micro
- BOARD=megaatmega2560
- BOARD=due
- BOARD=yun
- BOARD=genuino101
- BOARD=zero
script:
- set -eo pipefail;
for e in examples/*; do
platformio ci --board=$BOARD --lib=. $e/*;
done

View File

@ -1,7 +1,7 @@
# VL53L1X library for Arduino # VL53L1X library for Arduino
Version: 1.0.0<br> Version: 1.0.1<br>
Release date: 2018-05-31<br> Release date: 2018-09-19<br>
[![Build Status](https://travis-ci.org/pololu/vl53l1x-arduino.svg?branch=master)](https://travis-ci.org/pololu/vl53l1x-arduino)<br> [![Build Status](https://travis-ci.org/pololu/vl53l1x-arduino.svg?branch=master)](https://travis-ci.org/pololu/vl53l1x-arduino)<br>
[www.pololu.com](https://www.pololu.com/) [www.pololu.com](https://www.pololu.com/)
@ -149,7 +149,7 @@ This library is intended to provide a quicker and easier way to get started usin
* `static const char * rangeStatusToString(RangeStatus status)`<br> * `static const char * rangeStatusToString(RangeStatus status)`<br>
Converts a `RangeStatus` into a readable string describing that status. Converts a `RangeStatus` into a readable string describing that status.
Note that on an AVR, the strings in this function are stored in RAM (dynamic memory), which makes working with them easier but uses up 200+ bytes of RAM (many AVR-based Arduinos only have about 2000 bytes of RAM). You can avoid this memory usage if you do not call this function in your sketch. Note that on an AVR, the strings in this function are stored in RAM (dynamic memory), which makes working with them easier but uses up 200+ bytes of RAM (many AVR-based Arduinos only have about 2000 bytes of RAM). You can avoid this memory usage if you do not call this function in your sketch.
* `void setTimeout(uint16_t timeout)`<br> * `void setTimeout(uint16_t timeout)`<br>
@ -163,4 +163,5 @@ This library is intended to provide a quicker and easier way to get started usin
## Version history ## Version history
* 1.0.1 (2018-09-19): Fix Arduino 101 hanging in init().
* 1.0.0 (2018-05-31): Original release. * 1.0.0 (2018-05-31): Original release.

View File

@ -42,10 +42,16 @@ bool VL53L1X::init(bool io_2v8)
delayMicroseconds(100); delayMicroseconds(100);
writeReg(SOFT_RESET, 0x01); writeReg(SOFT_RESET, 0x01);
// give it some time to boot; otherwise the sensor NACKs during the readReg()
// call below and the Arduino 101 doesn't seem to handle that well
delay(1);
// VL53L1_poll_for_boot_completion() begin // VL53L1_poll_for_boot_completion() begin
startTimeout(); startTimeout();
while ((readReg(FIRMWARE__SYSTEM_STATUS) & 0x01) == 0)
// check last_status in case we still get a NACK to try to deal with it correctly
while ((readReg(FIRMWARE__SYSTEM_STATUS) & 0x01) == 0 || last_status != 0)
{ {
if (checkTimeoutExpired()) if (checkTimeoutExpired())
{ {
@ -675,7 +681,7 @@ void VL53L1X::getRangingData()
break; break;
case 6: // SIGMATHRESHOLDCHECK case 6: // SIGMATHRESHOLDCHECK
ranging_data.range_status = SignalFail; ranging_data.range_status = SigmaFail;
break; break;
case 7: // PHASECONSISTENCY case 7: // PHASECONSISTENCY

View File

@ -20,7 +20,7 @@ void setup()
Serial.println("Failed to detect and initialize sensor!"); Serial.println("Failed to detect and initialize sensor!");
while (1); while (1);
} }
// Use long distance mode and allow up to 50000 us (50 ms) for a measurement. // Use long distance mode and allow up to 50000 us (50 ms) for a measurement.
// You can change these settings to adjust the performance of the sensor, but // You can change these settings to adjust the performance of the sensor, but
// the minimum timing budget is 20 ms for short distance mode and 33 ms for // the minimum timing budget is 20 ms for short distance mode and 33 ms for

View File

@ -1,8 +1,8 @@
/* /*
This example takes range measurements with the VL53L1X and displays additional This example takes range measurements with the VL53L1X and displays additional
details (status and signal/ambient rates) for each measurement, which can help details (status and signal/ambient rates) for each measurement, which can help
you determine whether the sensor is operating normally and the reported range is you determine whether the sensor is operating normally and the reported range is
valid. The range is in units of mm, and the rates are in units of MCPS (mega valid. The range is in units of mm, and the rates are in units of MCPS (mega
counts per second). counts per second).
*/ */
@ -23,7 +23,7 @@ void setup()
Serial.println("Failed to detect and initialize sensor!"); Serial.println("Failed to detect and initialize sensor!");
while (1); while (1);
} }
// Use long distance mode and allow up to 50000 us (50 ms) for a measurement. // Use long distance mode and allow up to 50000 us (50 ms) for a measurement.
// You can change these settings to adjust the performance of the sensor, but // You can change these settings to adjust the performance of the sensor, but
// the minimum timing budget is 20 ms for short distance mode and 33 ms for // the minimum timing budget is 20 ms for short distance mode and 33 ms for
@ -41,7 +41,7 @@ void setup()
void loop() void loop()
{ {
sensor.read(); sensor.read();
Serial.print("range: "); Serial.print("range: ");
Serial.print(sensor.ranging_data.range_mm); Serial.print(sensor.ranging_data.range_mm);
Serial.print("\tstatus: "); Serial.print("\tstatus: ");
@ -50,6 +50,6 @@ void loop()
Serial.print(sensor.ranging_data.peak_signal_count_rate_MCPS); Serial.print(sensor.ranging_data.peak_signal_count_rate_MCPS);
Serial.print("\tambient: "); Serial.print("\tambient: ");
Serial.print(sensor.ranging_data.ambient_count_rate_MCPS); Serial.print(sensor.ranging_data.ambient_count_rate_MCPS);
Serial.println(); Serial.println();
} }

View File

@ -1,5 +1,5 @@
name=VL53L1X name=VL53L1X
version=1.0.0 version=1.0.1
author=Pololu author=Pololu
maintainer=Pololu <inbox@pololu.com> maintainer=Pololu <inbox@pololu.com>
sentence=VL53L1X distance sensor library sentence=VL53L1X distance sensor library

View File

@ -531,7 +531,7 @@
// #define USE_SPS30 // [I2cDriver30] Enable Sensiron SPS30 particle sensor (I2C address 0x69) (+1.7 code) // #define USE_SPS30 // [I2cDriver30] Enable Sensiron SPS30 particle sensor (I2C address 0x69) (+1.7 code)
#define USE_ADE7953 // [I2cDriver7] Enable ADE7953 Energy monitor as used on Shelly 2.5 (I2C address 0x38) (+1k5) #define USE_ADE7953 // [I2cDriver7] Enable ADE7953 Energy monitor as used on Shelly 2.5 (I2C address 0x38) (+1k5)
// #define USE_VL53L0X // [I2cDriver31] Enable VL53L0x time of flight sensor (I2C address 0x29) (+4k code) // #define USE_VL53L0X // [I2cDriver31] Enable VL53L0x time of flight sensor (I2C address 0x29) (+4k code)
// #define USE_VL53L1X // Enable support for VL53L1X sensor (I2C addres 0x52) using Pololu VL53L1X library (+2k9 code) // #define USE_VL53L1X // [I2cDriver53] Enable support for VL53L1X sensor (I2C addres 0x52) using Pololu VL53L1X library (+2k9 code)
// #define USE_MLX90614 // [I2cDriver32] Enable MLX90614 ir temp sensor (I2C address 0x5a) (+0.6k code) // #define USE_MLX90614 // [I2cDriver32] Enable MLX90614 ir temp sensor (I2C address 0x5a) (+0.6k code)
// #define USE_CHIRP // [I2cDriver33] Enable CHIRP soil moisture sensor (variable I2C address, default 0x20) // #define USE_CHIRP // [I2cDriver33] Enable CHIRP soil moisture sensor (variable I2C address, default 0x20)
// #define USE_PAJ7620 // [I2cDriver34] Enable PAJ7620 gesture sensor (I2C address 0x73) (+2.5k code) // #define USE_PAJ7620 // [I2cDriver34] Enable PAJ7620 gesture sensor (I2C address 0x73) (+2.5k code)