diff options
author | hauptmech <hauptmech@gmail.com> | 2015-01-28 15:45:00 +1300 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-31 15:53:34 +0100 |
commit | 0b784c20c8bf69cee281f6717f055b0309d331b1 (patch) | |
tree | 9de9bf48368b35e213569ee1f26fe9083790cc73 /src/systemcmds/config | |
parent | e9bcc0a2624c77c6f71bb926347e85b8c7592e34 (diff) | |
download | px4-firmware-0b784c20c8bf69cee281f6717f055b0309d331b1.tar.gz px4-firmware-0b784c20c8bf69cee281f6717f055b0309d331b1.tar.bz2 px4-firmware-0b784c20c8bf69cee281f6717f055b0309d331b1.zip |
Save and check device id for acc and gyro calibration parameters.config_all_devices
Fix config utility to work with all devices of each type.
Accel, gyro and mag devices correctly set their device_id devtype.
Combo devices (mpu6000 lsm303d) now correctly return their devtype.
config util shows device id for all sensor types.
Add, save during calibration and check during preflight ID parameters for accelerometer and gyro
Diffstat (limited to 'src/systemcmds/config')
-rw-r--r-- | src/systemcmds/config/config.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/systemcmds/config/config.c b/src/systemcmds/config/config.c index 9f13edb18..f54342f06 100644 --- a/src/systemcmds/config/config.c +++ b/src/systemcmds/config/config.c @@ -81,7 +81,7 @@ config_main(int argc, char *argv[]) do_device(argc - 1, argv + 1); } } - + errx(1, "expected a device, try '/dev/gyro', '/dev/accel', '/dev/mag'"); } @@ -192,8 +192,12 @@ do_gyro(int argc, char *argv[]) int srate = ioctl(fd, GYROIOCGSAMPLERATE, 0); int prate = ioctl(fd, SENSORIOCGPOLLRATE, 0); int range = ioctl(fd, GYROIOCGRANGE, 0); + int id = ioctl(fd, DEVIOCGDEVICEID,0); + int32_t calibration_id = 0; + + param_get(param_find("SENS_GYRO_ID"), &(calibration_id)); - warnx("gyro: \n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d dps", srate, prate, range); + warnx("gyro: \n\tdevice id:\t0x%X\t(calibration is for device id 0x%X)\n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d dps", id, calibration_id, srate, prate, range); close(fd); } @@ -267,9 +271,10 @@ do_mag(int argc, char *argv[]) int range = ioctl(fd, MAGIOCGRANGE, 0); int id = ioctl(fd, DEVIOCGDEVICEID,0); int32_t calibration_id = 0; + param_get(param_find("SENS_MAG_ID"), &(calibration_id)); - warnx("mag: \n\tdevice id:\t%x\t(calibration is for device id %x)\n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d Ga", id, calibration_id, srate, prate, range); + warnx("mag: \n\tdevice id:\t0x%X\t(calibration is for device id 0x%X)\n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d Ga", id, calibration_id, srate, prate, range); close(fd); } @@ -341,8 +346,12 @@ do_accel(int argc, char *argv[]) int srate = ioctl(fd, ACCELIOCGSAMPLERATE, 0); int prate = ioctl(fd, SENSORIOCGPOLLRATE, 0); int range = ioctl(fd, ACCELIOCGRANGE, 0); + int id = ioctl(fd, DEVIOCGDEVICEID,0); + int32_t calibration_id = 0; + + param_get(param_find("SENS_ACC_ID"), &(calibration_id)); - warnx("accel: \n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d G", srate, prate, range); + warnx("accel: \n\tdevice id:\t0x%X\t(calibration is for device id 0x%X)\n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d G", id, calibration_id, srate, prate, range); close(fd); } |