forked from Archive/PX4-Autopilot
Corrected the interval of the MS5611
This commit is contained in:
parent
c93e743374
commit
094ff1261a
|
@ -336,8 +336,9 @@ MS5611::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||||
/* do we need to start internal polling? */
|
/* do we need to start internal polling? */
|
||||||
bool want_start = (_call_baro_interval == 0);
|
bool want_start = (_call_baro_interval == 0);
|
||||||
|
|
||||||
/* set interval for next measurement to minimum legal value */
|
/* set interval to minimum legal value */
|
||||||
_baro_call.period = _call_baro_interval = USEC2TICK(MS5611_CONVERSION_INTERVAL);
|
_baro_call.period = _call_baro_interval = MS5611_CONVERSION_INTERVAL;
|
||||||
|
|
||||||
|
|
||||||
/* if we need to start the poll state machine, do it */
|
/* if we need to start the poll state machine, do it */
|
||||||
if (want_start)
|
if (want_start)
|
||||||
|
@ -351,15 +352,12 @@ MS5611::ioctl(struct file *filp, int cmd, unsigned long arg)
|
||||||
/* do we need to start internal polling? */
|
/* do we need to start internal polling? */
|
||||||
bool want_start = (_call_baro_interval == 0);
|
bool want_start = (_call_baro_interval == 0);
|
||||||
|
|
||||||
/* convert hz to tick interval via microseconds */
|
|
||||||
unsigned ticks = USEC2TICK(1000000 / arg);
|
|
||||||
|
|
||||||
/* check against maximum rate */
|
/* check against maximum rate */
|
||||||
if (ticks < USEC2TICK(MS5611_CONVERSION_INTERVAL))
|
if (1000000/arg < MS5611_CONVERSION_INTERVAL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* update interval for next measurement */
|
/* update interval */
|
||||||
_baro_call.period = _call_baro_interval = ticks;
|
_baro_call.period = _call_baro_interval = 1000000/arg;
|
||||||
|
|
||||||
/* if we need to start the poll state machine, do it */
|
/* if we need to start the poll state machine, do it */
|
||||||
if (want_start)
|
if (want_start)
|
||||||
|
|
Loading…
Reference in New Issue