diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-01-24 18:11:44 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-01-24 18:11:44 +0100 |
commit | 29d90a2f849f1e6d98551441bb1b722f221018ad (patch) | |
tree | 6e857090f620805cb6c860a1f9b3ccc856d17a67 /src | |
parent | 58792c5ca6e42bc251dd3c92b0e79217ff5d5403 (diff) | |
parent | 7cd2296e1d810935a338eae5428bd8b910043459 (diff) | |
download | px4-firmware-29d90a2f849f1e6d98551441bb1b722f221018ad.tar.gz px4-firmware-29d90a2f849f1e6d98551441bb1b722f221018ad.tar.bz2 px4-firmware-29d90a2f849f1e6d98551441bb1b722f221018ad.zip |
Merge branch 'sbus2' into beta
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/px4io/px4io_uploader.cpp | 6 | ||||
-rw-r--r-- | src/modules/px4iofirmware/sbus.c | 26 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/drivers/px4io/px4io_uploader.cpp b/src/drivers/px4io/px4io_uploader.cpp index 41f93a8ee..d9f991210 100644 --- a/src/drivers/px4io/px4io_uploader.cpp +++ b/src/drivers/px4io/px4io_uploader.cpp @@ -51,6 +51,7 @@ #include <poll.h> #include <termios.h> #include <sys/stat.h> +#include <nuttx/arch.h> #include <crc32.h> @@ -226,6 +227,11 @@ PX4IO_Uploader::upload(const char *filenames[]) close(_fw_fd); close(_io_fd); _io_fd = -1; + + // sleep for enough time for the IO chip to boot. This makes + // forceupdate more reliably startup IO again after update + up_udelay(100*1000); + return ret; } diff --git a/src/modules/px4iofirmware/sbus.c b/src/modules/px4iofirmware/sbus.c index 11ccd7356..495447740 100644 --- a/src/modules/px4iofirmware/sbus.c +++ b/src/modules/px4iofirmware/sbus.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -218,11 +218,33 @@ static bool sbus_decode(hrt_abstime frame_time, uint16_t *values, uint16_t *num_values, uint16_t *rssi, uint16_t max_values) { /* check frame boundary markers to avoid out-of-sync cases */ - if ((frame[0] != 0x0f) || (frame[24] != 0x00)) { + if ((frame[0] != 0x0f)) { sbus_frame_drops++; return false; } + switch (frame[24]) { + case 0x00: + /* this is S.BUS 1 */ + break; + case 0x03: + /* S.BUS 2 SLOT0: RX battery and external voltage */ + break; + case 0x83: + /* S.BUS 2 SLOT1 */ + break; + case 0x43: + case 0xC3: + case 0x23: + case 0xA3: + case 0x63: + case 0xE3: + break; + default: + /* we expect one of the bits above, but there are some we don't know yet */ + break; + } + /* we have received something we think is a frame */ last_frame_time = frame_time; |