AP_HAL_Linux: use variadic panic()

While at it also add a prefix with the name of the driver.
This commit is contained in:
Lucas De Marchi 2015-10-22 15:19:23 -02:00 committed by Andrew Tridgell
parent 2af4244854
commit 4b54bcbfad
1 changed files with 4 additions and 10 deletions

View File

@ -21,13 +21,10 @@ using namespace Linux;
RCInput_UART::RCInput_UART(const char *path)
{
char s[256];
_fd = open(path, O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NDELAY);
if (_fd < 0) {
snprintf(s, sizeof(s), "Error opening '%s': %s",
path, strerror(errno));
hal.scheduler->panic(s);
hal.scheduler->panic("RCInput_UART: Error opening '%s': %s",
path, strerror(errno));
}
}
@ -38,8 +35,6 @@ RCInput_UART::~RCInput_UART()
void RCInput_UART::init(void*)
{
char s[256];
struct termios options;
tcgetattr(_fd, &options);
@ -55,9 +50,8 @@ void RCInput_UART::init(void*)
options.c_oflag &= ~OPOST;
if (tcsetattr(_fd, TCSANOW, &options) != 0) {
snprintf(s, sizeof(s), "RCInput_UART: error configuring device: %s",
strerror(errno));
hal.scheduler->panic(s);
hal.scheduler->panic("RCInput_UART: error configuring device: %s",
strerror(errno));
}
tcflush(_fd, TCIOFLUSH);