2 * This file is part of INAV.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
24 * @author Konstantin Sharlaimov (ksharlaimov@inavflight.com)
30 #include "msp/msp_serial.h"
32 #include "config/parameter_group.h"
34 #if defined(USE_DJI_HD_OSD)
36 #define DJI_API_VERSION_MAJOR 1
37 #define DJI_API_VERSION_MINOR 42
39 #define DJI_MSP_API_VERSION 1 // INAV: Implemented | DSI: ??? |
40 #define DJI_MSP_FC_VARIANT 2 // INAV: Implemented | DSI: ??? |
41 #define DJI_MSP_FC_VERSION 3 // INAV: Implemented | DSI: ??? |
42 #define DJI_MSP_NAME 10 // INAV: Implemented | DSI: Implemented | For OSD 'Craft Name'
43 #define DJI_MSP_OSD_CONFIG 84 // INAV: Implemented | DSI: Implemented | OSD item count + positions
44 #define DJI_MSP_FILTER_CONFIG 92 // INAV: Not implemented | DSI: Implemented |
45 #define DJI_MSP_PID_ADVANCED 94 // INAV: Not implemented | DSI: Implemented |
46 #define DJI_MSP_STATUS 101 // INAV: Implemented | DSI: Implemented | For OSD ‘armingTime’, Flight controller arming status
47 #define DJI_MSP_RC 105 // INAV: Implemented | DSI: Implemented |
48 #define DJI_MSP_RAW_GPS 106 // INAV: Implemented | DSI: Implemented | For OSD ‘GPS Sats’ + coordinates
49 #define DJI_MSP_COMP_GPS 107 // INAV: Implemented | DSI: Not implemented | GPS direction to home & distance to home
50 #define DJI_MSP_ATTITUDE 108 // INAV: Implemented | DSI: Implemented | For OSD ‘Angle: roll & pitch’
51 #define DJI_MSP_ALTITUDE 109 // INAV: Implemented | DSI: Implemented | For OSD ‘Numerical Vario’
52 #define DJI_MSP_ANALOG 110 // INAV: Implemented | DSI: Implemented | For OSD ‘RSSI Value’, For OSD ‘Battery voltage’ etc
53 #define DJI_MSP_RC_TUNING 111 // INAV: Not implemented | DSI: Implemented |
54 #define DJI_MSP_PID 112 // INAV: Implemented | DSI: Implemented | For OSD ‘PID roll, yaw, pitch'
55 #define DJI_MSP_BATTERY_STATE 130 // INAV: Implemented | DSI: Implemented | For OSD ‘Battery current mAh drawn’ etc
56 #define DJI_MSP_ESC_SENSOR_DATA 134 // INAV: Implemented | DSI: Implemented | For OSD ‘ESC temperature’
57 #define DJI_MSP_STATUS_EX 150 // INAV: Implemented | DSI: Implemented | For OSD ‘Fly mode', For OSD ‘Disarmed’
58 #define DJI_MSP_RTC 247 // INAV: Implemented | DSI: Implemented | For OSD ‘RTC date time’
60 #define DJI_MSP_SET_FILTER_CONFIG 93
61 #define DJI_MSP_SET_PID_ADVANCED 95
62 #define DJI_MSP_SET_PID 202
63 #define DJI_MSP_SET_RC_TUNING 204
65 #define DJI_CRAFT_NAME_LENGTH 24
66 #define DJI_ALTERNATING_DURATION_LONG (djiOsdConfig()->craftNameAlternatingDuration * 100)
67 #define DJI_ALTERNATING_DURATION_SHORT 1000
69 enum djiOsdTempSource_e
{
71 DJI_OSD_TEMP_CORE
= 1,
75 enum djiRssiSource_e
{
80 enum djiOsdProtoWorkarounds_e
{
81 DJI_OSD_USE_NON_STANDARD_MSP_ESC_SENSOR_DATA
= 1 << 0,
84 typedef struct djiOsdConfig_s
{
85 uint8_t use_name_for_messages
;
86 uint8_t esc_temperature_source
;
87 uint8_t proto_workarounds
;
88 uint8_t messageSpeedSource
;
90 uint8_t useAdjustments
;
91 uint8_t craftNameAlternatingDuration
;
94 PG_DECLARE(djiOsdConfig_t
, djiOsdConfig
);
96 void djiOsdSerialInit(void);
97 void djiOsdSerialProcess(void);