mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
Updated tests suite properly to MPU-6000 driver, should pass now
This commit is contained in:
@@ -60,7 +60,7 @@
|
|||||||
#include <arch/board/drv_bma180.h>
|
#include <arch/board/drv_bma180.h>
|
||||||
#include <arch/board/drv_l3gd20.h>
|
#include <arch/board/drv_l3gd20.h>
|
||||||
#include <arch/board/drv_hmc5883l.h>
|
#include <arch/board/drv_hmc5883l.h>
|
||||||
#include <arch/board/drv_mpu6000.h>
|
#include <drivers/drv_accel.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -331,7 +331,7 @@ mpu6000(int argc, char *argv[])
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
int16_t buf[6] = { -1, 0, -1, 0, -1, 0};
|
struct accel_report buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
fd = open("/dev/accel", O_RDONLY);
|
fd = open("/dev/accel", O_RDONLY);
|
||||||
@@ -345,14 +345,14 @@ mpu6000(int argc, char *argv[])
|
|||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
/* read data - expect samples */
|
/* read data - expect samples */
|
||||||
ret = read(fd, buf, sizeof(buf));
|
ret = read(fd, &buf, sizeof(buf));
|
||||||
|
|
||||||
if (ret < 3) {
|
if (ret < 3) {
|
||||||
printf("\tMPU-6000: read1 fail (%d)\n", ret);
|
printf("\tMPU-6000: read1 fail (%d)\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
|
||||||
} else {
|
} 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 */
|
// /* 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));
|
ret = read(fd, buf, sizeof(buf));
|
||||||
|
|
||||||
if (ret != 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 */
|
/* waiting for device to become ready, this is not an error */
|
||||||
} else {
|
} else {
|
||||||
printf("\tMS5611: read fail (%d)\n", ret);
|
printf("\tMS5611: read fail (%d)\n", ret);
|
||||||
|
|||||||
Reference in New Issue
Block a user