mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 11:13:34 +08:00
drivers: minimize additional I2C retries
This commit is contained in:
@@ -85,18 +85,15 @@ int MPL3115A2::init()
|
||||
|
||||
int MPL3115A2::probe()
|
||||
{
|
||||
_retries = 10;
|
||||
uint8_t whoami = 0;
|
||||
|
||||
if ((RegisterRead(MPL3115A2_REG_WHO_AM_I, &whoami) > 0) && (whoami == MPL3115A2_WHO_AM_I)) {
|
||||
/*
|
||||
* Disable retries; we may enable them selectively in some cases,
|
||||
* but the device gets confused if we retry some of the commands.
|
||||
*/
|
||||
_retries = 0;
|
||||
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
_retries = 1;
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -198,11 +195,6 @@ int MPL3115A2::measure()
|
||||
// Send the command to read the ADC for P and T.
|
||||
unsigned addr = (MPL3115A2_CTRL_REG1 << 8) | MPL3115A2_CTRL_TRIGGER;
|
||||
|
||||
/*
|
||||
* Disable retries on this command; we can't know whether failure
|
||||
* means the device did or did not see the command.
|
||||
*/
|
||||
_retries = 0;
|
||||
int ret = RegisterWrite((addr >> 8) & 0xff, addr & 0xff);
|
||||
|
||||
if (ret == -EIO) {
|
||||
|
||||
Reference in New Issue
Block a user