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
@@ -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) {