mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-06 03:20:34 +08:00
ERROR macro: get rid of the many 'oddly, ERROR is not defined for c++', use PX4_ERROR
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "calibration_routines.h"
|
||||
#include "commander_helper.h"
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <px4_posix.h>
|
||||
#include <px4_time.h>
|
||||
#include <stdio.h>
|
||||
@@ -56,12 +57,6 @@
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/airspeed.h>
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
static const char *sensor_name = "dpress";
|
||||
|
||||
static void feedback_calibration_failed(orb_advert_t *mavlink_log_pub)
|
||||
@@ -72,7 +67,7 @@ static void feedback_calibration_failed(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
{
|
||||
int result = OK;
|
||||
int result = PX4_OK;
|
||||
unsigned calibration_counter = 0;
|
||||
const unsigned maxcount = 2400;
|
||||
|
||||
@@ -96,7 +91,7 @@ int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
int fd = px4_open(AIRSPEED0_DEVICE_PATH, 0);
|
||||
|
||||
if (fd > 0) {
|
||||
if (OK == px4_ioctl(fd, AIRSPEEDIOCSSCALE, (long unsigned int)&airscale)) {
|
||||
if (PX4_OK == px4_ioctl(fd, AIRSPEEDIOCSSCALE, (long unsigned int)&airscale)) {
|
||||
paramreset_successful = true;
|
||||
|
||||
} else {
|
||||
@@ -165,7 +160,7 @@ int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
int fd_scale = px4_open(AIRSPEED0_DEVICE_PATH, 0);
|
||||
airscale.offset_pa = diff_pres_offset;
|
||||
if (fd_scale > 0) {
|
||||
if (OK != px4_ioctl(fd_scale, AIRSPEEDIOCSSCALE, (long unsigned int)&airscale)) {
|
||||
if (PX4_OK != px4_ioctl(fd_scale, AIRSPEEDIOCSSCALE, (long unsigned int)&airscale)) {
|
||||
calibration_log_critical(mavlink_log_pub, "[cal] airspeed offset update failed");
|
||||
}
|
||||
|
||||
@@ -280,6 +275,6 @@ normal_return:
|
||||
return result;
|
||||
|
||||
error_return:
|
||||
result = ERROR;
|
||||
result = PX4_ERROR;
|
||||
goto normal_return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user