mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 07:03:33 +08:00
Increase the retry count while probing for I2C sensors. This will also unwedge stuck sensors.
This commit is contained in:
@@ -339,12 +339,14 @@ HMC5883::close_last(struct file *filp)
|
|||||||
int
|
int
|
||||||
HMC5883::probe()
|
HMC5883::probe()
|
||||||
{
|
{
|
||||||
uint8_t data[3];
|
uint8_t data[3] = {0, 0, 0};
|
||||||
|
|
||||||
|
_retries = 3;
|
||||||
if (read_reg(ADDR_ID_A, data[0]) ||
|
if (read_reg(ADDR_ID_A, data[0]) ||
|
||||||
read_reg(ADDR_ID_B, data[1]) ||
|
read_reg(ADDR_ID_B, data[1]) ||
|
||||||
read_reg(ADDR_ID_C, data[2]))
|
read_reg(ADDR_ID_C, data[2]))
|
||||||
debug("read_reg fail");
|
debug("read_reg fail");
|
||||||
|
_retries = 1;
|
||||||
|
|
||||||
if ((data[0] != ID_A_WHO_AM_I) ||
|
if ((data[0] != ID_A_WHO_AM_I) ||
|
||||||
(data[1] != ID_B_WHO_AM_I) ||
|
(data[1] != ID_B_WHO_AM_I) ||
|
||||||
|
|||||||
@@ -317,11 +317,12 @@ MS5611::close_last(struct file *filp)
|
|||||||
int
|
int
|
||||||
MS5611::probe()
|
MS5611::probe()
|
||||||
{
|
{
|
||||||
if (OK == probe_address(MS5611_ADDRESS_1))
|
_retries = 3;
|
||||||
return OK;
|
if((OK == probe_address(MS5611_ADDRESS_1)) ||
|
||||||
|
(OK == probe_address(MS5611_ADDRESS_2))) {
|
||||||
if (OK == probe_address(MS5611_ADDRESS_2))
|
_retries = 1;
|
||||||
return OK;
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user