Browse Source

AP_RCProtocol: add error check for ppm input

mission-4.1.18
Alexander Malishev 7 years ago committed by Andrew Tridgell
parent
commit
9e4ec33277
  1. 5
      libraries/AP_RCProtocol/AP_RCProtocol_PPMSum.cpp

5
libraries/AP_RCProtocol/AP_RCProtocol_PPMSum.cpp

@ -22,6 +22,11 @@ @@ -22,6 +22,11 @@
*/
void AP_RCProtocol_PPMSum::process_pulse(uint32_t width_s0, uint32_t width_s1)
{
if (width_s0 == 0 || width_s1 == 0) {
//invalid data: reset frame
ppm_state._channel_counter = -1;
return;
}
uint32_t width_usec = width_s0 + width_s1;
if (width_usec >= 2700) {
// a long pulse indicates the end of a frame. Reset the

Loading…
Cancel
Save