diydrones/ardupilot — pull request #950 by matthewlloyd (2014-04-05 15:50:40+00:00)
Title: Copter: Prevent zero-valued RC inputs on PX4

* Check the channel_count in the ORB rc_input structure,
since it might be zero, and ignore the RC input if it is.
This requires radio.pde to call the newly introduced
RCInput::num_channels method.

* Add additional checks in radio.pde:read_radio so that zero-valued
RC inputs are ignored and eventually cause radio failsafe.

Tested that RC input still works as normal, at least with SBUS
(which is all I have right now).

These fixes will hopefully prevent a repeat of this crash:

https://groups.google.com/forum/#!topic/drones-discuss/ZBlTgNsK638

The code has changed slightly since the firmware version I was
running when I had that crash (valid_channels in RCInput has
been replaced by the new_input and num_channels methods) but
the underlying issue is still there, which is that if an
ORB rc_input is received with a channel_count of zero,
zero PWM values end up being used as ArduCopter's RC inputs.