mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
Mag sample rate was not actually changed by an ioctl
This commit is contained in:
@@ -718,7 +718,7 @@ LSM303D::mag_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
case SENSOR_POLLRATE_MAX:
|
case SENSOR_POLLRATE_MAX:
|
||||||
case SENSOR_POLLRATE_DEFAULT:
|
case SENSOR_POLLRATE_DEFAULT:
|
||||||
/* 50 Hz is max for mag */
|
/* 50 Hz is max for mag */
|
||||||
return mag_ioctl(filp, SENSORIOCSPOLLRATE, 50);
|
return mag_ioctl(filp, SENSORIOCSPOLLRATE, 100);
|
||||||
|
|
||||||
/* adjust to a legal polling interval in Hz */
|
/* adjust to a legal polling interval in Hz */
|
||||||
default: {
|
default: {
|
||||||
@@ -732,12 +732,13 @@ LSM303D::mag_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
if (ticks < 1000)
|
if (ticks < 1000)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
/* adjust sample rate of sensor */
|
||||||
|
mag_set_samplerate(arg);
|
||||||
|
|
||||||
/* update interval for next measurement */
|
/* update interval for next measurement */
|
||||||
/* XXX this is a bit shady, but no other way to adjust... */
|
/* XXX this is a bit shady, but no other way to adjust... */
|
||||||
_mag_call.period = _call_mag_interval = ticks;
|
_mag_call.period = _call_mag_interval = ticks;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 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)
|
||||||
start();
|
start();
|
||||||
|
|||||||
Reference in New Issue
Block a user