diff options
-rw-r--r-- | apps/px4/tests/test_sensors.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/px4/tests/test_sensors.c b/apps/px4/tests/test_sensors.c index 01fa48cc9..91397d11c 100644 --- a/apps/px4/tests/test_sensors.c +++ b/apps/px4/tests/test_sensors.c @@ -60,7 +60,7 @@ #include <arch/board/drv_bma180.h> #include <arch/board/drv_l3gd20.h> #include <arch/board/drv_hmc5883l.h> -#include <arch/board/drv_mpu6000.h> +#include <drivers/drv_accel.h> /**************************************************************************** * Pre-processor Definitions @@ -331,7 +331,7 @@ mpu6000(int argc, char *argv[]) fflush(stdout); int fd; - int16_t buf[6] = { -1, 0, -1, 0, -1, 0}; + struct accel_report buf; int ret; fd = open("/dev/accel", O_RDONLY); @@ -345,14 +345,14 @@ mpu6000(int argc, char *argv[]) usleep(100000); /* read data - expect samples */ - ret = read(fd, buf, sizeof(buf)); + ret = read(fd, &buf, 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:%8.4f\ty:%8.4f\tz:%8.4f\n", (double)buf.x, (double)buf.y, (double)buf.z);//\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 */ @@ -398,7 +398,8 @@ ms5611(int argc, char *argv[]) ret = read(fd, buf, sizeof(buf)); if (ret != sizeof(buf)) { - if ((uint8_t)ret == -EAGAIN || (uint8_t)ret == -EINPROGRESS || i < 3) { + + if ((int8_t)ret == -EAGAIN || (int8_t)ret == -EINPROGRESS) { /* waiting for device to become ready, this is not an error */ } else { printf("\tMS5611: read fail (%d)\n", ret); |