AP_HAL_Linux: do not create unnecessary consoles in UARTDriver

This commit is contained in:
Staroselskii Georgii 2016-07-08 16:16:11 +03:00 committed by Lucas De Marchi
parent 7b3a5e3158
commit a1f151a79b

View File

@ -61,9 +61,10 @@ void UARTDriver::begin(uint32_t b)
void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
{
if (!_initialised) {
if (device_path == NULL && _console) {
_device = new ConsoleDevice();
} else if (!_initialised) {
} else {
if (device_path == NULL) {
return;
}
@ -76,6 +77,7 @@ void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
_device = new ConsoleDevice();
}
}
}
if (!_connected) {
_connected = _device->open();