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_BF_COMPAT
24 #include "io/displayport_msp_bf_compat.h"
25 #include "io/bf_osd_symbols.h"
26 #include "drivers/osd_symbols.h"
28 uint8_t getBfCharacter(uint8_t ch
, uint8_t page
)
30 uint16_t ech
= ch
| (page
<< 8);
32 if (ech
>= 0x20 && ech
<= 0x5F) { // ASCII range
36 if (ech
>= SYM_AH_DECORATION_MIN
&& ech
<= SYM_AH_DECORATION_MAX
) {
37 return BF_SYM_AH_DECORATION
;
45 return BF_SYM_LINK_QUALITY
;
60 return BF_SYM_HOMEFLAG
;
63 return BF_SYM_GPS_DEGREE
;
67 return BF_SYM_HEADING;
79 return BF_SYM_HOMEFLAG
;
94 case SYM_AH_DECORATION_UP:
95 return BF_SYM_AH_DECORATION_UP;
97 case SYM_AH_DECORATION_DOWN:
98 return BF_SYM_AH_DECORATION_DOWN;
101 return BF_SYM_ARROW_NORTH
;
103 case SYM_DIRECTION
+ 1: // NE pointing arrow
104 return BF_SYM_ARROW_7
;
106 case SYM_DIRECTION
+ 2: // E pointing arrow
107 return BF_SYM_ARROW_EAST
;
109 case SYM_DIRECTION
+ 3: // SE pointing arrow
110 return BF_SYM_ARROW_3
;
112 case SYM_DIRECTION
+ 4: // S pointing arrow
113 return BF_SYM_ARROW_SOUTH
;
115 case SYM_DIRECTION
+ 5: // SW pointing arrow
116 return BF_SYM_ARROW_15
;
118 case SYM_DIRECTION
+ 6: // W pointing arrow
119 return BF_SYM_ARROW_WEST
;
121 case SYM_DIRECTION
+ 7: // NW pointing arrow
122 return BF_SYM_ARROW_11
;
137 return BF_SYM_VTX_POWER;
143 return BF_SYM_MAH_NM_0;
146 return BF_SYM_MAH_NM_1;
149 return BF_SYM_MAH_KM_0;
152 return BF_SYM_MAH_KM_1;
155 return BF_SYM_MILLIOHM;
158 return BF_SYM_BATT_FULL
;
161 return BF_SYM_BATT_5
;
164 return BF_SYM_BATT_4
;
167 return BF_SYM_BATT_3
;
170 return BF_SYM_BATT_2
;
173 return BF_SYM_BATT_1
;
176 return BF_SYM_BATT_EMPTY
;
200 return BF_SYM_KILOWATT;
212 return BF_SYM_TOTAL_DISTANCE
;
215 return BF_SYM_ALT_KM;
218 return BF_SYM_ALT_KFT;
221 return BF_SYM_DIST_M;
224 return BF_SYM_DIST_KM;
227 return BF_SYM_DIST_FT;
230 return BF_SYM_DIST_MI;
233 return BF_SYM_DIST_NM;
247 case SYM_WIND_HORIZONTAL
:
248 return 'W'; // W for wind
251 case SYM_WIND_VERTICAL:
252 return BF_SYM_WIND_VERTICAL;
258 return 'A'; // A for airspeed
273 return BF_SYM_100FTM;
288 return BF_SYM_MAH_MI_0;
291 return BF_SYM_MAH_MI_1;
318 return BF_SYM_GLIDESLOPE;
321 return BF_SYM_WAYPOINT;
326 case SYM_ZERO_HALF_TRAILING_DOT:
327 return BF_SYM_ZERO_HALF_TRAILING_DOT;
329 case SYM_ZERO_HALF_LEADING_DOT:
330 return BF_SYM_ZERO_HALF_LEADING_DOT;
333 return BF_SYM_AUTO_THR0;
336 return BF_SYM_AUTO_THR1;
339 return BF_SYM_ROLL_LEFT;
342 return BF_SYM_ROLL_LEVEL;
345 return BF_SYM_ROLL_RIGHT;
348 return BF_SYM_PITCH_UP;
351 return BF_SYM_PITCH_DOWN;
359 return BF_SYM_GFORCE_X;
362 return BF_SYM_GFORCE_Y;
365 return BF_SYM_GFORCE_Z;
368 return BF_SYM_BARO_TEMP;
371 return BF_SYM_IMU_TEMP;
376 case SYM_TEMP_SENSOR_FIRST:
377 return BF_SYM_TEMP_SENSOR_FIRST;
380 return BF_SYM_ESC_TEMP;
382 case SYM_TEMP_SENSOR_LAST:
383 return BF_SYM_TEMP_SENSOR_LAST;
385 case TEMP_SENSOR_SYM_COUNT:
386 return BF_TEMP_SENSOR_SYM_COUNT;
389 return BF_SYM_HEADING_N
;
392 return BF_SYM_HEADING_S
;
395 return BF_SYM_HEADING_E
;
398 return BF_SYM_HEADING_W
;
400 case SYM_HEADING_DIVIDED_LINE
:
401 return BF_SYM_HEADING_DIVIDED_LINE
;
403 case SYM_HEADING_LINE
:
404 return BF_SYM_HEADING_LINE
;
410 return BF_SYM_PROFILE;
412 case SYM_SWITCH_INDICATOR_LOW:
413 return BF_SYM_SWITCH_INDICATOR_LOW;
415 case SYM_SWITCH_INDICATOR_MID:
416 return BF_SYM_SWITCH_INDICATOR_MID;
418 case SYM_SWITCH_INDICATOR_HIGH:
419 return BF_SYM_SWITCH_INDICATOR_HIGH;
425 return BF_SYM_GLIDE_DIST;
428 return BF_SYM_GLIDE_MINS;
431 return BF_SYM_AH_V_FT_0;
434 return BF_SYM_AH_V_FT_1;
437 return BF_SYM_AH_V_M_0;
440 return BF_SYM_AH_V_M_1;
442 case SYM_FLIGHT_MINS_REMAINING:
443 return BF_SYM_FLIGHT_MINS_REMAINING;
445 case SYM_FLIGHT_HOURS_REMAINING:
446 return BF_SYM_FLIGHT_HOURS_REMAINING;
448 case SYM_GROUND_COURSE:
449 return BF_SYM_GROUND_COURSE;
451 case SYM_CROSS_TRACK_ERROR:
452 return BF_SYM_CROSS_TRACK_ERROR;
455 return BF_SYM_LOGO_START;
458 return BF_SYM_LOGO_WIDTH;
460 case SYM_LOGO_HEIGHT:
461 return BF_SYM_LOGO_HEIGHT;
464 return BF_SYM_AH_LEFT
;
467 return BF_SYM_AH_RIGHT
;
470 case SYM_AH_DECORATION_COUNT:
471 return BF_SYM_AH_DECORATION_COUNT;
474 case SYM_AH_CH_TYPE3
:
475 case SYM_AH_CH_TYPE4
:
476 case SYM_AH_CH_TYPE5
:
477 case SYM_AH_CH_TYPE6
:
478 case SYM_AH_CH_TYPE7
:
479 case SYM_AH_CH_TYPE8
:
480 case SYM_AH_CH_AIRCRAFT1
:
481 return BF_SYM_AH_CENTER_LINE
;
483 case SYM_AH_CH_RIGHT
:
484 case (SYM_AH_CH_TYPE3
+2):
485 case (SYM_AH_CH_TYPE4
+2):
486 case (SYM_AH_CH_TYPE5
+2):
487 case (SYM_AH_CH_TYPE6
+2):
488 case (SYM_AH_CH_TYPE7
+2):
489 case (SYM_AH_CH_TYPE8
+2):
490 case SYM_AH_CH_AIRCRAFT3
:
491 return BF_SYM_AH_CENTER_LINE_RIGHT
;
493 case SYM_AH_CH_AIRCRAFT0
:
494 case SYM_AH_CH_AIRCRAFT4
:
498 return BF_SYM_ARROW_NORTH
;
501 return BF_SYM_ARROW_8
;
504 return BF_SYM_ARROW_7
;
507 return BF_SYM_ARROW_6
;
509 case SYM_ARROW_RIGHT
:
510 return BF_SYM_ARROW_EAST
;
513 return BF_SYM_ARROW_4
;
516 return BF_SYM_ARROW_3
;
519 return BF_SYM_ARROW_2
;
522 return BF_SYM_ARROW_SOUTH
;
525 return BF_SYM_ARROW_16
;
528 return BF_SYM_ARROW_15
;
531 return BF_SYM_ARROW_14
;
534 return BF_SYM_ARROW_WEST
;
537 return BF_SYM_ARROW_12
;
540 return BF_SYM_ARROW_11
;
543 return BF_SYM_ARROW_10
;
546 return BF_SYM_AH_BAR9_0
;
548 case (SYM_AH_H_START
+1):
549 return BF_SYM_AH_BAR9_1
;
551 case (SYM_AH_H_START
+2):
552 return BF_SYM_AH_BAR9_2
;
554 case (SYM_AH_H_START
+3):
555 return BF_SYM_AH_BAR9_3
;
557 case (SYM_AH_H_START
+4):
558 return BF_SYM_AH_BAR9_4
;
560 case (SYM_AH_H_START
+5):
561 return BF_SYM_AH_BAR9_5
;
563 case (SYM_AH_H_START
+6):
564 return BF_SYM_AH_BAR9_6
;
566 case (SYM_AH_H_START
+7):
567 return BF_SYM_AH_BAR9_7
;
569 case (SYM_AH_H_START
+8):
570 return BF_SYM_AH_BAR9_8
;
572 // BF does not have vertical artificial horizon. replace with middle horizontal one
574 case (SYM_AH_V_START
+1):
575 case (SYM_AH_V_START
+2):
576 case (SYM_AH_V_START
+3):
577 case (SYM_AH_V_START
+4):
578 case (SYM_AH_V_START
+5):
579 return BF_SYM_AH_BAR9_4
;
581 // BF for ESP_RADAR Symbols
582 case SYM_HUD_CARDINAL
:
583 return BF_SYM_ARROW_SOUTH
;
584 case SYM_HUD_CARDINAL
+ 1:
585 return BF_SYM_ARROW_16
;
586 case SYM_HUD_CARDINAL
+ 2:
587 return BF_SYM_ARROW_15
;
588 case SYM_HUD_CARDINAL
+ 3:
589 return BF_SYM_ARROW_WEST
;
590 case SYM_HUD_CARDINAL
+ 4:
591 return BF_SYM_ARROW_12
;
592 case SYM_HUD_CARDINAL
+ 5:
593 return BF_SYM_ARROW_11
;
594 case SYM_HUD_CARDINAL
+ 6:
595 return BF_SYM_ARROW_NORTH
;
596 case SYM_HUD_CARDINAL
+ 7:
597 return BF_SYM_ARROW_7
;
598 case SYM_HUD_CARDINAL
+ 8:
599 return BF_SYM_ARROW_6
;
600 case SYM_HUD_CARDINAL
+ 9:
601 return BF_SYM_ARROW_EAST
;
602 case SYM_HUD_CARDINAL
+ 10:
603 return BF_SYM_ARROW_3
;
604 case SYM_HUD_CARDINAL
+ 11:
605 return BF_SYM_ARROW_2
;
607 case SYM_HUD_ARROWS_R3
:
608 return BF_SYM_AH_RIGHT
;
609 case SYM_HUD_ARROWS_L3
:
610 return BF_SYM_AH_LEFT
;
612 case SYM_HUD_SIGNAL_0
:
613 return BF_SYM_AH_BAR9_1
;
614 case SYM_HUD_SIGNAL_1
:
615 return BF_SYM_AH_BAR9_3
;
616 case SYM_HUD_SIGNAL_2
:
617 return BF_SYM_AH_BAR9_4
;
618 case SYM_HUD_SIGNAL_3
:
619 return BF_SYM_AH_BAR9_5
;
620 case SYM_HUD_SIGNAL_4
:
621 return BF_SYM_AH_BAR9_7
;
623 case SYM_VARIO_UP_2A:
624 return BF_SYM_VARIO_UP_2A;
626 case SYM_VARIO_UP_1A:
627 return BF_SYM_VARIO_UP_1A;
629 case SYM_VARIO_DOWN_1A:
630 return BF_SYM_VARIO_DOWN_1A;
632 case SYM_VARIO_DOWN_2A:
633 return BF_SYM_VARIO_DOWN_2A;
636 return BF_SYM_ALTITUDE
;
638 case SYM_HUD_SIGNAL_0:
639 return BF_SYM_HUD_SIGNAL_0;
641 case SYM_HUD_SIGNAL_1:
642 return BF_SYM_HUD_SIGNAL_1;
644 case SYM_HUD_SIGNAL_2:
645 return BF_SYM_HUD_SIGNAL_2;
647 case SYM_HUD_SIGNAL_3:
648 return BF_SYM_HUD_SIGNAL_3;
650 case SYM_HUD_SIGNAL_4:
651 return BF_SYM_HUD_SIGNAL_4;
654 return BF_SYM_HOME_DIST;
657 case SYM_AH_CH_CENTER
:
658 case (SYM_AH_CH_TYPE3
+1):
659 case (SYM_AH_CH_TYPE4
+1):
660 case (SYM_AH_CH_TYPE5
+1):
661 case (SYM_AH_CH_TYPE6
+1):
662 case (SYM_AH_CH_TYPE7
+1):
663 case (SYM_AH_CH_TYPE8
+1):
664 case SYM_AH_CH_AIRCRAFT2
:
665 return BF_SYM_AH_CENTER
;
667 case SYM_FLIGHT_DIST_REMAINING:
668 return BF_SYM_FLIGHT_DIST_REMAINING;
670 case SYM_AH_CH_TYPE3:
671 return BF_SYM_AH_CH_TYPE3;
673 case SYM_AH_CH_TYPE4:
674 return BF_SYM_AH_CH_TYPE4;
676 case SYM_AH_CH_TYPE5:
677 return BF_SYM_AH_CH_TYPE5;
679 case SYM_AH_CH_TYPE6:
680 return BF_SYM_AH_CH_TYPE6;
682 case SYM_AH_CH_TYPE7:
683 return BF_SYM_AH_CH_TYPE7;
685 case SYM_AH_CH_TYPE8:
686 return BF_SYM_AH_CH_TYPE8;
688 case SYM_AH_CH_AIRCRAFT0:
689 return BF_SYM_AH_CH_AIRCRAFT0;
691 case SYM_AH_CH_AIRCRAFT1:
692 return BF_SYM_AH_CH_AIRCRAFT1;
694 case SYM_AH_CH_AIRCRAFT2:
695 return BF_SYM_AH_CH_AIRCRAFT2;
697 case SYM_AH_CH_AIRCRAFT3:
698 return BF_SYM_AH_CH_AIRCRAFT3;
700 case SYM_AH_CH_AIRCRAFT4:
701 return BF_SYM_AH_CH_AIRCRAFT4;
703 case SYM_HUD_ARROWS_L1:
704 return BF_SYM_HUD_ARROWS_L1;
706 case SYM_HUD_ARROWS_L2:
707 return BF_SYM_HUD_ARROWS_L2;
709 case SYM_HUD_ARROWS_L3:
710 return BF_SYM_HUD_ARROWS_L3;
712 case SYM_HUD_ARROWS_R1:
713 return BF_SYM_HUD_ARROWS_R1;
715 case SYM_HUD_ARROWS_R2:
716 return BF_SYM_HUD_ARROWS_R2;
718 case SYM_HUD_ARROWS_R3:
719 return BF_SYM_HUD_ARROWS_R3;
721 case SYM_HUD_ARROWS_U1:
722 return BF_SYM_HUD_ARROWS_U1;
724 case SYM_HUD_ARROWS_U2:
725 return BF_SYM_HUD_ARROWS_U2;
727 case SYM_HUD_ARROWS_U3:
728 return BF_SYM_HUD_ARROWS_U3;
730 case SYM_HUD_ARROWS_D1:
731 return BF_SYM_HUD_ARROWS_D1;
733 case SYM_HUD_ARROWS_D2:
734 return BF_SYM_HUD_ARROWS_D2;
736 case SYM_HUD_ARROWS_D3:
737 return BF_SYM_HUD_ARROWS_D3;
743 return '?'; // Missing/not mapped character