Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/ArduSub/RC_Channel_Sub.h
9649 views
1
#pragma once
2
3
#include <RC_Channel/RC_Channel.h>
4
#include "config.h"
5
6
#if AP_SUB_RC_ENABLED
7
class RC_Channel_Sub : 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
// called when the mode switch changes position:
19
void mode_switch_changed(modeswitch_pos_t new_pos) override;
20
};
21
22
class RC_Channels_Sub : public RC_Channels
23
{
24
public:
25
bool has_valid_input() const override;
26
bool in_rc_failsafe() const override;
27
// returns true if throttle arming checks should be run
28
bool arming_check_throttle() const override;
29
RC_Channel_Sub obj_channels[NUM_RC_CHANNELS];
30
RC_Channel_Sub *channel(const uint8_t chan) override {
31
if (chan >= NUM_RC_CHANNELS) {
32
return nullptr;
33
}
34
return &obj_channels[chan];
35
}
36
37
protected:
38
39
// note that these callbacks are not presently used on Plane:
40
int8_t flight_mode_channel_number() const override;
41
42
};
43
44
#else
45
46
class RC_Channel_Sub : public RC_Channel
47
{
48
49
public:
50
51
protected:
52
53
private:
54
55
};
56
57
class RC_Channels_Sub : public RC_Channels
58
{
59
public:
60
61
RC_Channel_Sub obj_channels[NUM_RC_CHANNELS];
62
RC_Channel_Sub *channel(const uint8_t chan) override {
63
if (chan >= NUM_RC_CHANNELS) {
64
return nullptr;
65
}
66
return &obj_channels[chan];
67
}
68
69
// tell the gimbal code all is good with RC input:
70
bool in_rc_failsafe() const override { return false; };
71
bool arming_check_throttle() const override;
72
73
protected:
74
75
// note that these callbacks are not presently used on Plane:
76
int8_t flight_mode_channel_number() const override;
77
78
};
79
#endif
80
81
82
83