diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-18 12:29:04 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-18 12:29:04 +0200 |
commit | 5aa91b6f172c020a30c7ea52be59adff44840c49 (patch) | |
tree | 2c30344cc256aa6b03128514c5bb5bf31a4dd8a7 /apps/px4 | |
parent | c6eff9eb8bb70a784517b59fe6e5c0b36d33cd56 (diff) | |
download | px4-firmware-5aa91b6f172c020a30c7ea52be59adff44840c49.tar.gz px4-firmware-5aa91b6f172c020a30c7ea52be59adff44840c49.tar.bz2 px4-firmware-5aa91b6f172c020a30c7ea52be59adff44840c49.zip |
Updated MPU test to new driver model
Diffstat (limited to 'apps/px4')
-rw-r--r-- | apps/px4/tests/test_sensors.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apps/px4/tests/test_sensors.c b/apps/px4/tests/test_sensors.c index af1213711..c7bcc8928 100644 --- a/apps/px4/tests/test_sensors.c +++ b/apps/px4/tests/test_sensors.c @@ -94,7 +94,7 @@ struct { {"bma180", "/dev/bma180", bma180}, {"hmc5883l", "/dev/hmc5883l", hmc5883l}, {"ms5611", "/dev/ms5611", ms5611}, - {"mpu6000", "/dev/mpu6000", mpu6000}, + {"mpu6000", "/dev/accel", mpu6000}, // {"lis331", "/dev/lis331", lis331}, {NULL, NULL, NULL} }; @@ -334,10 +334,10 @@ mpu6000(int argc, char *argv[]) int16_t buf[6] = { -1, 0, -1, 0, -1, 0}; int ret; - fd = open("/dev/mpu6000", O_RDONLY); + fd = open("/dev/accel", O_RDONLY); if (fd < 0) { - printf("\tMPU-6000: open fail\n"); + printf("\tMPU-6000: open fail, run <mpu6000 start> first.\n"); return ERROR; } @@ -347,26 +347,26 @@ mpu6000(int argc, char *argv[]) /* read data - expect samples */ ret = read(fd, buf, sizeof(buf)); - if (ret != sizeof(buf)) { + if (ret < 3) { printf("\tMPU-6000: read1 fail (%d)\n", ret); return ERROR; } else { - printf("\tMPU-6000 values: acc: x:%d\ty:%d\tz:%d\tgyro: r:%d\tp:%d\ty:%d\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); + printf("\tMPU-6000 values: acc: x:%d\ty:%d\tz:%d");//\tgyro: r:%d\tp:%d\ty:%d\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); } - /* wait at least 10ms, sensor should have data after no more than 2ms */ - usleep(100000); + // /* wait at least 10ms, sensor should have data after no more than 2ms */ + // usleep(100000); - ret = read(fd, buf, sizeof(buf)); + // ret = read(fd, buf, sizeof(buf)); - if (ret != sizeof(buf)) { - printf("\tMPU-6000: read2 fail (%d)\n", ret); - return ERROR; + // if (ret != sizeof(buf)) { + // printf("\tMPU-6000: read2 fail (%d)\n", ret); + // return ERROR; - } else { - printf("\tMPU-6000 values: acc: x:%d\ty:%d\tz:%d\tgyro: r:%d\tp:%d\ty:%d\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); - } + // } else { + // printf("\tMPU-6000 values: acc: x:%d\ty:%d\tz:%d\tgyro: r:%d\tp:%d\ty:%d\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); + // } /* XXX more tests here */ |