aboutsummaryrefslogtreecommitdiff
path: root/apps/drivers
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-12-01 10:49:52 +0100
committerLorenz Meier <lm@inf.ethz.ch>2012-12-01 10:49:52 +0100
commitde88732e8ecdf1f8451c8c037594f4edb1e2bdc0 (patch)
treeaf6d877598c23ce8f64be56362a8e7964477a9ce /apps/drivers
parentea8872f5456dbba566fb4167ec66b4afa183b3e1 (diff)
downloadpx4-firmware-de88732e8ecdf1f8451c8c037594f4edb1e2bdc0.tar.gz
px4-firmware-de88732e8ecdf1f8451c8c037594f4edb1e2bdc0.tar.bz2
px4-firmware-de88732e8ecdf1f8451c8c037594f4edb1e2bdc0.zip
Prevented unhealthy RC input from propagating through the system
Diffstat (limited to 'apps/drivers')
-rw-r--r--apps/drivers/px4io/px4io.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/drivers/px4io/px4io.cpp b/apps/drivers/px4io/px4io.cpp
index 49ad80943..296c541c9 100644
--- a/apps/drivers/px4io/px4io.cpp
+++ b/apps/drivers/px4io/px4io.cpp
@@ -461,15 +461,17 @@ PX4IO::rx_callback(const uint8_t *buffer, size_t bytes_received)
}
_connected = true;
- /* publish raw rc channel values from IO */
- _input_rc.timestamp = hrt_absolute_time();
- _input_rc.channel_count = rep->channel_count;
- for (int i = 0; i < rep->channel_count; i++)
- {
- _input_rc.values[i] = rep->rc_channel[i];
- }
+ /* publish raw rc channel values from IO if valid channels are present */
+ if (rep->channel_count > 0) {
+ _input_rc.timestamp = hrt_absolute_time();
+ _input_rc.channel_count = rep->channel_count;
+ for (int i = 0; i < rep->channel_count; i++)
+ {
+ _input_rc.values[i] = rep->rc_channel[i];
+ }
- orb_publish(ORB_ID(input_rc), _to_input_rc, &_input_rc);
+ orb_publish(ORB_ID(input_rc), _to_input_rc, &_input_rc);
+ }
/* remember the latched arming switch state */
_switch_armed = rep->armed;