mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 02:21:36 +08:00
Rework the PX4IO software architecture:
- Use a separate thread for handing R/C inputs and outputs. - Remove all PX4IO R/C receiver configuration; it's all automatic now. - Rework the main loop, dedicate it to PX4FMU communications after startup. - Fix several issues in the px4io driver that would cause a crash if PX4IO was not responding.
This commit is contained in:
+25
-4
@@ -41,18 +41,39 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#define DEBUG
|
||||
#include "px4io.h"
|
||||
#include "protocol.h"
|
||||
|
||||
void
|
||||
sbus_init(unsigned mode)
|
||||
static int sbus_fd = -1;
|
||||
|
||||
int
|
||||
sbus_init(const char *device)
|
||||
{
|
||||
if (sbus_fd < 0)
|
||||
sbus_fd = open(device, O_RDONLY);
|
||||
|
||||
if (sbus_fd >= 0) {
|
||||
struct termios t;
|
||||
|
||||
/* 100000bps, even parity, two stop bits */
|
||||
tcgetattr(sbus_fd, &t);
|
||||
cfsetspeed(&t, 100000);
|
||||
t.c_cflag |= (CSTOPB | PARENB);
|
||||
tcsetattr(sbus_fd, TCSANOW, &t);
|
||||
|
||||
debug("Sbus: ready");
|
||||
} else {
|
||||
debug("Sbus: open failed");
|
||||
}
|
||||
|
||||
return sbus_fd;
|
||||
}
|
||||
|
||||
void
|
||||
sbus_input(int fd)
|
||||
sbus_input(void)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user