2 * This file is part of INAV Project.
4 * INAV is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
20 #if defined(USE_OSD) && defined(USE_MSP_DISPLAYPORT)
22 #ifndef DISABLE_MSP_DJI_COMPAT
24 #include "io/displayport_msp_dji_compat.h"
25 #include "io/dji_osd_symbols.h"
26 #include "drivers/osd_symbols.h"
28 uint8_t getDJICharacter(uint8_t ch
, uint8_t page
)
30 uint16_t ech
= ch
| ((page
& 0x3)<< 8) ;
32 if (ech
>= 0x20 && ech
<= 0x5F) { // ASCII range
36 if (ech
>= SYM_AH_DECORATION_MIN
&& ech
<= SYM_AH_DECORATION_MAX
) {
37 return DJI_SYM_AH_DECORATION
;
60 return DJI_SYM_HOMEFLAG
;
63 return DJI_SYM_GPS_DEGREE
;
67 return DJI_SYM_HEADING;
79 return DJI_SYM_HOMEFLAG
;
95 case SYM_AH_DECORATION_UP
:
96 return DJI_SYM_ARROW_SMALL_UP
;
98 case SYM_AH_DECORATION_DOWN
:
99 return DJI_SYM_ARROW_SMALL_DOWN
;
102 return DJI_SYM_ARROW_SMALL_UP
;
104 case SYM_DECORATION
+ 1: // NE pointing arrow
105 return DJI_SYM_ARROW_7
;
107 case SYM_DECORATION
+ 2: // E pointing arrow
108 return DJI_SYM_ARROW_EAST
;
110 case SYM_DECORATION
+ 3: // SE pointing arrow
111 return DJI_SYM_ARROW_3
;
113 case SYM_DECORATION
+ 4: // S pointing arrow
114 return DJI_SYM_ARROW_SOUTH
;
116 case SYM_DECORATION
+ 5: // SW pointing arrow
117 return DJI_SYM_ARROW_15
;
119 case SYM_DECORATION
+ 6: // W pointing arrow
120 return DJI_SYM_ARROW_WEST
;
122 case SYM_DECORATION
+ 7: // NW pointing arrow
123 return DJI_SYM_ARROW_11
;
138 return DJI_SYM_VTX_POWER;
141 return DJI_SYM_AH_NM;
144 return DJI_SYM_MAH_NM_0;
147 return DJI_SYM_MAH_NM_1;
150 return DJI_SYM_MAH_KM_0;
153 return DJI_SYM_MAH_KM_1;
156 return DJI_SYM_MILLIOHM;
159 return DJI_SYM_BATT_FULL
;
162 return DJI_SYM_BATT_5
;
165 return DJI_SYM_BATT_4
;
168 return DJI_SYM_BATT_3
;
171 return DJI_SYM_BATT_2
;
174 return DJI_SYM_BATT_1
;
177 return DJI_SYM_BATT_EMPTY
;
186 return DJI_SYM_WH_KM;
189 return DJI_SYM_WH_MI;
192 return DJI_SYM_WH_NM;
201 return DJI_SYM_KILOWATT;
213 return DJI_SYM_FLY_H
;
217 return DJI_SYM_ALT_KM;
220 return DJI_SYM_ALT_KFT;
223 return DJI_SYM_DIST_M;
226 return DJI_SYM_DIST_KM;
229 return DJI_SYM_DIST_FT;
232 return DJI_SYM_DIST_MI;
235 return DJI_SYM_DIST_NM;
249 case SYM_WIND_HORIZONTAL
:
250 return 'W'; // W for wind
253 case SYM_WIND_VERTICAL:
254 return DJI_SYM_WIND_VERTICAL;
257 return DJI_SYM_3D_KT;
260 return 'A'; // A for airspeed
275 return DJI_SYM_100FTM;
290 return DJI_SYM_MAH_MI_0;
293 return DJI_SYM_MAH_MI_1;
305 return DJI_SYM_BLANK
;
311 return DJI_SYM_FLY_H
;
317 return DJI_SYM_FLY_M
;
320 return DJI_SYM_GLIDESLOPE;
323 return DJI_SYM_WAYPOINT;
326 return DJI_SYM_CLOCK;
328 case SYM_ZERO_HALF_TRAILING_DOT:
329 return DJI_SYM_ZERO_HALF_TRAILING_DOT;
331 case SYM_ZERO_HALF_LEADING_DOT:
332 return DJI_SYM_ZERO_HALF_LEADING_DOT;
351 return DJI_SYM_PITCH
;
354 return DJI_SYM_PITCH
;
361 return DJI_SYM_GFORCE_X;
364 return DJI_SYM_GFORCE_Y;
367 return DJI_SYM_GFORCE_Z;
370 return DJI_SYM_TEMPERATURE
;
373 return DJI_SYM_TEMPERATURE
;
376 return DJI_SYM_TEMPERATURE
;
379 return DJI_SYM_TEMPERATURE
;
381 case SYM_TEMP_SENSOR_FIRST:
382 return DJI_SYM_TEMP_SENSOR_FIRST;
384 case SYM_TEMP_SENSOR_LAST:
385 return DJI_SYM_TEMP_SENSOR_LAST;
387 case TEMP_SENSOR_SYM_COUNT:
388 return DJI_TEMP_SENSOR_SYM_COUNT;
391 return DJI_SYM_HEADING_N
;
394 return DJI_SYM_HEADING_S
;
397 return DJI_SYM_HEADING_E
;
400 return DJI_SYM_HEADING_W
;
402 case SYM_HEADING_DIVIDED_LINE
:
403 return DJI_SYM_HEADING_DIVIDED_LINE
;
405 case SYM_HEADING_LINE
:
406 return DJI_SYM_HEADING_LINE
;
412 return DJI_SYM_PROFILE;
414 case SYM_SWITCH_INDICATOR_LOW
:
415 return DJI_SYM_STICK_OVERLAY_SPRITE_LOW
;
417 case SYM_SWITCH_INDICATOR_MID
:
418 return DJI_SYM_STICK_OVERLAY_SPRITE_MID
;
420 case SYM_SWITCH_INDICATOR_HIGH
:
421 return DJI_SYM_STICK_OVERLAY_SPRITE_HIGH
;
427 return DJI_SYM_GLIDE_DIST;
430 return DJI_SYM_GLIDE_MINS;
433 return DJI_SYM_AH_V_FT_0;
436 return DJI_SYM_AH_V_FT_1;
439 return DJI_SYM_AH_V_M_0;
442 return DJI_SYM_AH_V_M_1;
444 case SYM_FLIGHT_MINS_REMAINING:
445 return DJI_SYM_FLIGHT_MINS_REMAINING;
447 case SYM_FLIGHT_HOURS_REMAINING:
448 return DJI_SYM_FLIGHT_HOURS_REMAINING;
450 case SYM_GROUND_COURSE:
451 return DJI_SYM_GROUND_COURSE;
453 case SYM_CROSS_TRACK_ERROR:
454 return DJI_SYM_CROSS_TRACK_ERROR;
457 return DJI_SYM_LOGO_START;
460 return DJI_SYM_LOGO_WIDTH;
462 case SYM_LOGO_HEIGHT:
463 return DJI_SYM_LOGO_HEIGHT;
466 return DJI_SYM_AH_LEFT
;
469 return DJI_SYM_AH_RIGHT
;
471 case SYM_AH_DECORATION_COUNT:
472 return DJI_SYM_AH_DECORATION_COUNT;
475 case SYM_AH_CH_AIRCRAFT1
:
476 return DJI_SYM_CROSSHAIR_LEFT
;
477 case SYM_AH_CH_CENTER
:
478 case SYM_AH_CH_AIRCRAFT2
:
479 return DJI_SYM_CROSSHAIR_CENTRE
;
480 case SYM_AH_CH_RIGHT
:
481 case SYM_AH_CH_AIRCRAFT3
:
482 return DJI_SYM_CROSSHAIR_RIGHT
;
484 case SYM_AH_CH_AIRCRAFT0
:
485 case SYM_AH_CH_AIRCRAFT4
:
486 return DJI_SYM_BLANK
;
488 case SYM_AH_CH_TYPE3
:
490 case (SYM_AH_CH_TYPE3
+1):
491 return DJI_SYM_SMALL_CROSSHAIR
;
492 case (SYM_AH_CH_TYPE3
+2):
495 case SYM_AH_CH_TYPE4
:
496 return DJI_SYM_HYPHEN
;
497 case (SYM_AH_CH_TYPE4
+1):
498 return DJI_SYM_SMALL_CROSSHAIR
;
499 case (SYM_AH_CH_TYPE4
+2):
500 return DJI_SYM_HYPHEN
;
502 case SYM_AH_CH_TYPE5
:
503 return DJI_SYM_STICK_OVERLAY_HORIZONTAL
;
504 case (SYM_AH_CH_TYPE5
+1):
505 return DJI_SYM_SMALL_CROSSHAIR
;
506 case (SYM_AH_CH_TYPE5
+2):
507 return DJI_SYM_STICK_OVERLAY_HORIZONTAL
;
509 case SYM_AH_CH_TYPE6
:
511 case (SYM_AH_CH_TYPE6
+1):
512 return DJI_SYM_STICK_OVERLAY_SPRITE_MID
;
513 case (SYM_AH_CH_TYPE6
+2):
516 case SYM_AH_CH_TYPE7
:
517 return DJI_SYM_ARROW_SMALL_LEFT
;
518 case (SYM_AH_CH_TYPE7
+1):
519 return DJI_SYM_SMALL_CROSSHAIR
;
520 case (SYM_AH_CH_TYPE7
+2):
521 return DJI_SYM_ARROW_SMALL_RIGHT
;
523 case SYM_AH_CH_TYPE8
:
524 return DJI_SYM_AH_LEFT
;
525 case (SYM_AH_CH_TYPE8
+1):
526 return DJI_SYM_SMALL_CROSSHAIR
;
527 case (SYM_AH_CH_TYPE8
+2):
528 return DJI_SYM_AH_RIGHT
;
531 return DJI_SYM_ARROW_NORTH
;
534 return DJI_SYM_ARROW_8
;
537 return DJI_SYM_ARROW_7
;
540 return DJI_SYM_ARROW_6
;
542 case SYM_ARROW_RIGHT
:
543 return DJI_SYM_ARROW_EAST
;
546 return DJI_SYM_ARROW_4
;
549 return DJI_SYM_ARROW_3
;
552 return DJI_SYM_ARROW_2
;
555 return DJI_SYM_ARROW_SOUTH
;
558 return DJI_SYM_ARROW_16
;
561 return DJI_SYM_ARROW_15
;
564 return DJI_SYM_ARROW_14
;
567 return DJI_SYM_ARROW_WEST
;
570 return DJI_SYM_ARROW_12
;
573 return DJI_SYM_ARROW_11
;
576 return DJI_SYM_ARROW_10
;
579 return DJI_SYM_AH_BAR9_0
;
581 case (SYM_AH_H_START
+1):
582 return DJI_SYM_AH_BAR9_1
;
584 case (SYM_AH_H_START
+2):
585 return DJI_SYM_AH_BAR9_2
;
587 case (SYM_AH_H_START
+3):
588 return DJI_SYM_AH_BAR9_3
;
590 case (SYM_AH_H_START
+4):
591 return DJI_SYM_AH_BAR9_4
;
593 case (SYM_AH_H_START
+5):
594 return DJI_SYM_AH_BAR9_5
;
596 case (SYM_AH_H_START
+6):
597 return DJI_SYM_AH_BAR9_6
;
599 case (SYM_AH_H_START
+7):
600 return DJI_SYM_AH_BAR9_7
;
602 case (SYM_AH_H_START
+8):
603 return DJI_SYM_AH_BAR9_8
;
605 // DJI does not have vertical artificial horizon. replace with middle horizontal one
607 case (SYM_AH_V_START
+1):
608 case (SYM_AH_V_START
+2):
609 case (SYM_AH_V_START
+3):
610 case (SYM_AH_V_START
+4):
611 case (SYM_AH_V_START
+5):
612 return DJI_SYM_AH_BAR9_4
;
614 // DJI for ESP_RADAR Symbols
615 case SYM_HUD_CARDINAL
:
616 return DJI_SYM_ARROW_SOUTH
;
617 case SYM_HUD_CARDINAL
+ 1:
618 return DJI_SYM_ARROW_16
;
619 case SYM_HUD_CARDINAL
+ 2:
620 return DJI_SYM_ARROW_15
;
621 case SYM_HUD_CARDINAL
+ 3:
622 return DJI_SYM_ARROW_WEST
;
623 case SYM_HUD_CARDINAL
+ 4:
624 return DJI_SYM_ARROW_12
;
625 case SYM_HUD_CARDINAL
+ 5:
626 return DJI_SYM_ARROW_11
;
627 case SYM_HUD_CARDINAL
+ 6:
628 return DJI_SYM_ARROW_NORTH
;
629 case SYM_HUD_CARDINAL
+ 7:
630 return DJI_SYM_ARROW_7
;
631 case SYM_HUD_CARDINAL
+ 8:
632 return DJI_SYM_ARROW_6
;
633 case SYM_HUD_CARDINAL
+ 9:
634 return DJI_SYM_ARROW_EAST
;
635 case SYM_HUD_CARDINAL
+ 10:
636 return DJI_SYM_ARROW_3
;
637 case SYM_HUD_CARDINAL
+ 11:
638 return DJI_SYM_ARROW_2
;
640 case SYM_HUD_SIGNAL_0
:
641 return DJI_SYM_AH_BAR9_1
;
642 case SYM_HUD_SIGNAL_1
:
643 return DJI_SYM_AH_BAR9_3
;
644 case SYM_HUD_SIGNAL_2
:
645 return DJI_SYM_AH_BAR9_4
;
646 case SYM_HUD_SIGNAL_3
:
647 return DJI_SYM_AH_BAR9_5
;
648 case SYM_HUD_SIGNAL_4
:
649 return DJI_SYM_AH_BAR9_7
;
651 case SYM_VARIO_UP_2A
:
652 return DJI_SYM_ARROW_SMALL_UP
;
654 case SYM_VARIO_UP_1A
:
655 return DJI_SYM_ARROW_SMALL_UP
;
657 case SYM_VARIO_DOWN_1A
:
658 return DJI_SYM_ARROW_SMALL_DOWN
;
660 case SYM_VARIO_DOWN_2A
:
661 return DJI_SYM_ARROW_SMALL_DOWN
;
664 return DJI_SYM_ALTITUDE
;
666 case SYM_HUD_SIGNAL_0:
667 return DJI_SYM_HUD_SIGNAL_0;
669 case SYM_HUD_SIGNAL_1:
670 return DJI_SYM_HUD_SIGNAL_1;
672 case SYM_HUD_SIGNAL_2:
673 return DJI_SYM_HUD_SIGNAL_2;
675 case SYM_HUD_SIGNAL_3:
676 return DJI_SYM_HUD_SIGNAL_3;
678 case SYM_HUD_SIGNAL_4:
679 return DJI_SYM_HUD_SIGNAL_4;
682 return DJI_SYM_HOME_DIST;
684 case SYM_FLIGHT_DIST_REMAINING:
685 return DJI_SYM_FLIGHT_DIST_REMAINING;
687 case SYM_HUD_ARROWS_L1
:
688 return DJI_SYM_ARROW_SMALL_LEFT
;
690 case SYM_HUD_ARROWS_L2
:
691 return DJI_SYM_ARROW_SMALL_LEFT
;
693 case SYM_HUD_ARROWS_L3
:
694 return DJI_SYM_ARROW_SMALL_LEFT
;
696 case SYM_HUD_ARROWS_R1
:
697 return DJI_SYM_ARROW_SMALL_RIGHT
;
699 case SYM_HUD_ARROWS_R2
:
700 return DJI_SYM_ARROW_SMALL_RIGHT
;
702 case SYM_HUD_ARROWS_R3
:
703 return DJI_SYM_ARROW_SMALL_RIGHT
;
705 case SYM_HUD_ARROWS_U1
:
706 return DJI_SYM_ARROW_SMALL_UP
;
708 case SYM_HUD_ARROWS_U2
:
709 return DJI_SYM_ARROW_SMALL_UP
;
711 case SYM_HUD_ARROWS_U3
:
712 return DJI_SYM_ARROW_SMALL_UP
;
714 case SYM_HUD_ARROWS_D1
:
715 return DJI_SYM_ARROW_SMALL_DOWN
;
717 case SYM_HUD_ARROWS_D2
:
718 return DJI_SYM_ARROW_SMALL_DOWN
;
720 case SYM_HUD_ARROWS_D3
:
721 return DJI_SYM_ARROW_SMALL_DOWN
;
727 return (osdConfig()->highlight_djis_missing_characters
) ? '?' : SYM_BLANK
; // Missing/not mapped character