mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
ll40ls: [Wingtra docet] fix for properly resetting v3 and v3hp modules.
Signed-off-by: Claudio Micheli <claudio@auterion.com>
This commit is contained in:
parent
7799f4c68b
commit
5eefd9409b
@ -212,12 +212,33 @@ LidarLiteI2C::measure()
|
||||
int
|
||||
LidarLiteI2C::reset_sensor()
|
||||
{
|
||||
int ret = write_reg(LL40LS_MEASURE_REG, LL40LS_MSRREG_RESET);
|
||||
int ret;
|
||||
|
||||
px4_usleep(15000);
|
||||
|
||||
ret = write_reg(LL40LS_SIG_COUNT_VAL_REG, LL40LS_SIG_COUNT_VAL_MAX);
|
||||
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
px4_usleep(15000);
|
||||
ret = write_reg(LL40LS_MEASURE_REG, LL40LS_MSRREG_RESET);
|
||||
|
||||
|
||||
if (ret != OK) {
|
||||
uint8_t sig_cnt;
|
||||
|
||||
px4_usleep(15000);
|
||||
ret = read_reg(LL40LS_SIG_COUNT_VAL_REG, sig_cnt);
|
||||
|
||||
if ((ret != OK) || (sig_cnt != LL40LS_SIG_COUNT_VAL_DEFAULT)) {
|
||||
printf("Error: ll40ls reset failure. Exiting!\n");
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// wait for sensor reset to complete
|
||||
px4_usleep(50000);
|
||||
ret = write_reg(LL40LS_SIG_COUNT_VAL_REG, LL40LS_SIG_COUNT_VAL_MAX);
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
/* Configuration Constants */
|
||||
static constexpr uint8_t LL40LS_BASEADDR = 0x62; /* 7-bit address */
|
||||
static constexpr uint8_t LL40LS_BASEADDR_OLD = 0x42; /* previous 7-bit address */
|
||||
static constexpr uint8_t LL40LS_SIG_COUNT_VAL_DEFAULT = 0x80; /* Default maximum acquisition count */
|
||||
|
||||
/* LL40LS Registers addresses */
|
||||
static constexpr uint8_t LL40LS_MEASURE_REG = 0x00; /* Measure range register */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user