aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/ms5611
diff options
context:
space:
mode:
authorJulian Oes <julian@oes.ch>2013-07-19 18:30:01 +0200
committerJulian Oes <julian@oes.ch>2013-07-19 18:30:01 +0200
commit094ff1261aa4a651e898c50d4451d283cb899a72 (patch)
tree69d0cbf327e33d262d956376ce9c8b5b01dbb439 /src/drivers/ms5611
parentc93e743374731ec06020ba6919c6d48594d4a58c (diff)
downloadpx4-firmware-094ff1261aa4a651e898c50d4451d283cb899a72.tar.gz
px4-firmware-094ff1261aa4a651e898c50d4451d283cb899a72.tar.bz2
px4-firmware-094ff1261aa4a651e898c50d4451d283cb899a72.zip
Corrected the interval of the MS5611
Diffstat (limited to 'src/drivers/ms5611')
-rw-r--r--src/drivers/ms5611/ms5611.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/drivers/ms5611/ms5611.cpp b/src/drivers/ms5611/ms5611.cpp
index 452416035..122cf0cec 100644
--- a/src/drivers/ms5611/ms5611.cpp
+++ b/src/drivers/ms5611/ms5611.cpp
@@ -336,8 +336,9 @@ MS5611::ioctl(struct file *filp, int cmd, unsigned long arg)
/* do we need to start internal polling? */
bool want_start = (_call_baro_interval == 0);
- /* set interval for next measurement to minimum legal value */
- _baro_call.period = _call_baro_interval = USEC2TICK(MS5611_CONVERSION_INTERVAL);
+ /* set interval to minimum legal value */
+ _baro_call.period = _call_baro_interval = MS5611_CONVERSION_INTERVAL;
+
/* if we need to start the poll state machine, do it */
if (want_start)
@@ -351,15 +352,12 @@ MS5611::ioctl(struct file *filp, int cmd, unsigned long arg)
/* do we need to start internal polling? */
bool want_start = (_call_baro_interval == 0);
- /* convert hz to tick interval via microseconds */
- unsigned ticks = USEC2TICK(1000000 / arg);
-
/* check against maximum rate */
- if (ticks < USEC2TICK(MS5611_CONVERSION_INTERVAL))
+ if (1000000/arg < MS5611_CONVERSION_INTERVAL)
return -EINVAL;
- /* update interval for next measurement */
- _baro_call.period = _call_baro_interval = ticks;
+ /* update interval */
+ _baro_call.period = _call_baro_interval = 1000000/arg;
/* if we need to start the poll state machine, do it */
if (want_start)