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-30 13:50:51 +02:00
committed by Julian Oes
parent c606554da3
commit 241fd629ce
42 changed files with 207 additions and 504 deletions
+4 -15
View File
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <drivers/device/device.h>
#include <px4_defines.h>
#include <sys/types.h>
#include <stdint.h>
@@ -88,12 +89,6 @@
#define SR04_CONVERSION_INTERVAL 100000 /* 100ms for one sonar */
/* oddly, ERROR is not defined for c++ */
#ifdef ERROR
# undef ERROR
#endif
static const int ERROR = -1;
#ifndef CONFIG_SCHED_WORKQUEUE
# error This requires CONFIG_SCHED_WORKQUEUE.
#endif
@@ -269,18 +264,18 @@ HC_SR04::~HC_SR04()
int
HC_SR04::init()
{
int ret = ERROR;
int ret = PX4_ERROR;
/* do I2C init (and probe) first */
if (CDev::init() != OK) {
return ERROR;
return PX4_ERROR;
}
/* allocate basic report buffers */
_reports = new ringbuffer::RingBuffer(2, sizeof(distance_sensor_s));
if (_reports == nullptr) {
return ERROR;
return PX4_ERROR;
}
_class_instance = register_class_devname(RANGE_FINDER_BASE_DEVICE_PATH);
@@ -739,12 +734,6 @@ HC_SR04::print_info()
namespace hc_sr04
{
/* oddly, ERROR is not defined for c++ */
#ifdef ERROR
# undef ERROR
#endif
const int ERROR = -1;
HC_SR04 *g_dev;
void start();