...
|
...
|
@@ -535,6 +535,116 @@ var softkeysClass = {
|
535
|
535
|
me.device.buttons.ClearTMRREF();
|
536
|
536
|
}
|
537
|
537
|
},
|
|
538
|
+ NRST: {
|
|
539
|
+ _displayNearest: func (type, where) {
|
|
540
|
+ var id = 'PFD NRST';
|
|
541
|
+ me.device.display.updateSoftKeys();
|
|
542
|
+ me.device.windows.del(id);
|
|
543
|
+ var results = [];
|
|
544
|
+ var list = [];
|
|
545
|
+ if (type == 'apt') {
|
|
546
|
+ results = findAirportsWithinRange(100);
|
|
547
|
+ }
|
|
548
|
+ else {
|
|
549
|
+ results = findNavaidsWithinRange(100, type);
|
|
550
|
+ }
|
|
551
|
+ if (where != 'RANGE') {
|
|
552
|
+ var norm_360 = func (a) return math.periodic(0, 360, a);
|
|
553
|
+ if (where == 'FRONT') var side = norm_360(data.hdg);
|
|
554
|
+ elsif (where == 'RIGHT') var side = norm_360(data.hdg + 90);
|
|
555
|
+ elsif (where == 'LEFT') var side = norm_360(data.hdg - 90);
|
|
556
|
+ elsif (where == 'REAR') var side = norm_360(data.hdg + 180);
|
|
557
|
+ foreach (var n; results) {
|
|
558
|
+ var (course, dist) = courseAndDistance(n);
|
|
559
|
+ var angle = 180 - abs(abs(course - side) - 180);
|
|
560
|
+ if (angle < 50) {
|
|
561
|
+ append(list, [n, course, dist]);
|
|
562
|
+ if (size(list) == 5)
|
|
563
|
+ break;
|
|
564
|
+ }
|
|
565
|
+ }
|
|
566
|
+ }
|
|
567
|
+ else {
|
|
568
|
+ foreach (var n; results) {
|
|
569
|
+ var (course, dist) = courseAndDistance(n);
|
|
570
|
+ append(list, [n, course, dist]);
|
|
571
|
+ if (size(list) == 5)
|
|
572
|
+ break;
|
|
573
|
+ }
|
|
574
|
+ }
|
|
575
|
+ var obj_infos = [
|
|
576
|
+ { text: sprintf('NEAREST %s (%s)', string.uc(type), where), type: 'title' },
|
|
577
|
+ { type: 'separator' }
|
|
578
|
+ ];
|
|
579
|
+ var firstEntry = 1;
|
|
580
|
+ foreach (var n; list) {
|
|
581
|
+ append(obj_infos, {
|
|
582
|
+ text: sprintf('%s (%s)', n[0].id, n[0].name),
|
|
583
|
+ type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line',
|
|
584
|
+ dto: n[0],
|
|
585
|
+ });
|
|
586
|
+ append(obj_infos, {
|
|
587
|
+ text: sprintf('%s %03i° %3iNM', utf8.chstr(9658), n[1], n[2]),
|
|
588
|
+ type: 'normal|end-of-line'
|
|
589
|
+ });
|
|
590
|
+ firstEntry = 0;
|
|
591
|
+ }
|
|
592
|
+ me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
|
|
593
|
+ me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
|
|
594
|
+ me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
|
|
595
|
+ me.device.buttons.CLR = func {
|
|
596
|
+ me.device.windows.del(id);
|
|
597
|
+ me.device.knobs.FmsOuter = func;
|
|
598
|
+ me.device.knobs.FmsInner = func;
|
|
599
|
+ foreach (var b; ['ENT', 'CLR', 'MENU'])
|
|
600
|
+ me.device.buttons[b] = func;
|
|
601
|
+ }
|
|
602
|
+ me.device.windows.draw( id, {autogeom: 1}, obj_infos );
|
|
603
|
+ },
|
|
604
|
+############################################################################################################
|
|
605
|
+# THIS CODE SHOULD REPLACE THE LINES BELOW (in new()), but it makes all call with the same args (apt, RIGHT)
|
|
606
|
+############################################################################################################
|
|
607
|
+# if (m.device.role == 'PFD')
|
|
608
|
+# foreach (var dir; keyMap.PFD.NRST.texts) {
|
|
609
|
+# m.bindings.PFD.NRST[dir] = {};
|
|
610
|
+# foreach (var type; keyMap.PFD.NRST.OMNI.texts) {
|
|
611
|
+# m.bindings.PFD.NRST[dir][type] = func {
|
|
612
|
+# call(m.bindings.PFD.NRST._displayNearest, [string.lc(type), dir], m)
|
|
613
|
+# };
|
|
614
|
+# }
|
|
615
|
+# }
|
|
616
|
+############################################################################################################
|
|
617
|
+ OMNI: {
|
|
618
|
+ APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'OMNI'], me) },
|
|
619
|
+ VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'OMNI'], me) },
|
|
620
|
+ NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'OMNI'], me) },
|
|
621
|
+ FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'OMNI'], me) },
|
|
622
|
+ },
|
|
623
|
+ FRONT: {
|
|
624
|
+ APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'FRONT'], me) },
|
|
625
|
+ VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'FRONT'], me) },
|
|
626
|
+ NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'FRONT'], me) },
|
|
627
|
+ FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'FRONT'], me) },
|
|
628
|
+ },
|
|
629
|
+ RIGHT: {
|
|
630
|
+ APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'RIGHT'], me) },
|
|
631
|
+ VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'RIGHT'], me) },
|
|
632
|
+ NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'RIGHT'], me) },
|
|
633
|
+ FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'RIGHT'], me) },
|
|
634
|
+ },
|
|
635
|
+ REAR: {
|
|
636
|
+ APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'REAR'], me) },
|
|
637
|
+ VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'REAR'], me) },
|
|
638
|
+ NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'REAR'], me) },
|
|
639
|
+ FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'REAR'], me) },
|
|
640
|
+ },
|
|
641
|
+ LEFT: {
|
|
642
|
+ APT: func { call(me.bindings.PFD.NRST._displayNearest, ['apt', 'LEFT'], me) },
|
|
643
|
+ VOR: func { call(me.bindings.PFD.NRST._displayNearest, ['vor', 'LEFT'], me) },
|
|
644
|
+ NDB: func { call(me.bindings.PFD.NRST._displayNearest, ['ndb', 'LEFT'], me) },
|
|
645
|
+ FIX: func { call(me.bindings.PFD.NRST._displayNearest, ['fix', 'LEFT'], me) },
|
|
646
|
+ },
|
|
647
|
+ },
|
538
|
648
|
},
|
539
|
649
|
MFD : {
|
540
|
650
|
ENGINE: {
|
...
|
...
|
@@ -962,6 +1072,17 @@ var keyMap = {
|
962
|
1072
|
texts : ['0', '1', '2', '3', '4', '5', '6', '7', 'IDENT', 'BKSP'],
|
963
|
1073
|
},
|
964
|
1074
|
},
|
|
1075
|
+ NRST : {
|
|
1076
|
+ first : 4,
|
|
1077
|
+ texts : ['OMNI', 'REAR', 'FRONT', 'LEFT', 'RIGHT', 'RANGE'],
|
|
1078
|
+ RANGE : {
|
|
1079
|
+ first : 7,
|
|
1080
|
+ texts : ['MIN', 'MAX' ],
|
|
1081
|
+ MIN : { first: 3, texts : ['0NM', '10NM', '30NM', '50NM'] },
|
|
1082
|
+ MAX : { fisrt: 3, texts : ['200NM', '150NM', '100NM', '50NM'] },
|
|
1083
|
+ },
|
|
1084
|
+ OMNI : { texts: ['NDB', 'FIX', 'VOR', 'APT'] }, # that will be mirrored later
|
|
1085
|
+ },
|
965
|
1086
|
},
|
966
|
1087
|
#}}}2
|
967
|
1088
|
# MFD {{{2
|
...
|
...
|
@@ -996,4 +1117,7 @@ if (props.globals.getNode('/sim/checklists') == nil) {
|
996
|
1117
|
keyMap.MFD.texts[11] = '';
|
997
|
1118
|
delete(keyMap.MFD, 'CHKLIST');
|
998
|
1119
|
}
|
|
1120
|
+foreach (var d; ['FRONT', 'REAR', 'LEFT', 'RIGHT']) {
|
|
1121
|
+ keyMap.PFD.NRST[d] = keyMap.PFD.NRST.OMNI;
|
|
1122
|
+}
|
999
|
1123
|
#}}}1
|