SITL: Added comment to clarify IMU acceleration value
[ardupilot.git] / libraries / AP_OSD / AP_OSD_MSP_DisplayPort.h
blob475d57e79d1450a3552faf567d0f3252bbfd5a40
1 #include <AP_OSD/AP_OSD_Backend.h>
2 #include <AP_MSP/AP_MSP.h>
4 #if HAL_WITH_MSP_DISPLAYPORT
6 class AP_OSD_MSP_DisplayPort : public AP_OSD_Backend
8 using AP_OSD_Backend::AP_OSD_Backend;
9 public:
10 static AP_OSD_Backend *probe(AP_OSD &osd);
12 //initialize display port and underlying hardware
13 bool init() override;
15 //draw given text to framebuffer
16 void write(uint8_t x, uint8_t y, const char* text) override;
18 //flush framebuffer to screen
19 void flush() override;
21 //clear framebuffer
22 void clear() override;
24 // copy the backend specific symbol set to the OSD lookup table
25 void init_symbol_set(uint8_t *lookup_table, const uint8_t size) override;
27 // called by the OSD thread once
28 // used to initialize the uart in the correct thread
29 void osd_thread_run_once() override;
31 // return a correction factor used to display angles correctly
32 float get_aspect_ratio_correction() const override;
34 bool is_compatible_with_backend_type(AP_OSD::osd_types type) const override {
35 switch(type) {
36 case AP_OSD::osd_types::OSD_MSP:
37 case AP_OSD::osd_types::OSD_MSP_DISPLAYPORT:
38 return false;
39 case AP_OSD::osd_types::OSD_NONE:
40 case AP_OSD::osd_types::OSD_TXONLY:
41 case AP_OSD::osd_types::OSD_MAX7456:
42 case AP_OSD::osd_types::OSD_SITL:
43 return true;
45 return false;
48 AP_OSD::osd_types get_backend_type() const override {
49 return AP_OSD::osd_types::OSD_MSP_DISPLAYPORT;
51 protected:
52 uint8_t format_string_for_osd(char* dst, uint8_t size, bool decimal_packed, const char *fmt, va_list ap) override;
54 private:
55 void setup_defaults(void);
57 AP_MSP_Telem_Backend* _displayport;
59 // MSP DisplayPort symbols
60 static const uint8_t SYM_M = 0x0C;
61 static const uint8_t SYM_KM = 0x7D;
62 static const uint8_t SYM_FT = 0x0F;
63 static const uint8_t SYM_MI = 0x7E;
64 static const uint8_t SYM_ALT_M = 0x0C;
65 static const uint8_t SYM_ALT_FT = 0x0F;
66 static const uint8_t SYM_BATT_FULL = 0x90;
67 static const uint8_t SYM_RSSI = 0x01;
69 static const uint8_t SYM_VOLT = 0x06;
70 static const uint8_t SYM_AMP = 0x9A;
71 static const uint8_t SYM_MAH = 0x07;
72 static const uint8_t SYM_MS = 0x9F;
73 static const uint8_t SYM_FS = 0x99;
74 static const uint8_t SYM_KMH = 0x9E;
75 static const uint8_t SYM_MPH = 0x9D;
76 static const uint8_t SYM_DEGR = 0x08;
77 static const uint8_t SYM_PCNT = 0x25;
78 static const uint8_t SYM_RPM = 0x12;
79 static const uint8_t SYM_ASPD = 0x41;
80 static const uint8_t SYM_GSPD = 0x47;
81 static const uint8_t SYM_WSPD = 0x57;
82 static const uint8_t SYM_VSPD = 0x5E;
83 static const uint8_t SYM_WPNO = 0x23;
84 static const uint8_t SYM_WPDIR = 0xE6;
85 static const uint8_t SYM_WPDST = 0xE7;
86 static const uint8_t SYM_FTMIN = 0xE8;
87 static const uint8_t SYM_FTSEC = 0x99;
89 static const uint8_t SYM_SAT_L = 0x1E;
90 static const uint8_t SYM_SAT_R = 0x1F;
91 static const uint8_t SYM_HDOP_L = 0x48;
92 static const uint8_t SYM_HDOP_R = 0x44;
94 static const uint8_t SYM_HOME = 0x11;
95 static const uint8_t SYM_WIND = 0x57;
97 static const uint8_t SYM_ARROW_START = 0x60;
98 static const uint8_t SYM_ARROW_COUNT = 16;
99 static const uint8_t SYM_AH_H_START = 0x80;
100 static const uint8_t SYM_AH_H_COUNT = 9;
102 static const uint8_t SYM_AH_V_START = 0x82;
103 static const uint8_t SYM_AH_V_COUNT = 6;
105 static const uint8_t SYM_AH_CENTER_LINE_LEFT = 0x84;
106 static const uint8_t SYM_AH_CENTER_LINE_RIGHT = 0x84;
107 static const uint8_t SYM_AH_CENTER = 0x2B;
109 static const uint8_t SYM_HEADING_N = 0x18;
110 static const uint8_t SYM_HEADING_S = 0x19;
111 static const uint8_t SYM_HEADING_E = 0x1A;
112 static const uint8_t SYM_HEADING_W = 0x1B;
113 static const uint8_t SYM_HEADING_DIVIDED_LINE = 0x1C;
114 static const uint8_t SYM_HEADING_LINE = 0x1D;
116 static const uint8_t SYM_UP_UP = 0x68;
117 static const uint8_t SYM_UP = 0x68;
118 static const uint8_t SYM_DOWN = 0x60;
119 static const uint8_t SYM_DOWN_DOWN = 0x60;
121 static const uint8_t SYM_DEGREES_C = 0x0E;
122 static const uint8_t SYM_DEGREES_F = 0x0D;
123 static const uint8_t SYM_GPS_LAT = 0x89;
124 static const uint8_t SYM_GPS_LONG = 0x98;
125 static const uint8_t SYM_ARMED = 0x00;
126 static const uint8_t SYM_DISARMED = 0x2A;
127 static const uint8_t SYM_ROLL0 = 0x2D;
128 static const uint8_t SYM_ROLLR = 0x64;
129 static const uint8_t SYM_ROLLL = 0x6C;
130 static const uint8_t SYM_PTCH0 = 0x7C;
131 static const uint8_t SYM_PTCHUP = 0x68;
132 static const uint8_t SYM_PTCHDWN = 0x60;
133 static const uint8_t SYM_XERR = 0x21;
134 static const uint8_t SYM_KN = 0xF0;
135 static const uint8_t SYM_NM = 0xF1;
136 static const uint8_t SYM_DIST = 0x04;
137 static const uint8_t SYM_FLY = 0x9C;
138 static const uint8_t SYM_EFF = 0xF2;
139 static const uint8_t SYM_AH = 0xF3;
140 static const uint8_t SYM_MW = 0xF4;
141 static const uint8_t SYM_CLK = 0x08;
142 static const uint8_t SYM_KILO = 0x4B;
143 static const uint8_t SYM_TERALT = 0x7F;
144 static const uint8_t SYM_FENCE_ENABLED = 0xF5;
145 static const uint8_t SYM_FENCE_DISABLED = 0xF6;
146 static const uint8_t SYM_RNGFD = 0x7F;
147 static const uint8_t SYM_LQ = 0xF8;
149 static const uint8_t SYM_SIDEBAR_L_ARROW = 0x02;
150 static const uint8_t SYM_SIDEBAR_R_ARROW = 0x03;
151 static const uint8_t SYM_SIDEBAR_A = 0x13;
152 static const uint8_t SYM_SIDEBAR_B = SYM_SIDEBAR_A;
153 static const uint8_t SYM_SIDEBAR_C = SYM_SIDEBAR_A;
154 static const uint8_t SYM_SIDEBAR_D = SYM_SIDEBAR_A;
155 static const uint8_t SYM_SIDEBAR_E = SYM_SIDEBAR_A;
156 static const uint8_t SYM_SIDEBAR_F = SYM_SIDEBAR_A;
157 static const uint8_t SYM_SIDEBAR_G = SYM_SIDEBAR_A;
158 static const uint8_t SYM_SIDEBAR_H = SYM_SIDEBAR_A;
159 static const uint8_t SYM_SIDEBAR_I = SYM_SIDEBAR_A;
160 static const uint8_t SYM_SIDEBAR_J = SYM_SIDEBAR_A;
163 static constexpr uint8_t symbols[AP_OSD_NUM_SYMBOLS] {
164 SYM_M,
165 SYM_KM,
166 SYM_FT,
167 SYM_MI,
168 SYM_ALT_M,
169 SYM_ALT_FT,
170 SYM_BATT_FULL,
171 SYM_RSSI,
172 SYM_VOLT,
173 SYM_AMP,
174 SYM_MAH,
175 SYM_MS,
176 SYM_FS,
177 SYM_KMH,
178 SYM_MPH,
179 SYM_DEGR,
180 SYM_PCNT,
181 SYM_RPM,
182 SYM_ASPD,
183 SYM_GSPD,
184 SYM_WSPD,
185 SYM_VSPD,
186 SYM_WPNO,
187 SYM_WPDIR,
188 SYM_WPDST,
189 SYM_FTMIN,
190 SYM_FTSEC,
191 SYM_SAT_L,
192 SYM_SAT_R,
193 SYM_HDOP_L,
194 SYM_HDOP_R,
195 SYM_HOME,
196 SYM_WIND,
197 SYM_ARROW_START,
198 SYM_ARROW_COUNT,
199 SYM_AH_H_START,
200 SYM_AH_H_COUNT,
201 SYM_AH_V_START,
202 SYM_AH_V_COUNT,
203 SYM_AH_CENTER_LINE_LEFT,
204 SYM_AH_CENTER_LINE_RIGHT,
205 SYM_AH_CENTER,
206 SYM_HEADING_N,
207 SYM_HEADING_S,
208 SYM_HEADING_E,
209 SYM_HEADING_W,
210 SYM_HEADING_DIVIDED_LINE,
211 SYM_HEADING_LINE,
212 SYM_UP_UP,
213 SYM_UP,
214 SYM_DOWN,
215 SYM_DOWN_DOWN,
216 SYM_DEGREES_C,
217 SYM_DEGREES_F,
218 SYM_GPS_LAT,
219 SYM_GPS_LONG,
220 SYM_ARMED,
221 SYM_DISARMED,
222 SYM_ROLL0,
223 SYM_ROLLR,
224 SYM_ROLLL,
225 SYM_PTCH0,
226 SYM_PTCHUP,
227 SYM_PTCHDWN,
228 SYM_XERR,
229 SYM_KN,
230 SYM_NM,
231 SYM_DIST,
232 SYM_FLY,
233 SYM_EFF,
234 SYM_AH,
235 SYM_MW,
236 SYM_CLK,
237 SYM_KILO,
238 SYM_TERALT,
239 SYM_FENCE_ENABLED,
240 SYM_FENCE_DISABLED,
241 SYM_RNGFD,
242 SYM_LQ,
243 SYM_SIDEBAR_L_ARROW,
244 SYM_SIDEBAR_R_ARROW,
245 SYM_SIDEBAR_A,
246 SYM_SIDEBAR_B,
247 SYM_SIDEBAR_C,
248 SYM_SIDEBAR_D,
249 SYM_SIDEBAR_E,
250 SYM_SIDEBAR_F,
251 SYM_SIDEBAR_G,
252 SYM_SIDEBAR_H,
253 SYM_SIDEBAR_I,
254 SYM_SIDEBAR_J,
257 bool _blink_on;
259 #endif