Hello,
I am trying to use new Lidar Lite v3 and I am using PX4 v1.9.2.
With this version of software Lidar probe() function fails because of incorrect reset_sensors() function.
I check the history of the source code and reset_sensors() function changed.
This part of code changed in in this commit: 5eefd94.
Here is the reset_sensors() function:
int
LidarLiteI2C::reset_sensor()
{
px4_usleep(15000);
int ret = write_reg(LL40LS_SIG_COUNT_VAL_REG, LL40LS_SIG_COUNT_VAL_MAX);
if (ret != PX4_OK) {
return ret;
}
px4_usleep(15000);
ret = write_reg(LL40LS_MEASURE_REG, LL40LS_MSRREG_RESET);
if (ret != PX4_OK) {
uint8_t sig_cnt;
px4_usleep(15000);
ret = read_reg(LL40LS_SIG_COUNT_VAL_REG, sig_cnt);
if ((ret != PX4_OK) || (sig_cnt != LL40LS_SIG_COUNT_VAL_DEFAULT)) {
PX4_INFO("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);
if (ret != PX4_OK) {
return ret;
}
// wait for register write to complete
px4_usleep(1000);
return OK;
}
My question is:
What is the logic behind these changes ? Where these sleeps come from ? How did developers understand that they needed sleep in reset function ? Is there any documentation about reset sequence of lidar lite v3 ?