ERROR macro: get rid of the many 'oddly, ERROR is not defined for c++', use PX4_ERROR

This commit is contained in:
Beat Küng
2016-09-20 10:30:18 +02:00
committed by Julian Oes
parent c606554da3
commit 241fd629ce
42 changed files with 207 additions and 504 deletions
+5 -10
View File
@@ -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;
}