Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ll40ls: Increase the number of samples used for every measurement #9247

Merged
merged 2 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/drivers/distance_sensor/ll40ls/LidarLiteI2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,26 @@ int LidarLiteI2C::measure()
}

/*
reset the sensor to power on defaults
reset the sensor to power on defaults plus additional configurations
*/
int LidarLiteI2C::reset_sensor()
{
int ret = write_reg(LL40LS_MEASURE_REG, LL40LS_MSRREG_RESET);
int ret;
ret = write_reg(LL40LS_MEASURE_REG, LL40LS_MSRREG_RESET);

if (ret != OK) {
return ret;
}

// wait for sensor reset to complete
usleep(50000);
ret = write_reg(LL40LS_SIG_COUNT_VAL_REG, LL40LS_SIG_COUNT_VAL_MAX);

if (ret != OK) {
return ret;
}

// wait for register write to complete
usleep(1000);

return OK;
Expand Down
3 changes: 3 additions & 0 deletions src/drivers/distance_sensor/ll40ls/LidarLiteI2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
#define LL40LS_SW_VERSION 0x4f
#define LL40LS_SIGNAL_STRENGTH_REG 0x5b

#define LL40LS_SIG_COUNT_VAL_REG 0x02 /* Maximum acquisition count register */
#define LL40LS_SIG_COUNT_VAL_MAX 0xFF /* Maximum acquisition count max value */

class LidarLiteI2C : public LidarLite, public device::I2C
{
public:
Expand Down