diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-25 20:42:05 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-25 20:42:05 +0200 |
commit | 731621a30934af120ed28bcb44f8db0c97202c21 (patch) | |
tree | 852c194b3b04199a2877293a2e13734f069d7b12 | |
parent | 656596896a14dd9baae6107f893ce4ee8c44c021 (diff) | |
parent | 0dc0a0539dafdf1727763cc145f02faa8a8e7d22 (diff) | |
download | px4-firmware-731621a30934af120ed28bcb44f8db0c97202c21.tar.gz px4-firmware-731621a30934af120ed28bcb44f8db0c97202c21.tar.bz2 px4-firmware-731621a30934af120ed28bcb44f8db0c97202c21.zip |
Merge branch 'px4dev_new_driver' of github.com:PX4/Firmware into px4dev_new_driver
-rw-r--r-- | apps/drivers/hmc5883/hmc5883.cpp | 4 | ||||
-rw-r--r-- | apps/drivers/ms5611/ms5611.cpp | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/apps/drivers/hmc5883/hmc5883.cpp index a9212e7ab..c6d03a7e4 100644 --- a/apps/drivers/hmc5883/hmc5883.cpp +++ b/apps/drivers/hmc5883/hmc5883.cpp @@ -339,12 +339,14 @@ HMC5883::close_last(struct file *filp) int HMC5883::probe() { - uint8_t data[3]; + uint8_t data[3] = {0, 0, 0}; + _retries = 3; if (read_reg(ADDR_ID_A, data[0]) || read_reg(ADDR_ID_B, data[1]) || read_reg(ADDR_ID_C, data[2])) debug("read_reg fail"); + _retries = 1; if ((data[0] != ID_A_WHO_AM_I) || (data[1] != ID_B_WHO_AM_I) || diff --git a/apps/drivers/ms5611/ms5611.cpp b/apps/drivers/ms5611/ms5611.cpp index c85e5b3a6..40448511d 100644 --- a/apps/drivers/ms5611/ms5611.cpp +++ b/apps/drivers/ms5611/ms5611.cpp @@ -317,11 +317,12 @@ MS5611::close_last(struct file *filp) int MS5611::probe() { - if (OK == probe_address(MS5611_ADDRESS_1)) - return OK; - - if (OK == probe_address(MS5611_ADDRESS_2)) + _retries = 3; + if((OK == probe_address(MS5611_ADDRESS_1)) || + (OK == probe_address(MS5611_ADDRESS_2))) { + _retries = 1; return OK; + } return -EIO; } |