mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 01:41:37 +08:00
config cmd: Eleminate warnings
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||||
* Author: Lorenz Meier <lm@inf.ethz.ch>
|
|
||||||
* Author: Julian Oes <joes@student.ethz.ch>
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -94,7 +92,6 @@ do_device(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
|
||||||
|
|
||||||
fd = open(argv[0], 0);
|
fd = open(argv[0], 0);
|
||||||
|
|
||||||
@@ -104,6 +101,8 @@ do_device(int argc, char *argv[])
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[1], "block")) {
|
if (argc == 2 && !strcmp(argv[1], "block")) {
|
||||||
|
|
||||||
/* disable the device publications */
|
/* disable the device publications */
|
||||||
@@ -132,7 +131,6 @@ static void
|
|||||||
do_gyro(int argc, char *argv[])
|
do_gyro(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
|
||||||
|
|
||||||
fd = open(GYRO_DEVICE_PATH, 0);
|
fd = open(GYRO_DEVICE_PATH, 0);
|
||||||
|
|
||||||
@@ -142,6 +140,8 @@ do_gyro(int argc, char *argv[])
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
||||||
|
|
||||||
/* set the gyro internal sampling rate up to at least i Hz */
|
/* set the gyro internal sampling rate up to at least i Hz */
|
||||||
@@ -173,8 +173,12 @@ do_gyro(int argc, char *argv[])
|
|||||||
warnx("gyro self test FAILED! Check calibration:");
|
warnx("gyro self test FAILED! Check calibration:");
|
||||||
struct gyro_scale scale;
|
struct gyro_scale scale;
|
||||||
ret = ioctl(fd, GYROIOCGSCALE, (long unsigned int)&scale);
|
ret = ioctl(fd, GYROIOCGSCALE, (long unsigned int)&scale);
|
||||||
warnx("offsets: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_offset, scale.y_offset, scale.z_offset);
|
if (ret) {
|
||||||
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_scale, scale.y_scale, scale.z_scale);
|
err(1, "gyro scale fail");
|
||||||
|
}
|
||||||
|
|
||||||
|
warnx("offsets: X: % 9.6f Y: % 9.6f Z: % 9.6f", (double)scale.x_offset, (double)scale.y_offset, (double)scale.z_offset);
|
||||||
|
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", (double)scale.x_scale, (double)scale.y_scale, (double)scale.z_scale);
|
||||||
} else {
|
} else {
|
||||||
warnx("gyro calibration and self test OK");
|
warnx("gyro calibration and self test OK");
|
||||||
}
|
}
|
||||||
@@ -199,7 +203,6 @@ static void
|
|||||||
do_mag(int argc, char *argv[])
|
do_mag(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
|
||||||
|
|
||||||
fd = open(MAG_DEVICE_PATH, 0);
|
fd = open(MAG_DEVICE_PATH, 0);
|
||||||
|
|
||||||
@@ -209,6 +212,8 @@ do_mag(int argc, char *argv[])
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
||||||
|
|
||||||
/* set the mag internal sampling rate up to at least i Hz */
|
/* set the mag internal sampling rate up to at least i Hz */
|
||||||
@@ -240,8 +245,13 @@ do_mag(int argc, char *argv[])
|
|||||||
warnx("mag self test FAILED! Check calibration:");
|
warnx("mag self test FAILED! Check calibration:");
|
||||||
struct mag_scale scale;
|
struct mag_scale scale;
|
||||||
ret = ioctl(fd, MAGIOCGSCALE, (long unsigned int)&scale);
|
ret = ioctl(fd, MAGIOCGSCALE, (long unsigned int)&scale);
|
||||||
warnx("offsets: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_offset, scale.y_offset, scale.z_offset);
|
|
||||||
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_scale, scale.y_scale, scale.z_scale);
|
if (ret) {
|
||||||
|
errx(ret, "failed getting mag scale");
|
||||||
|
}
|
||||||
|
|
||||||
|
warnx("offsets: X: % 9.6f Y: % 9.6f Z: % 9.6f", (double)scale.x_offset, (double)scale.y_offset, (double)scale.z_offset);
|
||||||
|
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", (double)scale.x_scale, (double)scale.y_scale, (double)scale.z_scale);
|
||||||
} else {
|
} else {
|
||||||
warnx("mag calibration and self test OK");
|
warnx("mag calibration and self test OK");
|
||||||
}
|
}
|
||||||
@@ -266,7 +276,6 @@ static void
|
|||||||
do_accel(int argc, char *argv[])
|
do_accel(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
|
||||||
|
|
||||||
fd = open(ACCEL_DEVICE_PATH, 0);
|
fd = open(ACCEL_DEVICE_PATH, 0);
|
||||||
|
|
||||||
@@ -276,6 +285,8 @@ do_accel(int argc, char *argv[])
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
||||||
|
|
||||||
/* set the accel internal sampling rate up to at least i Hz */
|
/* set the accel internal sampling rate up to at least i Hz */
|
||||||
@@ -307,8 +318,13 @@ do_accel(int argc, char *argv[])
|
|||||||
warnx("accel self test FAILED! Check calibration:");
|
warnx("accel self test FAILED! Check calibration:");
|
||||||
struct accel_scale scale;
|
struct accel_scale scale;
|
||||||
ret = ioctl(fd, ACCELIOCGSCALE, (long unsigned int)&scale);
|
ret = ioctl(fd, ACCELIOCGSCALE, (long unsigned int)&scale);
|
||||||
warnx("offsets: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_offset, scale.y_offset, scale.z_offset);
|
|
||||||
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_scale, scale.y_scale, scale.z_scale);
|
if (ret) {
|
||||||
|
errx(ret, "failed getting mag scale");
|
||||||
|
}
|
||||||
|
|
||||||
|
warnx("offsets: X: % 9.6f Y: % 9.6f Z: % 9.6f", (double)scale.x_offset, (double)scale.y_offset, (double)scale.z_offset);
|
||||||
|
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", (double)scale.x_scale, (double)scale.y_scale, (double)scale.z_scale);
|
||||||
} else {
|
} else {
|
||||||
warnx("accel calibration and self test OK");
|
warnx("accel calibration and self test OK");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user