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 #ifdef 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
41 return BF_SYM_LINK_QUALITY
;
56 return BF_SYM_HOMEFLAG
;
59 return BF_SYM_GPS_DEGREE
;
63 return BF_SYM_HEADING;
75 return BF_SYM_HOMEFLAG
;
90 case SYM_AH_DECORATION_UP:
91 return BF_SYM_AH_DECORATION_UP;
93 case SYM_AH_DECORATION_DOWN:
94 return BF_SYM_AH_DECORATION_DOWN;
97 return BF_SYM_DIRECTION;
112 return BF_SYM_VTX_POWER;
118 return BF_SYM_MAH_NM_0;
121 return BF_SYM_MAH_NM_1;
124 return BF_SYM_MAH_KM_0;
127 return BF_SYM_MAH_KM_1;
130 return BF_SYM_MILLIOHM;
133 return BF_SYM_BATT_FULL
;
136 return BF_SYM_BATT_5
;
139 return BF_SYM_BATT_4
;
142 return BF_SYM_BATT_3
;
145 return BF_SYM_BATT_2
;
148 return BF_SYM_BATT_1
;
151 return BF_SYM_BATT_EMPTY
;
175 return BF_SYM_KILOWATT;
181 return BF_SYM_TRIP_DIST;
190 return BF_SYM_ALT_KM;
193 return BF_SYM_ALT_FT;
196 return BF_SYM_ALT_KFT;
199 return BF_SYM_DIST_M;
202 return BF_SYM_DIST_KM;
205 return BF_SYM_DIST_FT;
208 return BF_SYM_DIST_MI;
211 return BF_SYM_DIST_NM;
225 case SYM_WIND_HORIZONTAL:
226 return BF_SYM_WIND_HORIZONTAL;
228 case SYM_WIND_VERTICAL:
229 return BF_SYM_WIND_VERTICAL;
252 return BF_SYM_100FTM;
267 return BF_SYM_MAH_MI_0;
270 return BF_SYM_MAH_MI_1;
277 return BF_SYM_TEMP_F;
280 return BF_SYM_TEMP_C;
298 return BF_SYM_GLIDESLOPE;
301 return BF_SYM_WAYPOINT;
306 case SYM_ZERO_HALF_TRAILING_DOT:
307 return BF_SYM_ZERO_HALF_TRAILING_DOT;
309 case SYM_ZERO_HALF_LEADING_DOT:
310 return BF_SYM_ZERO_HALF_LEADING_DOT;
313 return BF_SYM_AUTO_THR0;
316 return BF_SYM_AUTO_THR1;
319 return BF_SYM_ROLL_LEFT;
322 return BF_SYM_ROLL_LEVEL;
325 return BF_SYM_ROLL_RIGHT;
328 return BF_SYM_PITCH_UP;
331 return BF_SYM_PITCH_DOWN;
334 return BF_SYM_GFORCE;
337 return BF_SYM_GFORCE_X;
340 return BF_SYM_GFORCE_Y;
343 return BF_SYM_GFORCE_Z;
346 return BF_SYM_BARO_TEMP;
349 return BF_SYM_IMU_TEMP;
354 case SYM_TEMP_SENSOR_FIRST:
355 return BF_SYM_TEMP_SENSOR_FIRST;
358 return BF_SYM_ESC_TEMP;
360 case SYM_TEMP_SENSOR_LAST:
361 return BF_SYM_TEMP_SENSOR_LAST;
363 case TEMP_SENSOR_SYM_COUNT:
364 return BF_TEMP_SENSOR_SYM_COUNT;
367 return BF_SYM_HEADING_N
;
370 return BF_SYM_HEADING_S
;
373 return BF_SYM_HEADING_E
;
376 return BF_SYM_HEADING_W
;
378 case SYM_HEADING_DIVIDED_LINE
:
379 return BF_SYM_HEADING_DIVIDED_LINE
;
381 case SYM_HEADING_LINE
:
382 return BF_SYM_HEADING_LINE
;
388 return BF_SYM_PROFILE;
390 case SYM_SWITCH_INDICATOR_LOW:
391 return BF_SYM_SWITCH_INDICATOR_LOW;
393 case SYM_SWITCH_INDICATOR_MID:
394 return BF_SYM_SWITCH_INDICATOR_MID;
396 case SYM_SWITCH_INDICATOR_HIGH:
397 return BF_SYM_SWITCH_INDICATOR_HIGH;
403 return BF_SYM_GLIDE_DIST;
406 return BF_SYM_GLIDE_MINS;
409 return BF_SYM_AH_V_FT_0;
412 return BF_SYM_AH_V_FT_1;
415 return BF_SYM_AH_V_M_0;
418 return BF_SYM_AH_V_M_1;
420 case SYM_FLIGHT_MINS_REMAINING:
421 return BF_SYM_FLIGHT_MINS_REMAINING;
423 case SYM_FLIGHT_HOURS_REMAINING:
424 return BF_SYM_FLIGHT_HOURS_REMAINING;
426 case SYM_GROUND_COURSE:
427 return BF_SYM_GROUND_COURSE;
429 case SYM_CROSS_TRACK_ERROR:
430 return BF_SYM_CROSS_TRACK_ERROR;
433 return BF_SYM_LOGO_START;
436 return BF_SYM_LOGO_WIDTH;
438 case SYM_LOGO_HEIGHT:
439 return BF_SYM_LOGO_HEIGHT;
442 return BF_SYM_AH_LEFT
;
445 return BF_SYM_AH_RIGHT
;
447 case SYM_AH_DECORATION_MIN:
448 return BF_SYM_AH_DECORATION_MIN;
450 case SYM_AH_DECORATION
:
451 return BF_SYM_AH_DECORATION
;
453 case SYM_AH_DECORATION_MAX:
454 return BF_SYM_AH_DECORATION_MAX;
456 case SYM_AH_DECORATION_COUNT:
457 return BF_SYM_AH_DECORATION_COUNT;
460 case SYM_AH_CH_TYPE3
:
461 case SYM_AH_CH_TYPE4
:
462 case SYM_AH_CH_TYPE5
:
463 case SYM_AH_CH_TYPE6
:
464 case SYM_AH_CH_TYPE7
:
465 case SYM_AH_CH_TYPE8
:
466 case SYM_AH_CH_AIRCRAFT1
:
467 return BF_SYM_AH_CENTER_LINE
;
469 case SYM_AH_CH_RIGHT
:
470 case (SYM_AH_CH_TYPE3
+2):
471 case (SYM_AH_CH_TYPE4
+2):
472 case (SYM_AH_CH_TYPE5
+2):
473 case (SYM_AH_CH_TYPE6
+2):
474 case (SYM_AH_CH_TYPE7
+2):
475 case (SYM_AH_CH_TYPE8
+2):
476 case SYM_AH_CH_AIRCRAFT3
:
477 return BF_SYM_AH_CENTER_LINE_RIGHT
;
479 case SYM_AH_CH_AIRCRAFT0
:
480 case SYM_AH_CH_AIRCRAFT4
:
484 return BF_SYM_ARROW_NORTH
;
487 return BF_SYM_ARROW_8
;
490 return BF_SYM_ARROW_7
;
493 return BF_SYM_ARROW_6
;
495 case SYM_ARROW_RIGHT
:
496 return BF_SYM_ARROW_EAST
;
499 return BF_SYM_ARROW_4
;
502 return BF_SYM_ARROW_3
;
505 return BF_SYM_ARROW_2
;
508 return BF_SYM_ARROW_SOUTH
;
511 return BF_SYM_ARROW_16
;
514 return BF_SYM_ARROW_15
;
517 return BF_SYM_ARROW_14
;
520 return BF_SYM_ARROW_WEST
;
523 return BF_SYM_ARROW_12
;
526 return BF_SYM_ARROW_11
;
529 return BF_SYM_ARROW_10
;
532 return BF_SYM_AH_BAR9_0
;
534 case (SYM_AH_H_START
+1):
535 return BF_SYM_AH_BAR9_1
;
537 case (SYM_AH_H_START
+2):
538 return BF_SYM_AH_BAR9_2
;
540 case (SYM_AH_H_START
+3):
541 return BF_SYM_AH_BAR9_3
;
543 case (SYM_AH_H_START
+4):
544 return BF_SYM_AH_BAR9_4
;
546 case (SYM_AH_H_START
+5):
547 return BF_SYM_AH_BAR9_5
;
549 case (SYM_AH_H_START
+6):
550 return BF_SYM_AH_BAR9_6
;
552 case (SYM_AH_H_START
+7):
553 return BF_SYM_AH_BAR9_7
;
555 case (SYM_AH_H_START
+8):
556 return BF_SYM_AH_BAR9_8
;
558 // BF does not have vertical artificial horizon. replace with middle horizontal one
560 case (SYM_AH_V_START
+1):
561 case (SYM_AH_V_START
+2):
562 case (SYM_AH_V_START
+3):
563 case (SYM_AH_V_START
+4):
564 case (SYM_AH_V_START
+5):
565 return BF_SYM_AH_BAR9_4
;
567 case SYM_VARIO_UP_2A:
568 return BF_SYM_VARIO_UP_2A;
570 case SYM_VARIO_UP_1A:
571 return BF_SYM_VARIO_UP_1A;
573 case SYM_VARIO_DOWN_1A:
574 return BF_SYM_VARIO_DOWN_1A;
576 case SYM_VARIO_DOWN_2A:
577 return BF_SYM_VARIO_DOWN_2A;
580 return BF_SYM_ALTITUDE
;
582 case SYM_HUD_SIGNAL_0:
583 return BF_SYM_HUD_SIGNAL_0;
585 case SYM_HUD_SIGNAL_1:
586 return BF_SYM_HUD_SIGNAL_1;
588 case SYM_HUD_SIGNAL_2:
589 return BF_SYM_HUD_SIGNAL_2;
591 case SYM_HUD_SIGNAL_3:
592 return BF_SYM_HUD_SIGNAL_3;
594 case SYM_HUD_SIGNAL_4:
595 return BF_SYM_HUD_SIGNAL_4;
598 return BF_SYM_HOME_DIST;
601 case SYM_AH_CH_CENTER
:
602 case (SYM_AH_CH_TYPE3
+1):
603 case (SYM_AH_CH_TYPE4
+1):
604 case (SYM_AH_CH_TYPE5
+1):
605 case (SYM_AH_CH_TYPE6
+1):
606 case (SYM_AH_CH_TYPE7
+1):
607 case (SYM_AH_CH_TYPE8
+1):
608 case SYM_AH_CH_AIRCRAFT2
:
609 return BF_SYM_AH_CENTER
;
611 case SYM_FLIGHT_DIST_REMAINING:
612 return BF_SYM_FLIGHT_DIST_REMAINING;
614 case SYM_AH_CH_TYPE3:
615 return BF_SYM_AH_CH_TYPE3;
617 case SYM_AH_CH_TYPE4:
618 return BF_SYM_AH_CH_TYPE4;
620 case SYM_AH_CH_TYPE5:
621 return BF_SYM_AH_CH_TYPE5;
623 case SYM_AH_CH_TYPE6:
624 return BF_SYM_AH_CH_TYPE6;
626 case SYM_AH_CH_TYPE7:
627 return BF_SYM_AH_CH_TYPE7;
629 case SYM_AH_CH_TYPE8:
630 return BF_SYM_AH_CH_TYPE8;
632 case SYM_AH_CH_AIRCRAFT0:
633 return BF_SYM_AH_CH_AIRCRAFT0;
635 case SYM_AH_CH_AIRCRAFT1:
636 return BF_SYM_AH_CH_AIRCRAFT1;
638 case SYM_AH_CH_AIRCRAFT2:
639 return BF_SYM_AH_CH_AIRCRAFT2;
641 case SYM_AH_CH_AIRCRAFT3:
642 return BF_SYM_AH_CH_AIRCRAFT3;
644 case SYM_AH_CH_AIRCRAFT4:
645 return BF_SYM_AH_CH_AIRCRAFT4;
647 case SYM_HUD_ARROWS_L1:
648 return BF_SYM_HUD_ARROWS_L1;
650 case SYM_HUD_ARROWS_L2:
651 return BF_SYM_HUD_ARROWS_L2;
653 case SYM_HUD_ARROWS_L3:
654 return BF_SYM_HUD_ARROWS_L3;
656 case SYM_HUD_ARROWS_R1:
657 return BF_SYM_HUD_ARROWS_R1;
659 case SYM_HUD_ARROWS_R2:
660 return BF_SYM_HUD_ARROWS_R2;
662 case SYM_HUD_ARROWS_R3:
663 return BF_SYM_HUD_ARROWS_R3;
665 case SYM_HUD_ARROWS_U1:
666 return BF_SYM_HUD_ARROWS_U1;
668 case SYM_HUD_ARROWS_U2:
669 return BF_SYM_HUD_ARROWS_U2;
671 case SYM_HUD_ARROWS_U3:
672 return BF_SYM_HUD_ARROWS_U3;
674 case SYM_HUD_ARROWS_D1:
675 return BF_SYM_HUD_ARROWS_D1;
677 case SYM_HUD_ARROWS_D2:
678 return BF_SYM_HUD_ARROWS_D2;
680 case SYM_HUD_ARROWS_D3:
681 return BF_SYM_HUD_ARROWS_D3;
687 return '?'; // Missing/not mapped character