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:
px4dev
2012-11-30 00:02:47 -08:00
parent e153476950
commit 9fa794a8fa
10 changed files with 288 additions and 308 deletions
+25 -4
View File
@@ -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)
{
}