LCOV - code coverage report
Current view: top level - home/pbarker/rc/ardupilot/ArduCopter - RC_Channel_Copter.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 6 8 75.0 %
Date: 2026-09-09 11:02:08 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <RC_Channel/RC_Channel.h>
       4             : #include <AP_Motors/AP_Motors.h>
       5             : #include "mode.h"
       6             : 
       7             : class RC_Channel_Copter : public RC_Channel
       8             : {
       9             : 
      10             : public:
      11             : 
      12             : protected:
      13             : 
      14             :     __INITFUNC__ void init_aux_function(AUX_FUNC ch_option, AuxSwitchPos) override;
      15             :     bool do_aux_function(const AuxFuncTrigger &trigger) override;
      16             : 
      17             : private:
      18             : 
      19             :     void do_aux_function_change_mode(const Mode::Number mode,
      20             :                                      const AuxSwitchPos ch_flag);
      21             :     void do_aux_function_change_air_mode(const AuxSwitchPos ch_flag);
      22             :     void do_aux_function_change_force_flying(const AuxSwitchPos ch_flag);
      23             : 
      24             :     // called when the mode switch changes position:
      25             :     void mode_switch_changed(modeswitch_pos_t new_pos) override;
      26             : 
      27             : };
      28             : 
      29             : class RC_Channels_Copter : public RC_Channels
      30             : {
      31             : public:
      32             : 
      33             :     bool has_valid_input() const override;
      34             :     bool in_rc_failsafe() const override;
      35             : 
      36             :     RC_Channel *get_arming_channel(void) const override;
      37             : 
      38             :     RC_Channel_Copter obj_channels[NUM_RC_CHANNELS];
      39   156038518 :     RC_Channel_Copter *channel(const uint8_t chan) override {
      40   156038518 :         if (chan >= ARRAY_SIZE(obj_channels)) {
      41           0 :             return nullptr;
      42             :         }
      43   156038518 :         return &obj_channels[chan];
      44             :     }
      45         862 :     const RC_Channel_Copter *channel(const uint8_t chan) const override {
      46         862 :         if (chan >= ARRAY_SIZE(obj_channels)) {
      47           0 :             return nullptr;
      48             :         }
      49         862 :         return &obj_channels[chan];
      50             :     }
      51             : 
      52             :     // returns true if throttle arming checks should be run
      53             :     bool arming_check_throttle() const override;
      54             : 
      55             :     // support for trimming AHRS using RC stick inputs, enabled via an
      56             :     // aux function
      57             : #if AP_COPTER_AHRS_AUTO_TRIM_ENABLED
      58             :     void do_aux_function_ahrs_auto_trim(const RC_Channel::AuxSwitchPos ch_flag);
      59             :     struct {
      60             :         bool running;
      61             :     } auto_trim;
      62             :     void auto_trim_run();
      63             :     void auto_trim_cancel();
      64             : #endif  // AP_COPTER_AHRS_AUTO_TRIM_ENABLED
      65             :     void save_trim();
      66             : 
      67             : protected:
      68             : 
      69             :     int8_t flight_mode_channel_number() const override;
      70             : 
      71             : };

Generated by: LCOV version 1.14