From cfbdf7c9037c948e869fc805a79fb92e5441e15a Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 20 Jul 2013 18:51:25 -0700 Subject: [PATCH] Revert "Corrected the interval of the MS5611" This reverts commit 094ff1261aa4a651e898c50d4451d283cb899a72. --- src/drivers/ms5611/ms5611.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/drivers/ms5611/ms5611.cpp b/src/drivers/ms5611/ms5611.cpp index 122cf0cec3..4524160355 100644 --- a/src/drivers/ms5611/ms5611.cpp +++ b/src/drivers/ms5611/ms5611.cpp @@ -336,9 +336,8 @@ 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 to minimum legal value */ - _baro_call.period = _call_baro_interval = MS5611_CONVERSION_INTERVAL; - + /* set interval for next measurement to minimum legal value */ + _baro_call.period = _call_baro_interval = USEC2TICK(MS5611_CONVERSION_INTERVAL); /* if we need to start the poll state machine, do it */ if (want_start) @@ -352,12 +351,15 @@ 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 (1000000/arg < MS5611_CONVERSION_INTERVAL) + if (ticks < USEC2TICK(MS5611_CONVERSION_INTERVAL)) return -EINVAL; - /* update interval */ - _baro_call.period = _call_baro_interval = 1000000/arg; + /* update interval for next measurement */ + _baro_call.period = _call_baro_interval = ticks; /* if we need to start the poll state machine, do it */ if (want_start)