mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 06:03: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:
@@ -124,7 +124,7 @@ Airspeed::~Airspeed()
|
||||
int
|
||||
Airspeed::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -82,12 +83,6 @@
|
||||
/* Default I2C bus */
|
||||
#define PX4_I2C_BUS_DEFAULT PX4_I2C_BUS_EXPANSION
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
@@ -68,12 +69,6 @@
|
||||
#define ACCEL_DEVICE_PATH "/dev/bma180"
|
||||
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
#define DIR_READ (1<<7)
|
||||
#define DIR_WRITE (0<<7)
|
||||
|
||||
@@ -275,7 +270,7 @@ BMA180::~BMA180()
|
||||
int
|
||||
BMA180::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do SPI init (and probe) first */
|
||||
if (SPI::init() != OK) {
|
||||
@@ -321,7 +316,7 @@ BMA180::init()
|
||||
ret = OK;
|
||||
|
||||
} else {
|
||||
ret = ERROR;
|
||||
ret = PX4_ERROR;
|
||||
}
|
||||
|
||||
_class_instance = register_class_devname(ACCEL_DEVICE_PATH);
|
||||
|
||||
@@ -265,12 +265,6 @@ ETSAirspeed::cycle()
|
||||
namespace ets_airspeed
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
ETSAirspeed *g_dev;
|
||||
|
||||
void start(int i2c_bus);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -123,12 +124,6 @@ enum HMC5883_BUS {
|
||||
HMC5883_BUS_SPI
|
||||
};
|
||||
|
||||
/* 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
|
||||
@@ -416,7 +411,7 @@ HMC5883::~HMC5883()
|
||||
int
|
||||
HMC5883::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
ret = CDev::init();
|
||||
|
||||
@@ -1236,7 +1231,7 @@ out:
|
||||
if (check_scale()) {
|
||||
/* failed */
|
||||
warnx("FAILED: SCALE");
|
||||
ret = ERROR;
|
||||
ret = PX4_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1439,12 +1434,6 @@ HMC5883::print_info()
|
||||
namespace hmc5883
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
/*
|
||||
list of supported bus configurations
|
||||
*/
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -57,12 +58,6 @@
|
||||
|
||||
#define DEFAULT_UART "/dev/ttyS0"; /**< USART1 */
|
||||
|
||||
/* Oddly, ERROR is not defined for C++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
static int thread_should_exit = false; /**< Deamon exit flag */
|
||||
static int thread_running = false; /**< Deamon status flag */
|
||||
static int deamon_task; /**< Handle of deamon task / thread */
|
||||
@@ -133,7 +128,7 @@ recv_data(int uart, uint8_t *buffer, size_t *size, uint8_t *id)
|
||||
}
|
||||
}
|
||||
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -60,12 +61,6 @@
|
||||
|
||||
#define DEFAULT_UART "/dev/ttyS6"; /**< Serial4 */
|
||||
|
||||
/* Oddly, ERROR is not defined for C++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
static int thread_should_exit = false; /**< Deamon exit flag */
|
||||
static int thread_running = false; /**< Deamon status flag */
|
||||
static int deamon_task; /**< Handle of deamon task / thread */
|
||||
@@ -124,7 +119,7 @@ recv_req_id(int uart, uint8_t *id)
|
||||
|
||||
/* if we have a binary mode request */
|
||||
if (mode != BINARY_MODE_REQUEST_ID) {
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
/* Read the device ID being polled */
|
||||
@@ -132,10 +127,10 @@ recv_req_id(int uart, uint8_t *id)
|
||||
|
||||
} else {
|
||||
warnx("UART timeout on TX/RX port");
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
return OK;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -165,7 +160,7 @@ send_data(int uart, uint8_t *buffer, size_t size)
|
||||
uint8_t dummy[size];
|
||||
read(uart, &dummy, size);
|
||||
|
||||
return OK;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -217,10 +212,9 @@ hott_telemetry_thread_main(int argc, char *argv[])
|
||||
|
||||
while (!thread_should_exit) {
|
||||
// Listen for and serve poll from the receiver.
|
||||
if (recv_req_id(uart, &id) == OK) {
|
||||
if (recv_req_id(uart, &id) == PX4_OK) {
|
||||
if (!connected) {
|
||||
connected = true;
|
||||
warnx("OK");
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
@@ -74,12 +75,6 @@
|
||||
|
||||
#define L3GD20_DEVICE_PATH "/dev/l3gd20"
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
/* Orientation on board */
|
||||
#define SENSOR_BOARD_ROTATION_000_DEG 0
|
||||
#define SENSOR_BOARD_ROTATION_090_DEG 1
|
||||
@@ -476,7 +471,7 @@ L3GD20::~L3GD20()
|
||||
int
|
||||
L3GD20::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do SPI init (and probe) first */
|
||||
if (SPI::init() != OK) {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -115,12 +116,6 @@ enum LIS3MDL_BUS {
|
||||
LIS3MDL_BUS_SPI
|
||||
};
|
||||
|
||||
/* 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
|
||||
@@ -406,7 +401,7 @@ LIS3MDL::~LIS3MDL()
|
||||
int
|
||||
LIS3MDL::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
ret = CDev::init();
|
||||
|
||||
@@ -1179,7 +1174,7 @@ out:
|
||||
if (check_scale()) {
|
||||
/* failed */
|
||||
warnx("FAILED: SCALE");
|
||||
ret = ERROR;
|
||||
ret = PX4_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1325,12 +1320,6 @@ LIS3MDL::print_info()
|
||||
namespace lis3mdl
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
/*
|
||||
list of supported bus configurations
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include "LidarLiteI2C.h"
|
||||
#include <px4_defines.h>
|
||||
#include <semaphore.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
@@ -48,12 +49,6 @@
|
||||
#include <stdio.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
LidarLiteI2C::LidarLiteI2C(int bus, const char *path, int address) :
|
||||
I2C("LL40LS", path, bus, address, 100000),
|
||||
_work{},
|
||||
@@ -110,7 +105,7 @@ LidarLiteI2C::~LidarLiteI2C()
|
||||
|
||||
int LidarLiteI2C::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
|
||||
@@ -45,14 +45,10 @@
|
||||
#include "LidarLitePWM.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <px4_defines.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <drivers/drv_pwm_input.h>
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef __cplusplus
|
||||
static const int ERROR = -1;
|
||||
#endif
|
||||
|
||||
LidarLitePWM::LidarLitePWM(const char *path) :
|
||||
CDev("LidarLitePWM", path),
|
||||
_work{},
|
||||
@@ -95,15 +91,15 @@ int LidarLitePWM::init()
|
||||
/* do regular cdev init */
|
||||
int ret = CDev::init();
|
||||
|
||||
if (ret != OK) {
|
||||
return ERROR;
|
||||
if (ret != PX4_OK) {
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
/* allocate basic report buffers */
|
||||
_reports = new ringbuffer::RingBuffer(2, sizeof(struct distance_sensor_s));
|
||||
|
||||
if (_reports == nullptr) {
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
_class_instance = register_class_devname(RANGE_FINDER_BASE_DEVICE_PATH);
|
||||
@@ -119,7 +115,7 @@ int LidarLitePWM::init()
|
||||
DEVICE_DEBUG("failed to create distance_sensor object. Did you start uOrb?");
|
||||
}
|
||||
|
||||
return OK;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
void LidarLitePWM::print_info()
|
||||
@@ -172,11 +168,11 @@ int LidarLitePWM::measure()
|
||||
{
|
||||
perf_begin(_sample_perf);
|
||||
|
||||
if (OK != collect()) {
|
||||
if (PX4_OK != collect()) {
|
||||
DEVICE_DEBUG("collection error");
|
||||
perf_count(_read_errors);
|
||||
perf_end(_sample_perf);
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
_range.timestamp = hrt_absolute_time();
|
||||
@@ -206,7 +202,7 @@ int LidarLitePWM::measure()
|
||||
|
||||
poll_notify(POLLIN);
|
||||
perf_end(_sample_perf);
|
||||
return OK;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
ssize_t LidarLitePWM::read(struct file *filp, char *buffer, size_t buflen)
|
||||
@@ -266,12 +262,12 @@ int LidarLitePWM::collect()
|
||||
int fd = ::open(PWMIN0_DEVICE_PATH, O_RDONLY);
|
||||
|
||||
if (fd == -1) {
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
if (::read(fd, &_pwm, sizeof(_pwm)) == sizeof(_pwm)) {
|
||||
::close(fd);
|
||||
return OK;
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
::close(fd);
|
||||
@@ -284,7 +280,7 @@ int LidarLitePWM::reset_sensor()
|
||||
int fd = ::open(PWMIN0_DEVICE_PATH, O_RDONLY);
|
||||
|
||||
if (fd == -1) {
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
int ret = ::ioctl(fd, SENSORIOCRESET, 0);
|
||||
|
||||
@@ -70,12 +70,6 @@ extern "C" __EXPORT int ll40ls_main(int argc, char *argv[]);
|
||||
namespace ll40ls
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
LidarLiteI2C *g_dev_int;
|
||||
LidarLiteI2C *g_dev_ext;
|
||||
LidarLitePWM *g_dev_pwm;
|
||||
@@ -132,7 +126,7 @@ void start(const bool use_i2c, const int bus)
|
||||
|
||||
g_dev_ext = new LidarLiteI2C(PX4_I2C_BUS_EXPANSION, LL40LS_DEVICE_PATH_EXT);
|
||||
|
||||
if (g_dev_ext != nullptr && OK != g_dev_ext->init()) {
|
||||
if (g_dev_ext != nullptr && PX4_OK != g_dev_ext->init()) {
|
||||
delete g_dev_ext;
|
||||
g_dev_ext = nullptr;
|
||||
|
||||
@@ -152,7 +146,7 @@ void start(const bool use_i2c, const int bus)
|
||||
|
||||
g_dev_int = new LidarLiteI2C(PX4_I2C_BUS_ONBOARD, LL40LS_DEVICE_PATH_INT);
|
||||
|
||||
if (g_dev_int != nullptr && OK != g_dev_int->init()) {
|
||||
if (g_dev_int != nullptr && PX4_OK != g_dev_int->init()) {
|
||||
/* tear down the failing onboard instance */
|
||||
delete g_dev_int;
|
||||
g_dev_int = nullptr;
|
||||
@@ -203,7 +197,7 @@ void start(const bool use_i2c, const int bus)
|
||||
} else {
|
||||
g_dev_pwm = new LidarLitePWM(LL40LS_DEVICE_PATH_PWM);
|
||||
|
||||
if (g_dev_pwm != nullptr && OK != g_dev_pwm->init()) {
|
||||
if (g_dev_pwm != nullptr && PX4_OK != g_dev_pwm->init()) {
|
||||
delete g_dev_pwm;
|
||||
g_dev_pwm = nullptr;
|
||||
warnx("failed to init PWM");
|
||||
@@ -321,7 +315,7 @@ test(const bool use_i2c, const int bus)
|
||||
warnx("time: %lld", report.timestamp);
|
||||
|
||||
/* start the sensor polling at 2Hz */
|
||||
if (OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) {
|
||||
if (PX4_OK != ioctl(fd, SENSORIOCSPOLLRATE, 2)) {
|
||||
errx(1, "failed to set 2Hz poll rate");
|
||||
}
|
||||
|
||||
@@ -353,7 +347,7 @@ test(const bool use_i2c, const int bus)
|
||||
}
|
||||
|
||||
/* reset the sensor polling to default rate */
|
||||
if (OK != ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT)) {
|
||||
if (PX4_OK != ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT)) {
|
||||
errx(1, "failed to set default poll rate");
|
||||
}
|
||||
|
||||
|
||||
@@ -187,12 +187,6 @@ enum LPS25H_BUS {
|
||||
LPS25H_BUS_SPI
|
||||
};
|
||||
|
||||
/* 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
|
||||
@@ -818,12 +812,6 @@ LPS25H::print_info()
|
||||
namespace lps25h
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
/*
|
||||
list of supported bus configurations
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -71,12 +72,6 @@
|
||||
#include <mathlib/math/filter/LowPassFilter2p.hpp>
|
||||
#include <lib/conversion/rotation.h>
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
/* SPI protocol address bits */
|
||||
#define DIR_READ (1<<7)
|
||||
#define DIR_WRITE (0<<7)
|
||||
@@ -647,7 +642,7 @@ LSM303D::~LSM303D()
|
||||
int
|
||||
LSM303D::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do SPI init (and probe) first */
|
||||
if (SPI::init() != OK) {
|
||||
@@ -2060,7 +2055,7 @@ test()
|
||||
|
||||
warnx("accel range: %8.4f m/s^2", (double)accel_report.range_m_s2);
|
||||
|
||||
if (ERROR == (ret = ioctl(fd_accel, ACCELIOCGLOWPASS, 0))) {
|
||||
if (PX4_ERROR == (ret = ioctl(fd_accel, ACCELIOCGLOWPASS, 0))) {
|
||||
warnx("accel antialias filter bandwidth: fail");
|
||||
|
||||
} else {
|
||||
|
||||
@@ -92,13 +92,6 @@
|
||||
#define MB12XX_CONVERSION_INTERVAL 100000 /* 60ms for one sonar */
|
||||
#define TICKS_BETWEEN_SUCCESIVE_FIRES 100000 /* 30ms between each sonar measurement (watch out for interference!) */
|
||||
|
||||
|
||||
/* 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
|
||||
@@ -251,7 +244,7 @@ MB12XX::~MB12XX()
|
||||
int
|
||||
MB12XX::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
@@ -729,12 +722,6 @@ MB12XX::print_info()
|
||||
namespace mb12xx
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
MB12XX *g_dev;
|
||||
|
||||
void start();
|
||||
|
||||
@@ -399,12 +399,6 @@ MEASAirspeed::voltage_correction(float &diff_press_pa, float &temperature)
|
||||
namespace meas_airspeed
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
MEASAirspeed *g_dev = nullptr;
|
||||
|
||||
void start(int i2c_bus);
|
||||
|
||||
@@ -83,12 +83,6 @@ enum MS5611_BUS {
|
||||
MS5611_BUS_SPI_EXTERNAL
|
||||
};
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -108,12 +109,6 @@
|
||||
*/
|
||||
#define PCA9685_SCALE ((PCA9685_PWMMAX - PCA9685_PWMCENTER)/(M_DEG_TO_RAD_F * PCA9685_MAXSERVODEG)) // scales from rad to PWM
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
class PCA9685 : public device::I2C
|
||||
{
|
||||
public:
|
||||
@@ -421,7 +416,7 @@ PCA9685::setPin(uint8_t num, uint16_t val, bool invert)
|
||||
}
|
||||
}
|
||||
|
||||
return ERROR;
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -90,12 +91,6 @@
|
||||
#define PX4FLOW_MAX_DISTANCE 5.0f
|
||||
#define PX4FLOW_MIN_DISTANCE 0.3f
|
||||
|
||||
/* 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
|
||||
@@ -226,7 +221,7 @@ PX4FLOW::~PX4FLOW()
|
||||
int
|
||||
PX4FLOW::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
@@ -663,12 +658,6 @@ PX4FLOW::print_info()
|
||||
namespace px4flow
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
PX4FLOW *g_dev = nullptr;
|
||||
bool start_in_progress = false;
|
||||
|
||||
|
||||
@@ -77,12 +77,6 @@
|
||||
|
||||
/* Configuration Constants */
|
||||
|
||||
/* 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
|
||||
@@ -756,12 +750,6 @@ SF0X::print_info()
|
||||
namespace sf0x
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
SF0X *g_dev;
|
||||
|
||||
void start(const char *port);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -81,12 +82,6 @@
|
||||
#define SF1XX_DEVICE_PATH "/dev/sf1xx"
|
||||
|
||||
|
||||
/* 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
|
||||
@@ -234,7 +229,7 @@ SF1XX::~SF1XX()
|
||||
int
|
||||
SF1XX::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
int hw_model;
|
||||
param_get(param_find("SENS_EN_SF1XX"), &hw_model);
|
||||
|
||||
@@ -653,12 +648,6 @@ SF1XX::print_info()
|
||||
namespace sf1xx
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
SF1XX *g_dev;
|
||||
|
||||
void start();
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -92,12 +93,6 @@
|
||||
#define TICKS_BETWEEN_SUCCESIVE_FIRES 100000 /* 30ms between each sonar measurement (watch out for interference!) */
|
||||
|
||||
|
||||
/* 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
|
||||
@@ -250,7 +245,7 @@ SRF02::~SRF02()
|
||||
int
|
||||
SRF02::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
@@ -731,12 +726,6 @@ SRF02::print_info()
|
||||
namespace srf02
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
SRF02 *g_dev;
|
||||
|
||||
void start();
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -93,13 +94,6 @@
|
||||
#define SRF02_CONVERSION_INTERVAL 100000 /* 60ms for one sonar */
|
||||
#define TICKS_BETWEEN_SUCCESIVE_FIRES 100000 /* 30ms between each sonar measurement (watch out for interference!) */
|
||||
|
||||
|
||||
/* 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
|
||||
@@ -252,7 +246,7 @@ SRF02_I2C::~SRF02_I2C()
|
||||
int
|
||||
SRF02_I2C::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
@@ -732,12 +726,6 @@ SRF02_I2C::print_info()
|
||||
namespace srf02_i2c
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
SRF02_I2C *g_dev;
|
||||
|
||||
void start();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
#include <drivers/device/i2c.h>
|
||||
|
||||
@@ -90,12 +91,6 @@
|
||||
|
||||
#define TRONE_CONVERSION_INTERVAL 50000 /* 50ms */
|
||||
|
||||
/* 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
|
||||
@@ -279,7 +274,7 @@ TRONE::~TRONE()
|
||||
int
|
||||
TRONE::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
int ret = PX4_ERROR;
|
||||
|
||||
/* do I2C init (and probe) first */
|
||||
if (I2C::init() != OK) {
|
||||
@@ -722,12 +717,6 @@ TRONE::print_info()
|
||||
namespace trone
|
||||
{
|
||||
|
||||
/* oddly, ERROR is not defined for c++ */
|
||||
#ifdef ERROR
|
||||
# undef ERROR
|
||||
#endif
|
||||
const int ERROR = -1;
|
||||
|
||||
TRONE *g_dev;
|
||||
|
||||
void start();
|
||||
|
||||
Reference in New Issue
Block a user