| 447 | } |
| 448 | |
| 449 | bool AP_RCProtocol::new_input() |
| 450 | { |
| 451 | // if we have an extra UART from a SERIALn_PROTOCOL then check it for data |
| 452 | check_added_uart(); |
| 453 | |
| 454 | // run update function on backends |
| 455 | for (uint8_t i = 0; i < ARRAY_SIZE(backend); i++) { |
| 456 | if (backend[i] != nullptr) { |
| 457 | backend[i]->update(); |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | // iterate through backends which don't do either of pulse or uart |
| 462 | // input, and thus won't update_new_input |
| 463 | const rcprotocol_t pollable[] { |
| 464 | #if AP_RCPROTOCOL_DRONECAN_ENABLED |
| 465 | AP_RCProtocol::DRONECAN, |
| 466 | #endif |
| 467 | #if AP_RCPROTOCOL_MAVLINK_RADIO_ENABLED |
| 468 | AP_RCProtocol::MAVLINK_RADIO, |
| 469 | #endif |
| 470 | #if AP_RCPROTOCOL_JOYSTICK_SFML_ENABLED |
| 471 | AP_RCProtocol::JOYSTICK_SFML, |
| 472 | #endif |
| 473 | #if AP_RCPROTOCOL_UDP_ENABLED |
| 474 | AP_RCProtocol::UDP, |
| 475 | #endif |
| 476 | #if AP_RCPROTOCOL_FDM_ENABLED |
| 477 | AP_RCProtocol::FDM, |
| 478 | #endif |
| 479 | #if AP_RCPROTOCOL_RADIO_ENABLED |
| 480 | AP_RCProtocol::RADIO, |
| 481 | #endif |
| 482 | }; |
| 483 | for (const auto protocol : pollable) { |
| 484 | if (!detect_async_protocol(protocol)) { |
| 485 | continue; |
| 486 | } |
| 487 | _new_input = true; |
| 488 | _last_input_ms = AP_HAL::millis(); |
| 489 | break; |
| 490 | } |
| 491 | |
| 492 | bool ret = _new_input; |
| 493 | _new_input = false; |
| 494 | return ret; |
| 495 | } |
| 496 | |
| 497 | uint8_t AP_RCProtocol::num_channels() |
| 498 | { |