Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_CRSF/AP_CRSF_Protocol.cpp
9424 views
1
/*
2
* This file is free software: you can redistribute it and/or modify it
3
* under the terms of the GNU General Public License as published by the
4
* Free Software Foundation, either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* This file is distributed in the hope that it will be useful, but
8
* WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* See the GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License along
13
* with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
16
#include "AP_CRSF_Protocol.h"
17
18
#if AP_CRSF_ENABLED
19
20
// get printable name for frame type (for debug)
21
const char* AP_CRSF_Protocol::get_frame_type(uint8_t byte, uint8_t subtype)
22
{
23
switch (byte) {
24
case CRSF_FRAMETYPE_GPS:
25
return "GPS";
26
case CRSF_FRAMETYPE_BATTERY_SENSOR:
27
return "BATTERY";
28
case CRSF_FRAMETYPE_HEARTBEAT:
29
return "HEARTBEAT";
30
case CRSF_FRAMETYPE_VTX:
31
return "VTX";
32
case CRSF_FRAMETYPE_VTX_TELEM:
33
return "VTX_TELEM";
34
case CRSF_FRAMETYPE_PARAM_DEVICE_PING:
35
return "PING";
36
case CRSF_FRAMETYPE_COMMAND:
37
return "COMMAND";
38
case CRSF_FRAMETYPE_ATTITUDE:
39
return "ATTITUDE";
40
case CRSF_FRAMETYPE_FLIGHT_MODE:
41
return "FLIGHT_MODE";
42
case CRSF_FRAMETYPE_PARAM_DEVICE_INFO:
43
return "DEVICE_INFO";
44
case CRSF_FRAMETYPE_PARAMETER_READ:
45
return "PARAM_READ";
46
case CRSF_FRAMETYPE_PARAMETER_SETTINGS_ENTRY:
47
return "SETTINGS_ENTRY";
48
case CRSF_FRAMETYPE_LINK_STATISTICS:
49
return "LINK_STATS";
50
case CRSF_FRAMETYPE_RC_CHANNELS_PACKED:
51
return "RC";
52
case CRSF_FRAMETYPE_SUBSET_RC_CHANNELS_PACKED:
53
return "RCv3";
54
case CRSF_FRAMETYPE_RC_CHANNELS_PACKED_11BIT:
55
return "RCv3_11BIT";
56
case CRSF_FRAMETYPE_LINK_STATISTICS_RX:
57
return "LINK_STATSv3_RX";
58
case CRSF_FRAMETYPE_LINK_STATISTICS_TX:
59
return "LINK_STATSv3_TX";
60
case CRSF_FRAMETYPE_PARAMETER_WRITE:
61
return "PARAM_WRITE";
62
case CRSF_FRAMETYPE_AP_CUSTOM_TELEM_LEGACY:
63
case CRSF_FRAMETYPE_AP_CUSTOM_TELEM:
64
switch (subtype) {
65
case CRSF_AP_CUSTOM_TELEM_SINGLE_PACKET_PASSTHROUGH:
66
return "AP_CUSTOM_SINGLE";
67
case CRSF_AP_CUSTOM_TELEM_STATUS_TEXT:
68
return "AP_CUSTOM_TEXT";
69
case CRSF_AP_CUSTOM_TELEM_MULTI_PACKET_PASSTHROUGH:
70
return "AP_CUSTOM_MULTI";
71
}
72
return "AP_CUSTOM";
73
}
74
return "UNKNOWN";
75
}
76
77
#endif // AP_CRSF_ENABLED
78
79