aboutsummaryrefslogtreecommitdiff
path: root/apps/px4/tests/test_sensors.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-08-13 22:10:03 +0200
committerLorenz Meier <lm@inf.ethz.ch>2012-08-13 22:10:03 +0200
commit1d029b01fe466b67969d650accf911a75fd620ab (patch)
tree314df263c4f706552a41be54c2aa2e978a2f5b66 /apps/px4/tests/test_sensors.c
parent6fb3bbb5da23454cc9b56cc502b2689572f94a4c (diff)
downloadpx4-firmware-1d029b01fe466b67969d650accf911a75fd620ab.tar.gz
px4-firmware-1d029b01fe466b67969d650accf911a75fd620ab.tar.bz2
px4-firmware-1d029b01fe466b67969d650accf911a75fd620ab.zip
First initial revision of ACC driver and gyro
Diffstat (limited to 'apps/px4/tests/test_sensors.c')
-rw-r--r--apps/px4/tests/test_sensors.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/apps/px4/tests/test_sensors.c b/apps/px4/tests/test_sensors.c
index 1a7ebcc7a..af1213711 100644
--- a/apps/px4/tests/test_sensors.c
+++ b/apps/px4/tests/test_sensors.c
@@ -331,7 +331,7 @@ mpu6000(int argc, char *argv[])
fflush(stdout);
int fd;
- int16_t buf[5] = { -1, 0, -1, 0, -1, 0};
+ int16_t buf[6] = { -1, 0, -1, 0, -1, 0};
int ret;
fd = open("/dev/mpu6000", O_RDONLY);
@@ -341,32 +341,32 @@ mpu6000(int argc, char *argv[])
return ERROR;
}
- // /* wait at least 100ms, sensor should have data after no more than 20ms */
- // usleep(100000);
+ /* wait at least 100ms, sensor should have data after no more than 20ms */
+ usleep(100000);
- // /* read data - expect samples */
- // ret = read(fd, buf, sizeof(buf));
+ /* read data - expect samples */
+ ret = read(fd, buf, sizeof(buf));
- // if (ret != sizeof(buf)) {
- // printf("\tMPU-6000: read1 fail (%d)\n", ret);
- // return ERROR;
+ if (ret != sizeof(buf)) {
+ 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]);
- // }
+ } 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]);
+ }
- // /* 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 */