mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
iridiumsbd: discard all pending data for flow control enabled
This commit is contained in:
parent
7653bd1757
commit
c73028bb1b
@ -60,7 +60,7 @@ IridiumSBD::IridiumSBD()
|
||||
|
||||
IridiumSBD::~IridiumSBD()
|
||||
{
|
||||
::close(_uart_fd);
|
||||
deinit();
|
||||
}
|
||||
|
||||
int IridiumSBD::task_spawn(int argc, char *argv[])
|
||||
@ -214,6 +214,16 @@ int IridiumSBD::init(int argc, char *argv[])
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
void IridiumSBD::deinit()
|
||||
{
|
||||
if (_uart_fd >= 0) {
|
||||
/* discard all pending data, as close() might block otherwise on NuttX with flow control enabled */
|
||||
tcflush(_uart_fd, TCIOFLUSH);
|
||||
::close(_uart_fd);
|
||||
_uart_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int IridiumSBD::print_status()
|
||||
{
|
||||
PX4_INFO("started");
|
||||
|
||||
@ -141,6 +141,7 @@ public:
|
||||
|
||||
private:
|
||||
int init(int argc, char *argv[]);
|
||||
void deinit();
|
||||
|
||||
/*
|
||||
* Loop executed while in SATCOM_STATE_STANDBY
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user