mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-16 12:50: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:
@@ -49,6 +49,7 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
#include <unistd.h>
|
||||
#include <geo/geo.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
@@ -56,13 +57,6 @@
|
||||
|
||||
#define GEOFENCE_RANGE_WARNING_LIMIT 5000000
|
||||
|
||||
/* Oddly, ERROR is not defined for C++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
|
||||
Geofence::Geofence(Navigator *navigator) :
|
||||
SuperBlock(NULL, "GF"),
|
||||
_navigator(navigator),
|
||||
@@ -323,7 +317,7 @@ Geofence::loadFromFile(const char *filename)
|
||||
int pointCounter = 0;
|
||||
bool gotVertical = false;
|
||||
const char commentChar = '#';
|
||||
int rc = ERROR;
|
||||
int rc = PX4_ERROR;
|
||||
|
||||
/* Make sure no data is left in the datamanager */
|
||||
clearDm();
|
||||
@@ -332,7 +326,7 @@ Geofence::loadFromFile(const char *filename)
|
||||
fp = fopen(GEOFENCE_FILENAME, "r");
|
||||
|
||||
if (fp == NULL) {
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
/* create geofence points from valid lines and store in DM */
|
||||
@@ -408,7 +402,7 @@ Geofence::loadFromFile(const char *filename)
|
||||
_vertices_count = pointCounter;
|
||||
warnx("Geofence: imported successfully");
|
||||
mavlink_log_info(_navigator->get_mavlink_log_pub(), "Geofence imported");
|
||||
rc = OK;
|
||||
rc = PX4_OK;
|
||||
|
||||
} else {
|
||||
warnx("Geofence: import error");
|
||||
@@ -423,5 +417,5 @@ error:
|
||||
int Geofence::clearDm()
|
||||
{
|
||||
dm_clear(DM_KEY_FENCE_POINTS);
|
||||
return OK;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user