mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 02:33:34 +08:00
Voxl ESC driver update (#23022)
* Made Serial API open the UART in NON BLOCKING mode * Updated voxl_esc driver to latest from ModalAI fork * Ported voxl_esc driver over to new Serial UART API * Removed voxl_esc serial abstraction since new Serial API is already a serial abstraction
This commit is contained in:
@@ -55,6 +55,7 @@ public:
|
||||
virtual ~Serial();
|
||||
|
||||
// Open sets up the port and gets it configured based on desired configuration
|
||||
// The port is always opened in NON BLOCKING mode.
|
||||
bool open();
|
||||
bool isOpen() const;
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ bool SerialImpl::open()
|
||||
}
|
||||
|
||||
// Open the serial port
|
||||
int serial_fd = ::open(_port, O_RDWR | O_NOCTTY);
|
||||
int serial_fd = ::open(_port, O_RDWR | O_NOCTTY | O_NONBLOCK);
|
||||
|
||||
if (serial_fd < 0) {
|
||||
PX4_ERR("failed to open %s err: %d", _port, errno);
|
||||
|
||||
@@ -114,6 +114,7 @@ private:
|
||||
bool _single_wire_mode{false};
|
||||
bool _swap_rx_tx_mode{false};
|
||||
bool _inverted_mode{false};
|
||||
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
|
||||
@@ -114,6 +114,7 @@ private:
|
||||
bool _single_wire_mode{false};
|
||||
bool _swap_rx_tx_mode{false};
|
||||
bool _inverted_mode{false};
|
||||
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
|
||||
@@ -179,7 +179,7 @@ bool SerialImpl::open()
|
||||
}
|
||||
|
||||
// Open the serial port
|
||||
int serial_fd = ::open(_port, O_RDWR | O_NOCTTY);
|
||||
int serial_fd = ::open(_port, O_RDWR | O_NOCTTY | O_NONBLOCK);
|
||||
|
||||
if (serial_fd < 0) {
|
||||
PX4_ERR("failed to open %s err: %d", _port, errno);
|
||||
|
||||
@@ -163,7 +163,7 @@ ssize_t SerialImpl::read(uint8_t *buffer, size_t buffer_size)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ret_read = qurt_uart_read(_serial_fd, (char *) buffer, buffer_size, 500);
|
||||
int ret_read = qurt_uart_read(_serial_fd, (char *) buffer, buffer_size, 100);
|
||||
|
||||
if (ret_read < 0) {
|
||||
PX4_DEBUG("%s read error %d", _port, ret_read);
|
||||
|
||||
Reference in New Issue
Block a user