diff --git a/src/drivers/drv_accel.h b/src/drivers/drv_accel.h index 6cd0ae52d6..63886530dc 100644 --- a/src/drivers/drv_accel.h +++ b/src/drivers/drv_accel.h @@ -73,12 +73,6 @@ struct accel_calibration_s { #define _ACCELIOCBASE (0x2100) #define _ACCELIOC(_n) (_PX4_IOC(_ACCELIOCBASE, _n)) - -/** set the accel internal sample rate to at least (arg) Hz */ -#define ACCELIOCSSAMPLERATE _ACCELIOC(0) - -#define ACCEL_SAMPLERATE_DEFAULT 1000003 /**< default sample rate */ - /** set the accel scaling constants to the structure pointed to by (arg) */ #define ACCELIOCSSCALE _ACCELIOC(5) diff --git a/src/drivers/imu/adis16448/adis16448.cpp b/src/drivers/imu/adis16448/adis16448.cpp index b7ff2d7256..d2ba484f3e 100644 --- a/src/drivers/imu/adis16448/adis16448.cpp +++ b/src/drivers/imu/adis16448/adis16448.cpp @@ -1068,10 +1068,6 @@ ADIS16448::ioctl(struct file *filp, int cmd, unsigned long arg) return OK; } - case ACCELIOCSSAMPLERATE: - _set_sample_rate(arg); - return OK; - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/drivers/imu/adis16477/ADIS16477.cpp b/src/drivers/imu/adis16477/ADIS16477.cpp index 804b33e025..e9ea40d3b2 100644 --- a/src/drivers/imu/adis16477/ADIS16477.cpp +++ b/src/drivers/imu/adis16477/ADIS16477.cpp @@ -407,10 +407,6 @@ ADIS16477::ioctl(struct file *filp, int cmd, unsigned long arg) return 1000000 / _call_interval; - case ACCELIOCSSAMPLERATE: - _set_sample_rate(arg); - return OK; - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/drivers/imu/bma180/bma180.cpp b/src/drivers/imu/bma180/bma180.cpp index 7d552ee4b9..6c01df7b2d 100644 --- a/src/drivers/imu/bma180/bma180.cpp +++ b/src/drivers/imu/bma180/bma180.cpp @@ -473,9 +473,6 @@ BMA180::ioctl(struct file *filp, int cmd, unsigned long arg) /* XXX implement */ return -EINVAL; - case ACCELIOCSSAMPLERATE: /* sensor sample rate is not (really) adjustable */ - return -EINVAL; - case ACCELIOCSSCALE: /* copy scale in */ memcpy(&_accel_scale, (struct accel_calibration_s *) arg, sizeof(_accel_scale)); diff --git a/src/drivers/imu/bmi055/BMI055_accel.cpp b/src/drivers/imu/bmi055/BMI055_accel.cpp index 1c7fdbb7f2..9fd44f464d 100644 --- a/src/drivers/imu/bmi055/BMI055_accel.cpp +++ b/src/drivers/imu/bmi055/BMI055_accel.cpp @@ -415,9 +415,6 @@ BMI055_accel::ioctl(struct file *filp, int cmd, unsigned long arg) return OK; } - case ACCELIOCSSAMPLERATE: - return accel_set_sample_rate(arg); - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/drivers/imu/bmi160/bmi160.cpp b/src/drivers/imu/bmi160/bmi160.cpp index cf3891a98d..487ba2017a 100644 --- a/src/drivers/imu/bmi160/bmi160.cpp +++ b/src/drivers/imu/bmi160/bmi160.cpp @@ -651,9 +651,6 @@ BMI160::ioctl(struct file *filp, int cmd, unsigned long arg) return OK; } - case ACCELIOCSSAMPLERATE: - return accel_set_sample_rate(arg); - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/drivers/imu/fxos8701cq/fxos8701cq.cpp b/src/drivers/imu/fxos8701cq/fxos8701cq.cpp index 1a14beda21..652d51b520 100644 --- a/src/drivers/imu/fxos8701cq/fxos8701cq.cpp +++ b/src/drivers/imu/fxos8701cq/fxos8701cq.cpp @@ -882,9 +882,6 @@ FXOS8701CQ::ioctl(struct file *filp, int cmd, unsigned long arg) reset(); return OK; - case ACCELIOCSSAMPLERATE: - return accel_set_samplerate(arg); - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; @@ -1137,7 +1134,7 @@ FXOS8701CQ::accel_set_samplerate(unsigned frequency) uint8_t active = read_reg(FXOS8701CQ_CTRL_REG1) & CTRL_REG1_ACTIVE; - if (frequency == 0 || frequency == ACCEL_SAMPLERATE_DEFAULT) { + if (frequency == 0) { frequency = FXOS8701C_ACCEL_DEFAULT_RATE; } diff --git a/src/drivers/imu/lsm303d/lsm303d.cpp b/src/drivers/imu/lsm303d/lsm303d.cpp index 267a5b8459..c6462d21aa 100644 --- a/src/drivers/imu/lsm303d/lsm303d.cpp +++ b/src/drivers/imu/lsm303d/lsm303d.cpp @@ -894,9 +894,6 @@ LSM303D::ioctl(struct file *filp, int cmd, unsigned long arg) reset(); return OK; - case ACCELIOCSSAMPLERATE: - return accel_set_samplerate(arg); - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; @@ -1214,7 +1211,7 @@ LSM303D::accel_set_samplerate(unsigned frequency) uint8_t setbits = 0; uint8_t clearbits = REG1_RATE_BITS_A; - if (frequency == 0 || frequency == ACCEL_SAMPLERATE_DEFAULT) { + if (frequency == 0) { frequency = 1600; } diff --git a/src/drivers/imu/mpu6000/mpu6000.cpp b/src/drivers/imu/mpu6000/mpu6000.cpp index 5139a84e76..2953132ec6 100644 --- a/src/drivers/imu/mpu6000/mpu6000.cpp +++ b/src/drivers/imu/mpu6000/mpu6000.cpp @@ -909,8 +909,7 @@ void MPU6000::_set_sample_rate(unsigned desired_sample_rate_hz) { if (desired_sample_rate_hz == 0 || - desired_sample_rate_hz == GYRO_SAMPLERATE_DEFAULT || - desired_sample_rate_hz == ACCEL_SAMPLERATE_DEFAULT) { + desired_sample_rate_hz == GYRO_SAMPLERATE_DEFAULT) { desired_sample_rate_hz = MPU6000_GYRO_DEFAULT_RATE; } @@ -1367,10 +1366,6 @@ MPU6000::ioctl(struct file *filp, int cmd, unsigned long arg) return OK; } - case ACCELIOCSSAMPLERATE: - _set_sample_rate(arg); - return OK; - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/drivers/imu/mpu9250/mpu9250.cpp b/src/drivers/imu/mpu9250/mpu9250.cpp index 98511cf632..dfa9200e1e 100644 --- a/src/drivers/imu/mpu9250/mpu9250.cpp +++ b/src/drivers/imu/mpu9250/mpu9250.cpp @@ -553,8 +553,7 @@ void MPU9250::_set_sample_rate(unsigned desired_sample_rate_hz) { if (desired_sample_rate_hz == 0 || - desired_sample_rate_hz == GYRO_SAMPLERATE_DEFAULT || - desired_sample_rate_hz == ACCEL_SAMPLERATE_DEFAULT) { + desired_sample_rate_hz == GYRO_SAMPLERATE_DEFAULT) { desired_sample_rate_hz = MPU9250_GYRO_DEFAULT_RATE; } @@ -827,10 +826,6 @@ MPU9250::ioctl(struct file *filp, int cmd, unsigned long arg) return OK; } - case ACCELIOCSSAMPLERATE: - _set_sample_rate(arg); - return OK; - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/modules/simulator/accelsim/accelsim.cpp b/src/modules/simulator/accelsim/accelsim.cpp index 36752bb4ac..a25c84cf43 100644 --- a/src/modules/simulator/accelsim/accelsim.cpp +++ b/src/modules/simulator/accelsim/accelsim.cpp @@ -565,10 +565,6 @@ ACCELSIM::devIOCTL(unsigned long cmd, unsigned long arg) // Nothing to do for simulator return OK; - case ACCELIOCSSAMPLERATE: - // No need to set internal sampling rate for simulator - return OK; - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/modules/simulator/gyrosim/gyrosim.cpp b/src/modules/simulator/gyrosim/gyrosim.cpp index 1c42e70399..0d6ca6df9b 100644 --- a/src/modules/simulator/gyrosim/gyrosim.cpp +++ b/src/modules/simulator/gyrosim/gyrosim.cpp @@ -513,8 +513,7 @@ GYROSIM::_set_sample_rate(unsigned desired_sample_rate_hz) PX4_DEBUG("_set_sample_rate %u Hz", desired_sample_rate_hz); if (desired_sample_rate_hz == 0 || - desired_sample_rate_hz == GYRO_SAMPLERATE_DEFAULT || - desired_sample_rate_hz == ACCEL_SAMPLERATE_DEFAULT) { + desired_sample_rate_hz == GYRO_SAMPLERATE_DEFAULT) { desired_sample_rate_hz = GYROSIM_GYRO_DEFAULT_RATE; } @@ -700,10 +699,6 @@ GYROSIM::devIOCTL(unsigned long cmd, unsigned long arg) return OK; } - case ACCELIOCSSAMPLERATE: - _set_sample_rate(arg); - return OK; - case ACCELIOCSSCALE: { /* copy scale, but only if off by a few percent */ struct accel_calibration_s *s = (struct accel_calibration_s *) arg; diff --git a/src/systemcmds/config/config.c b/src/systemcmds/config/config.c index 78b0ff28c4..958550ecb3 100644 --- a/src/systemcmds/config/config.c +++ b/src/systemcmds/config/config.c @@ -312,17 +312,7 @@ do_accel(int argc, char *argv[]) int ret; - if (argc == 3 && !strcmp(argv[0], "sampling")) { - - /* set the accel internal sampling rate up to at least i Hz */ - ret = ioctl(fd, ACCELIOCSSAMPLERATE, strtoul(argv[2], NULL, 0)); - - if (ret) { - PX4_ERR("sampling rate could not be set"); - return 1; - } - - } else if (argc == 3 && !strcmp(argv[0], "rate")) { + if (argc == 3 && !strcmp(argv[0], "rate")) { /* set the driver to poll at i Hz */ ret = ioctl(fd, SENSORIOCSPOLLRATE, strtoul(argv[2], NULL, 0));