diff options
author | Andrew Tridgell <tridge@samba.org> | 2013-11-15 14:12:24 +1100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-10 11:59:00 +0100 |
commit | 4ce4b8a174cae4053f8df59de1455589ab1e16b8 (patch) | |
tree | ef2021ee0d1b930991291f1cc9f6c5820bfac029 | |
parent | 5ef91d694b94c297bfecae297b2c933561e0ac16 (diff) | |
download | px4-firmware-4ce4b8a174cae4053f8df59de1455589ab1e16b8.tar.gz px4-firmware-4ce4b8a174cae4053f8df59de1455589ab1e16b8.tar.bz2 px4-firmware-4ce4b8a174cae4053f8df59de1455589ab1e16b8.zip |
lsm303d: always log first ARB and REG values
-rw-r--r-- | src/drivers/lsm303d/lsm303d.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/lsm303d/lsm303d.cpp b/src/drivers/lsm303d/lsm303d.cpp index c20c820aa..6d7b3df50 100644 --- a/src/drivers/lsm303d/lsm303d.cpp +++ b/src/drivers/lsm303d/lsm303d.cpp @@ -681,7 +681,8 @@ LSM303D::check_extremes(const accel_report *arb) uint64_t now = hrt_absolute_time(); // log accels at 1Hz - if (now - _last_log_us > 1000*1000) { + if (_last_log_us == 0 || + now - _last_log_us > 1000*1000) { _last_log_us = now; ::dprintf(_accel_log_fd, "ARB %llu %.3f %.3f %.3f %d %d %d\r\n", (unsigned long long)arb->timestamp, @@ -692,7 +693,8 @@ LSM303D::check_extremes(const accel_report *arb) } // log registers at 10Hz when we have extreme values, or 0.5 Hz without - if ((is_extreme && (now - _last_log_reg_us > 500*1000)) || + if (_last_log_reg_us == 0 || + (is_extreme && (now - _last_log_reg_us > 500*1000)) || (now - _last_log_reg_us > 10*1000*1000)) { _last_log_reg_us = now; const uint8_t reglist[] = { ADDR_WHO_AM_I, ADDR_STATUS_A, ADDR_STATUS_M, ADDR_CTRL_REG0, ADDR_CTRL_REG1, |