mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 07:14:07 +08:00
config cmd: Eleminate warnings
This commit is contained in:
parent
dc3b496655
commit
b0d06d2109
@ -1,8 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved.
|
||||
* Author: Lorenz Meier <lm@inf.ethz.ch>
|
||||
* Author: Julian Oes <joes@student.ethz.ch>
|
||||
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -94,7 +92,6 @@ do_device(int argc, char *argv[])
|
||||
}
|
||||
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
fd = open(argv[0], 0);
|
||||
|
||||
@ -104,6 +101,8 @@ do_device(int argc, char *argv[])
|
||||
|
||||
} else {
|
||||
|
||||
int ret;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "block")) {
|
||||
|
||||
/* disable the device publications */
|
||||
@ -132,7 +131,6 @@ static void
|
||||
do_gyro(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
fd = open(GYRO_DEVICE_PATH, 0);
|
||||
|
||||
@ -142,6 +140,8 @@ do_gyro(int argc, char *argv[])
|
||||
|
||||
} else {
|
||||
|
||||
int ret;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
||||
|
||||
/* 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:");
|
||||
struct gyro_scale 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);
|
||||
warnx("scale: X: % 9.6f Y: % 9.6f Z: % 9.6f", scale.x_scale, scale.y_scale, scale.z_scale);
|
||||
if (ret) {
|
||||
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 {
|
||||
warnx("gyro calibration and self test OK");
|
||||
}
|
||||
@ -199,7 +203,6 @@ static void
|
||||
do_mag(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
fd = open(MAG_DEVICE_PATH, 0);
|
||||
|
||||
@ -209,6 +212,8 @@ do_mag(int argc, char *argv[])
|
||||
|
||||
} else {
|
||||
|
||||
int ret;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
||||
|
||||
/* 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:");
|
||||
struct mag_scale 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 {
|
||||
warnx("mag calibration and self test OK");
|
||||
}
|
||||
@ -266,7 +276,6 @@ static void
|
||||
do_accel(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
fd = open(ACCEL_DEVICE_PATH, 0);
|
||||
|
||||
@ -276,6 +285,8 @@ do_accel(int argc, char *argv[])
|
||||
|
||||
} else {
|
||||
|
||||
int ret;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[0], "sampling")) {
|
||||
|
||||
/* 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:");
|
||||
struct accel_scale 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 {
|
||||
warnx("accel calibration and self test OK");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user