1
0
Fork 0

Merge branch '3D' into cpdlc

This commit is contained in:
legoboyvdlp R 2021-03-11 11:45:07 +00:00
commit 3a37a2dc42
32 changed files with 1317 additions and 169 deletions

View file

@ -1692,7 +1692,7 @@
<comm n="2">
<frequencies>
<selected-mhz type="double">0</selected-mhz>
<selected-mhz type="double">121.5</selected-mhz>
<standby-mhz type="double">123.2</standby-mhz>
</frequencies>
<serviceable type="bool">true</serviceable>

View file

@ -1447,14 +1447,32 @@
<button>0</button>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</and>
</condition>
<command>property-toggle</command>
<property>controls/switches/terr_on_nd_l</property>
</binding>
<binding>
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<equals>
<property>instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit</property>
<value>0</value>
</equals>
</and>
</condition>
<command>property-toggle</command>
<property>instrumentation/efis/inputs/terr</property>
</binding>
</action>
</animation>
@ -1488,14 +1506,32 @@
<button>0</button>
<binding>
<condition>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<and>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
</and>
</condition>
<command>property-toggle</command>
<property>controls/switches/terr_on_nd_r</property>
</binding>
<binding>
<condition>
<and>
<greater-than-equals>
<property>systems/electrical/bus/dc-ess</property>
<value>25</value>
</greater-than-equals>
<equals>
<property>instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit</property>
<value>0</value>
</equals>
</and>
</condition>
<command>property-toggle</command>
<property>instrumentation/efis[1]/inputs/terr</property>
</binding>
</action>
</animation>

View file

@ -180,6 +180,17 @@ var canvas_nd_base = {
},
};
var ND_change_timer_fn = func {
#me.change_phase += 1;
#if (me.change_phase>2) { # phase 3 - only for older ND?
#if (me.change_phase>1) { # phase 2 hide
me.change_timer.stop();
me.change_phase = 0;
#} else {
me.map.setVisible(1); # phase 2
#}
};
var canvas_ND_1 = {
new: func(canvas_group) {
var m = {parents: [canvas_ND_1, canvas_nd_base]};
@ -190,6 +201,8 @@ var canvas_ND_1 = {
me.NDCpt.attitude_heading_setting = -1;
me.NDCpt.adirs_property = props.globals.getNode("/instrumentation/efis[0]/nd/ir-1",1);
me.NDCpt.newMFD(canvas_group);
me.NDCpt.change_phase = 0;
me.NDCpt.change_timer = maketimer(0.6,me.NDCpt,ND_change_timer_fn);
me.NDCpt.update();
return m;
@ -213,6 +226,8 @@ var canvas_ND_2 = {
me.NDFo.attitude_heading_setting = 1;
me.NDFo.adirs_property = props.globals.getNode("/instrumentation/efis[1]/nd/ir-2",1);
me.NDFo.newMFD(canvas_group);
me.NDFo.change_phase = 0;
me.NDFo.change_timer = maketimer(0.4,me.NDFo,ND_change_timer_fn);
me.NDFo.update();
return m;
@ -357,7 +372,7 @@ setlistener("sim/signals/fdm-initialized", func {
}, 1, 0);
setlistener("/instrumentation/tcas/inputs/mode", func() {
if (getprop("/instrumentation/efis[1]/nd/canvas-display-mode") != "PLAN") {
if (getprop("/instrumentation/efis[0]/nd/canvas-display-mode") != "PLAN") {
canvas_nd.ND_1.NDCpt.trafficGroup.setVisible(pts.Instrumentation.TCAS.Inputs.mode.getValue() >= 2 ? 1 : 0);
}
if (getprop("/instrumentation/efis[1]/nd/canvas-display-mode") != "PLAN") {
@ -373,6 +388,21 @@ setlistener("sim/signals/fdm-initialized", func {
canvas_nd.ND_2.NDFo.trafficGroup.setVisible(getprop("/instrumentation/efis[1]/nd/canvas-display-mode") == "PLAN" ? 0 : 1);
}, 1, 0);
setlistener("/instrumentation/efis[0]/nd/display-mode", func {
startChangePhase(canvas_nd.ND_1.NDCpt,"MODE CHANGE");
},0,0);
setlistener("/instrumentation/efis[0]/inputs/range-nm", func {
startChangePhase(canvas_nd.ND_1.NDCpt,"RANGE CHANGE");
},0,0);
setlistener("/instrumentation/efis[1]/nd/display-mode", func {
startChangePhase(canvas_nd.ND_2.NDFo,"MODE CHANGE");
},0,0);
setlistener("/instrumentation/efis[1]/inputs/range-nm", func {
startChangePhase(canvas_nd.ND_2.NDFo,"RANGE CHANGE");
},0,0);
nd_update.start();
if (getprop("systems/acconfig/options/nd-rate") > 1) {
rateApply();
@ -417,14 +447,22 @@ for (i = 0; i < 2; i = i + 1 ) {
});
}
setlistener("/instrumentation/efis[0]/nd/terrain-on-nd", func{
var terr_on_hd = getprop("instrumentation/efis[0]/nd/terrain-on-nd");
var alpha = 1;
if (terr_on_hd) {
alpha = 0.5;
}
nd_display.main.setColorBackground(0,0,0,alpha);
});
var startChangePhase = func(nd,txt) {
nd.change_timer.stop();
nd.map.setVisible(0);
nd.symbols.nd_msg_change.setText(txt);
nd.change_phase = 1;
nd.change_timer.start();
}
#setlistener("/instrumentation/efis[0]/nd/terrain-on-nd", func{
# var terr_on_hd = getprop("instrumentation/efis[0]/nd/terrain-on-nd");
# var alpha = 1;
# if (terr_on_hd) {
# alpha = 0.5;
# }
# nd_display.main.setColorBackground(0,0,0,alpha);
#});
setlistener("/flight-management/control/capture-leg", func(n) {
var capture_leg = n.getValue();

View file

@ -13,6 +13,110 @@ var assert_m = canvas.assert_m;
var wxr_live_tree = "/instrumentation/wxr";
var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1);
var easeArrow = {
new: func(elem) {
var m = {parents: [easeArrow]};
m.req_rot_rad = 0;
m.req_rot_deg = 0;
m.last_rot_deg = nil;
m.last_rot_rad = 0;
m.element = elem;
m.time = 0;
m.duration = 0;
m.startval = 0;
m.diffval = 0;
return m;
},
setVisible: func(v) {
if (v == 1 and me.last_rot_deg == nil) me.reset();
me.element.setVisible(v);
},
hide: func {
me.element.hide();
},
reset: func {
me.last_rot_deg = 360 - getprop("orientation/heading-deg");
me.last_rot_rad = me.last_rot_deg * D2R;
me.duration = 0;
print("VOR reset");
},
setRotation: func(rad) {
var deg = 0;
var gap = 0;
gap = math.abs(rad - me.req_rot_rad);
if (gap>0.001) {
if (me.duration>0) gap = math.abs(rad - me.last_rot_rad);
if (gap>=180*D2R) gap = 360*D2R - gap;
deg = rad * 57.29578;
me.req_rot_rad = rad;
me.req_rot_deg = deg;
me.duration = 0;
if (gap>0.2) {
if (me.last_rot_deg == nil) me.reset();
me.startval = me.last_rot_deg;
me.diffval = deg - me.last_rot_deg;
if (me.diffval<0) me.diffval += 360;
me.time = 0;
me.duration = math.round(me.diffval * 0.21); # rad 36/3
}
if (me.duration < 2) {
me.last_rot_rad = rad;
me.last_rot_deg = deg;
me.element.setRotation(rad);
me.duration = 0;
}
}
if (me.duration > 0) {
var tx = me.time / me.duration;
#thanks to https://easings.net/#easeOutCubic
deg = (1 - math.pow(1 - tx, 3)) * me.diffval + me.startval;
deg = math.mod(deg,360);
#print("DEG: " ~ deg);
me.last_rot_deg = deg;
me.last_rot_rad = deg * D2R;
me.element.setRotation(me.last_rot_rad);
me.time += 1;
if (tx>=1) me.duration = 0;
}
}
};
var symbolDistNM = {
new: func(name, nd) {
var m = {parents: [symbolDistNM] };
m.group = nd.getElementById(name);
m.expn = nd.getElementById(name ~ "1");
m.mant = nd.getElementById(name ~ "2");
return m;
},
hide: func {
me.group.hide();
},
show: func {
me.group.show();
},
setText: func(txt) {
var parts = ( txt != "" ) ? split( "." , txt ) : nil;
if ( parts != nil and size(parts) == 2 ) {
me.expn.setText(parts[0]);
me.mant.setText("." ~ parts[1]);
} else {
me.expn.setText(txt);
me.mant.setText("");
}
},
setColor: func(r,g,b) {
me.expn.setColor(r,g,b);
me.mant.setColor(r,g,b);
},
setFloat: func(val) {
var parts = split( "." , sprintf("%03.1f",val) );
me.expn.setText(parts[0]);
me.mant.setText("." ~ parts[1]);
}
};
canvas.NavDisplay.set_switch = func(s, v) {
var switch = me.efis_switches[s];
if(switch == nil) return nil;
@ -68,19 +172,28 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
### this is the "old" method that"s less flexible, we want to use the style hash instead (see above)
# because things are much better configurable that way
# now look up all required SVG elements and initialize member fields using the same name to have a convenient handle
foreach(var element; ["dmeLDist","dmeRDist","dmeL","dmeR","vorL","vorR","vorLId","vorRId",
"status.wxr","status.wpt","status.sta","status.arpt"])
foreach(var element; ["dmeL","dmeR","vorL","vorR","vorLId","vorRId",
"status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead"])
me.symbols[element] = me.nd.getElementById(element);
foreach(var element; ["dmeLDist","dmeRDist"])
me.symbols[element] = symbolDistNM.new( element, me.nd );
me.symbols.dmeLDist.setColor(0.195,0.96,0.097);
me.symbols.dmeRDist.setColor(0.195,0.96,0.097);
# load elements from vector image, and create instance variables using identical names, and call updateCenter() on each
# anything that needs updatecenter called, should be added to the vector here
#
foreach(var element; ["staArrowL2","staArrowR2","staFromL2","staToL2","staFromR2","staToR2",
foreach(var element; ["staFromL2","staToL2","staFromR2","staToR2",
"hdgTrk","trkInd","hdgBug","HdgBugCRT","TrkBugLCD","HdgBugLCD","curHdgPtr",
"HdgBugCRT2","TrkBugLCD2","HdgBugLCD2","hdgBug2","selHdgLine","selHdgLine2","curHdgPtr2",
"staArrowL","staArrowR","staToL","staFromL","staToR","staFromR"] )
"staToL","staFromL","staToR","staFromR"] )
me.symbols[element] = me.nd.getElementById(element).updateCenter();
foreach(var element; ["staArrowL2","staArrowR2","staArrowL","staArrowR"] )
me.symbols[element] = easeArrow.new( me.nd.getElementById(element).updateCenter() );
me.map = me.nd.createChild("map","map")
.set("clip", "rect(124, 1024, 1024, 0)")
.set("screen-range", 700)
@ -499,7 +612,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg");
if(!me.get_switch("toggle_centered"))
{
if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting)))
if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 or (me.change_phase == 1) and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting)))
me.symbols.trkInd.hide();
else
me.symbols.trkInd.show();

View file

@ -0,0 +1,51 @@
# See: http://wiki.flightgear.org/MapStructure
# Class things:
var name = 'TERRAIN';
var parents = [canvas.SymbolLayer.Controller];
var __self__ = caller(0)[0];
canvas.SymbolLayer.Controller.add(name, __self__);
canvas.SymbolLayer.add(name, {
parents: [MultiSymbolLayer],
type: name, # Symbol type
df_controller: __self__, # controller to use by default -- this one
df_options: { # default configuration options
viewport_radius: 670
}
});
var new = func(layer) {
var m = {
parents: [__self__],
layer: layer,
map: layer.map,
listeners: [],
};
layer.searcher._equals = func(l,r) l.equals(r);
m.addVisibilityListener();
return m;
};
var del = func() {
#print(name~".lcontroller.del()");
foreach (var l; me.listeners)
removelistener(l);
};
var searchCmd = func {
if(me.map.getRange() == nil) return [];
var pos = geo.aircraft_position();
lat = pos.lat();
lon = pos.lon();
var result = geo.Coord.new();
result.set_latlon(lat, lon);
result.rangeNm = me.map.getRange();
result.fetchRad = 184; # is this number accurate?
result.equals = func(r){
me.fetchRad == r.fetchRad and me.lat == r.lat and me.lon == r.lon
};
return [result];
};

View file

@ -0,0 +1,429 @@
# See: http://wiki.flightgear.org/MapStructure
# Class things:
## Airbus Terrain on ND by InuYaksa*2021
## EGPWS device - Applicable to: MSN 0112
## Ident.: DSC-31-45-00009586.0012001 / 22 MAY 12
## Ident.: DSC-31-45-00009586.0009001 / 08 AUG 13
## inspired from work on 787-family - thanks a lots
## and a great help from legoboyvdlp
var name = 'TERRAIN';
var parents = [DotSym];
var __self__ = caller(0)[0];
DotSym.makeinstance( name, __self__ );
var element_type = "group";
var terrain_minalt = props.globals.initNode("/instrumentation/efis[0]/nd/terrain-on-nd/min-altitude", 0,"INT");
var terrain_maxalt = props.globals.initNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-altitude", -9999,"INT");
var terrain_maxcol = props.globals.initNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-color", 0,"INT"); # 0= grn, 1= yel, 2= red
var terrain_alert = props.globals.getNode("/instrumentation/mk-viii/outputs/alert-mode");
var tile_list = [
nil,"tile_gl.png","tile_gh.png","tile_al.png","tile_ah.png","tile_rh.png", # 0-5 low alt - imho real ND displays as amber-ish color than yellow one
"tile_gl.png","tile_gh.png","tile_gh.png","tile_gs.png", # 6-9 hi alt
"tile_ml.png","tile_cl.png", # 10 magenta - 11 cyan-ish/blue (water)
"tile_as.png","tile_rs.png" # 12-13 alert - solid colors
];
var is_terrain = 0;
var get_elevation = func (lat, lon) {
var info = geodinfo(lat, lon);
var elevation = 0;
if (info != nil) {
elevation = int(info[0] * 3.2808399);
me.is_terrain = (info[1] == nil) ? 1 : info[1].solid;
}
else { elevation = nil; }
return elevation;
}
var updateTerrain = func {
if (me.reference == nil) return;
if(me.fetching) return;
me.fetching = 1;
if (me.request_clear == 1) {
me.request_clear = 0;
me.clear();
me.group.setVisible(1);
}
var RAD2DEG = 57.2957795;
var DEG2RAD = 0.016774532925;
var pos_lat = me.reference.lat();
var pos_lon = me.reference.lon();
var heading = me.refheading;
var altitudeft = me.refaltitudeft;
var lowaltft = me.reflowaltft;
var basealtft = me.basealtitudeft;
var alert_level = me.terrain_alert.getValue();
var side = (math.mod(me.radar_beacon,2)==0) ? "L" : "R";
var a = int(me.radar_beacon/2);
var col = a + 0.5;
if (side == "R") {
col = -col;
}
var trn = me.terrlayer[side ~ a];
var len = size(trn);
var range = me.range;
var tiles = me.tile_list;
#var proj_lon = pos_lon + ((col * (range/30) * math.sin(DEG2RAD * (heading - 90))) / 40);
#var proj_lat = pos_lat + ((col * (range/30) * math.cos(DEG2RAD * (heading - 90))) / 40);
# if me.tileradiusw == 20
var range_20f = range / 18.75;
var heading_sin = math.sin(DEG2RAD * heading);
var heading_cos = math.cos(DEG2RAD * heading);
var proj_lon = pos_lon + ((col * range_20f * math.sin(DEG2RAD * (heading - 90))) / 60);
var proj_lat = pos_lat + ((col * range_20f * math.cos(DEG2RAD * (heading - 90))) / 60);
var elevft = [];
me.radar_cleared = 0;
for (var row = 0; row < len; row += 1) {
if (trn[row] == nil) {
append(elevft,-1);
continue;
}
var point_lon = proj_lon + ((row * range_20f / 60) * heading_sin);
var point_lat = proj_lat + ((row * range_20f / 60) * heading_cos);
var elev = me.get_elevation(point_lat, point_lon);
var grad = 0; #black
if (elev != nil) {
if (elev>me.max_altitude) me.max_altitude = elev;
if (me.is_terrain) {
if (elev<me.min_altitude) me.min_altitude = elev;
if (elev < basealtft) grad = 0; # < 400 near runway use blank
else {
var diff = elev - altitudeft;
if (diff>=0) {
grad = int(diff/1000) + 3;
if (grad>5) grad = 5;
if (alert_level > 0 and a < 6 and grad > 3) {
if (alert_level == 1 and (grad == 3 or grad == 4)) grad = 12; # solid yellow
else if (alert_level == 2 and grad == 5) grad = 13; # solid red
}
} else {
if (me.hialtmode == 0) {
if (diff>=lowaltft) grad = 3; # lite yellow
else {
grad = int(diff/1000) + 2;
if (grad<0) grad = 0;
}
} else {
if (diff>=lowaltft) grad = 3; # lite yellow
else {
if (me.bands_range > 0 and elev > me.bands_minalt) {
grad = 9 - int((me.bands_maxalt - elev) / me.bands_range);
if (grad>9) grad = 9; # solid green
else if (grad<6) grad = 6; #light green
}
}
}
}
}
} else {
grad = 11; #water/cyan
}
append(elevft,grad); # 0-5
} else {
append(elevft,0); # no data - black (magenta)
}
}
if (me.min_altitude > me.max_altitude) me.min_altitude = me.max_altitude; # occurs on sea areas
for (var r=0; r < len; r+=1) {
var imgx = elevft[r];
if (imgx == -1) continue;
if (imgx < 1) trn[r].hide();
else trn[r].setFile(me.imgpath ~ me.tile_list[imgx]).show();
}
me.radar_beacon += 1;
if (me.radar_beacon >= (me.tileradiusw*2)) {
me.restart_beacon();
}
me.fetching = 0;
};
var update_altitudes = func {
me.terrain_minalt.setValue(me.min_altitude);
me.terrain_maxalt.setValue(me.max_altitude);
var altdif = me.max_altitude - me.refaltitudeft;
if (altdif <= 0) {
if (altdif >= me.reflowaltft) me.terrain_maxcol.setValue(1);
else me.terrain_maxcol.setValue(0);
} else {
if (altdif>2000) me.terrain_maxcol.setValue(2);
else me.terrain_maxcol.setValue(1);
}
if (me.min_altitude == 9999) {
me.avg_minalt = me.min_altitude;
me.avg_maxalt = me.max_altitude;
} else {
#if (me.min_altitude < me.avg_minalt) me.avg_minalt = me.min_altitude;else
me.avg_minalt = math.round((me.avg_minalt * 2 + me.min_altitude) / 3);
#if (me.max_altitude > me.avg_maxalt) me.avg_maxalt = me.max_altitude;else
me.avg_maxalt = math.round((me.avg_maxalt * 2 + me.max_altitude) / 3);
}
me.avg_peakalt = me.avg_maxalt - me.avg_minalt;
if (me.onground == 0 and (me.max_altitude + 250) < me.refaltitudeft) { # 250 ft tollerance
me.hialtmode = 1;
var range = math.min(2400,(me.avg_maxalt - me.avg_minalt)) - 400;
if (range < 400) { # min elev number
me.bands_range = 0;
} else {
me.bands_range = int(range / 4);
me.bands_maxalt = me.avg_maxalt;
me.bands_minalt = math.max( me.avg_maxalt - range, me.avg_minalt + 400 );
}
} else {
me.hialtmode = 0;
#me.avg_minalt = 9999;
}
me.min_altitude = 9999;
me.max_altitude = -9999;
}
var restart_beacon = func {
me.radar_beacon = 0;
me.radar_cycle += 1;
me.reference = nil;
};
var init = func {
#print('TERRAIN init');
me.tile = 33;
me.fetching = 0;
me.fetchRad = me.model.fetchRad; # Radius of radar layer to fetch
me.range = me.model.rangeNm; # Range of Navigation Display
me.viewport_radius = me.getOption('viewport_radius', 670);
me.imgpath = get_local_path('res/terrainv2/');
me.radar_beacon = 0;
me.radar_cycle = 0;
me.radar_cleared = 1;
me.request_clear = 0;
me.min_altitude = 9999;
me.max_altitude = -9999;
me.avg_minalt = 9999;
me.avg_maxalt = -9999;
me.avg_peakalt = nil;
me.maxalt_col = 0; # 0 = grn, 1 = yel, 2 = red
me.bands_minalt = 0;
me.bands_maxalt = 0;
me.bands_range = 0;
me.basealtitudeft = nil;
me.reference = nil;
me.onfailure = 0;
me.hialtmode = 0; # high aircraft relative altitude mode
me.checkarrival = 0;
me.onground = 1;
var tile = me.tile;
var gx = int(me.viewport_radius / tile);
me.tileradius = gx;
var limx = int((512/tile)+0.5); # display width is smaller than height
me.tileradiusw = limx;
me.terrlayer = {};
var centx = 0;
var centy = -me.viewport_radius;
var group = me.group.createChild("group").set("z-index", -100); #me.element
for (var c=0; c<limx; c+=1) {
var hh = c * tile;
var mx = (c == 0) ? gx : int(math.sqrt(gx*gx-c*c) + 0.5);
var my = int(c*4/gx);
var py = centy + (gx-1) * tile;
var pxr = centx+(c*tile);
var pxl = centx-(c*tile)-tile;
var grplx = [];
var grprx = [];
for (var r=0; r<mx; r+=1) {
if (r<my) {
append(grplx , nil); #skip
append(grprx , nil);
} else {
append(grplx , group.createChild("image").setSize(tile,tile).setTranslation(pxl,py).hide());
append(grprx , group.createChild("image").setSize(tile,tile).setTranslation(pxr,py).hide());
}
py-=tile;
}
me.terrlayer["L" ~ c] = grplx;
me.terrlayer["R" ~ c] = grprx;
}
setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{ # detect GPWS switch status
me.onfailure = getprop("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit");
},1,0);
};
var clear = func {
if (me.radar_cleared == 0) {
me.radar_cleared = 1;
for (var c=0; c<me.tileradiusw; c+=1 ) {
var rowL = me.terrlayer["L" ~ c];
var rowR = me.terrlayer["R" ~ c];
var len = size(rowL);
for (var r=0; r<len; r+=1) {
if (rowL[r] != nil) {
rowL[r].hide();
rowR[r].hide();
}
}
}
}
}
var draw = func {
if(me.fetching) return;
if (pts.Sim.pause.getBoolValue()) return;
if (me.onfailure == 1) {
me.clear();
me.restart_beacon();
return;
}
if (me.layer.display_changed == 1) {
me.layer.display_changed = 0;
me.clear();
me.min_altitude = 9999;
me.max_altitude = -9999;
terrain_maxalt.setValue(-9999);
me.reference = nil;
}
if (me.reference == nil) { # update aircraft reference
var ref = geo.aircraft_position();
me.reference = ref;
if (ref != nil) {
me.refheading = getprop("orientation/heading-magnetic-deg");
var refalt = int(getprop("/position/altitude-ft")); #int(ref.alt() * 3.2808399);
me.refaltitudeft = refalt;
me.groundaltft = int(getprop("/position/ground-elev-ft"));
me.reflowaltft = (pts.Gear.position[1].getValue()) ? -250 : -500;
me.onground = pts.Gear.wow[0].getValue();
if (me.min_altitude != 9999) me.update_altitudes();
var flatalt = (me.avg_peakalt != nil and me.avg_peakalt>499) ? 400 : 140;
var vspeed30s = int(getprop("velocities/vertical-speed-fps") * 30);
if (vspeed30s<-500) me.refaltitudeft = math.max(me.avg_minalt , me.refaltitudeft + vspeed30s);
if (me.basealtitudeft == nil) { # first basealt set
me.basealtitudeft = me.groundaltft + flatalt;
me.flatalt = flatalt;
me.checkarrival = 1;
print("set REFALT [init]: "~me.basealtitudeft);
} else if (fmgc.FMGCInternal.phase < 2) { # starting at phase < 2
if (me.flatalt != flatalt) {
me.basealtitudeft = me.groundaltft + flatalt;
me.flatalt = flatalt;
print("set REFALT [flat]: "~me.basealtitudeft);
}
} else if (fmgc.FMGCInternal.phase == 5) {
if (me.checkarrival == 1) {
me.checkarrival = 0;
me.basealtitudeft = nil;
if (fmgc.FMGCInternal.arrApt != nil) {
var airport = airportinfo(fmgc.FMGCInternal.arrApt);
if (airport != nil) me.basealtitudeft = flatalt + int(airport.elevation * M2FT);
print("set REFALT [arrApt]: "~me.basealtitudeft);
}
if (me.basealtitudeft == nil) {
me.basealtitudeft = flatalt + me.avg_minalt; # that's fun
}
}
} else if (fmgc.FMGCInternal.phase == 6) {
if (me.checkarrival == 0) {
me.checkarrival = 1;
#me.basealtitudeft = 0;
}
} else if (fmgc.FMGCInternal.phase == 7) {
if (me.checkarrival == 0) {
me.checkarrival = 1;
me.basealtitudeft = me.groundaltft + flatalt;
print("set REFALT [done]: "~me.basealtitudeft);
}
} else if (fmgc.FMGCInternal.phase == 2) {
var expdaltft = me.groundaltft + flatalt;
if (me.basealtitudeft > expdaltft) {
me.basealtitudeft = expdaltft;
print("set REFALT [blwbase]: "~me.basealtitudeft);
}
} else if (fmgc.FMGCInternal.phase >= 2) {
me.basealtitudeft = math.avg(me.basealtitudeft,flatalt + me.groundaltft,int(flatalt + me.avg_minalt));
#if (me.basealtitudeft > me.avg_maxalt) {
# if (me.avg_maxalt < 1000) me.basealtitudeft = 0; # 1000ft min elev number
# else me.basealtitudeft = int(400 + me.avg_minalt);
# print("set REFALT [blwmin]: "~me.basealtitudeft);
#}
#else if (me.basealtitudeft == 0 and me.avg_maxalt >= 1000) { # 1000ft min elev number
# me.basealtitudeft = int(400 + me.avg_minalt);
# print("set REFALT [abvmin]: "~me.basealtitudeft);
#}
}
}
} else {
var range = me.layer.map.getRange(); # Range of Navigation Display
var update_size = (range != me.range);
me.range = range;
if (update_size) {
me.request_clear = 1;
}
me.updateTerrain(); # left
me.updateTerrain(); # right
}
};

View file

@ -26,13 +26,13 @@
inkscape:window-height="1017"
id="namedview102"
showgrid="false"
inkscape:zoom="1.2732019"
inkscape:cx="406.21664"
inkscape:cy="201.87587"
inkscape:zoom="3.1081105"
inkscape:cx="904.96427"
inkscape:cy="819.41055"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer3"
inkscape:current-layer="terrGroup"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:snap-object-midpoints="true"
@ -77,7 +77,34 @@
id="guide3115" /><sodipodi:guide
position="14.137585,913.25558"
orientation="1,0"
id="guide3498" /></sodipodi:namedview><metadata
id="guide3498" /><sodipodi:guide
position="74.643421,502.13953"
orientation="0,-1"
id="guide3552" /><sodipodi:guide
position="43.434749,95.13984"
orientation="0,-1"
id="guide1262" /><sodipodi:guide
position="23.634,-25.190503"
orientation="-1,0"
id="guide1264"
inkscape:label=""
inkscape:locked="false"
inkscape:color="rgb(0,0,255)" /><sodipodi:guide
position="45.728253,127.63524"
orientation="0,-1"
id="guide1266" /><sodipodi:guide
position="40.040659,26.851076"
orientation="1,0"
id="guide1325" /><sodipodi:guide
position="96.521665,66.50508"
orientation="0,-1"
id="guide1327" /><sodipodi:guide
position="1017.0166,55.726826"
orientation="1,0"
id="guide1344" /><sodipodi:guide
position="978.72968,72.618123"
orientation="1,0"
id="guide1259" /></sodipodi:namedview><metadata
id="metadata5186"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /><dc:creator><cc:Agent><dc:title>Gijs de Rooy</dc:title></cc:Agent></dc:creator><cc:license
@ -242,7 +269,69 @@
inkscape:connector-curvature="0"
inkscape:transform-center-y="-340.574"
inkscape:label="#path3843"
sodipodi:nodetypes="cc" /><path
sodipodi:nodetypes="cc" /><g
id="terrGroup"
transform="translate(-9.356522,-6.2275037)"><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
x="1018.2351"
y="796.34009"
id="terrAhead"
inkscape:label="#text7243"><tspan
style="font-size:24px;line-height:1.25;text-align:end;text-anchor:end"
sodipodi:role="line"
id="tspan1244"
x="1018.2351"
y="796.34009">TERR</tspan><tspan
style="font-size:24px;line-height:1.25;text-align:end;text-anchor:end"
sodipodi:role="line"
x="1018.2351"
y="826.34009"
id="tspan1248">AHEAD</tspan></text><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
x="952.74292"
y="826.34009"
id="TerrLabel"
inkscape:label="#text7243"><tspan
style="font-size:24px;line-height:1.25"
sodipodi:role="line"
id="tspan1994"
x="952.74292"
y="826.34009">TERR</tspan></text><text
inkscape:label="#text7243"
id="terrHI"
y="858.63959"
x="965.73273"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="858.63959"
x="965.73273"
id="tspan2002"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">000</tspan></text><text
inkscape:label="#text7243"
id="terrLO"
y="888.00446"
x="965.73273"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="888.00446"
x="965.73273"
id="tspan2006"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">000</tspan></text><rect
style="fill:none;stroke:#f2f235;stroke-width:3.15591;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect2018"
width="67.30439"
height="58.673889"
x="958.45599"
y="833.17212"
ry="0" /><path
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f2f235;stroke-width:3.15591;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.9941;stop-color:#000000;stop-opacity:1"
d="m 958.38792,861.87476 67.46618,0.61588"
id="path2033"
sodipodi:nodetypes="cc" /></g><path
sodipodi:nodetypes="cc"
inkscape:label="#path3843"
inkscape:transform-center-y="-340.574"
@ -260,14 +349,14 @@
inkscape:label="#text7243"
id="wpActiveId"
y="34.099972"
x="788.04407"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#cecdce;fill-opacity:1;stroke:none"
x="908.58118"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#cecdce;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="34.099972"
x="788.04407"
x="908.58118"
id="tspan7245"
sodipodi:role="line"
style="font-size:36px;line-height:1.25">ABCD</tspan></text>
style="font-size:36px;line-height:1.25;text-align:end;text-anchor:end">XXXX99X</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
@ -289,18 +378,19 @@
inkscape:label="#path7253" /><g
id="windArrow"
transform="matrix(0.81,0,0,0.81,-8.3843096,20.546412)"><path
inkscape:label="#path3017"
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path3017"
d="m 63.260317,138.7628 9.917949,-18.75435 -9.917949,18.75529 -9.969447,-18.75529 9.969447,18.75529"
style="display:inline;fill:#0dc04b;stroke:#0dc04b;stroke-width:4.44444;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
inkscape:label="#path3017l"
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path3107l"
d="M 63.260505,77.514285 63.260317,138.7628"
style="display:inline;fill:#0dc04b;stroke:#0dc04b;stroke-width:4.44444;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></g><g
style="display:inline;fill:#0dc04b;stroke:#0dc04b;stroke-width:4.44444;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:#0dc04b;fill-opacity:1;stroke:#0dc04b;stroke-width:4.44444;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;stop-opacity:1"
d="m 53.29087,120.00845 9.969447,18.75435"
id="path1242" /><path
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:#0dc04b;fill-opacity:1;stroke:#0dc04b;stroke-width:4.44444;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;stop-opacity:1"
d="M 73.229764,120.00845 63.260317,138.7628"
id="path1244"
sodipodi:nodetypes="cc" /></g><g
inkscape:label="#g3124"
id="compass"
transform="rotate(0.34999975,516.49696,825.81379)"><path
@ -914,96 +1004,74 @@
</g><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="71.73262"
y="913.5495"
x="39.859375"
y="919.5495"
id="vorL"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;fill:#0dc04b;fill-opacity:1"
sodipodi:role="line"
id="tspan3056"
x="71.73262"
y="913.5495">VOR 1</tspan></text>
x="39.859375"
y="919.5495">VOR 1</tspan></text>
<text
inkscape:label="#text7243"
id="dmeL"
y="993.85461"
x="151.73262"
x="87.73262"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="151.73262"
x="87.73262"
id="tspan3060"
sodipodi:role="line"
style="font-size:24px;line-height:1.25">NM</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="71.129601"
y="993.85461"
id="dmeLDist"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;fill:#0dc04b"
sodipodi:role="line"
id="tspan3068"
x="71.129601"
y="993.85461">99.9</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="71.73262"
y="954.56171"
x="39.9375"
y="956.56171"
id="vorLId"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;fill:#0dc04b"
sodipodi:role="line"
id="tspan3072"
x="71.73262"
y="954.56171">ABC</tspan></text>
x="39.9375"
y="956.56171">ABC</tspan></text>
<text
inkscape:label="#text7243"
id="vorR"
y="913.5495"
x="859.7326"
y="919.5495"
x="883.85938"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="913.5495"
x="859.7326"
y="919.5495"
x="883.85938"
id="tspan3076"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">VOR 2</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
x="931.7326"
x="967.03125"
y="993.85461"
id="dmeR"
inkscape:label="#text7243"><tspan
style="font-size:24px;line-height:1.25"
sodipodi:role="line"
id="tspan3080"
x="931.7326"
x="967.03125"
y="993.85461">NM</tspan></text>
<text
inkscape:label="#text7243"
id="dmeRDist"
y="993.85461"
x="859.12958"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="859.12958"
id="tspan3084"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">99.9</tspan></text>
<text
inkscape:label="#text7243"
id="vorRId"
y="954.56171"
x="859.7326"
y="955.91815"
x="883.9375"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="954.56171"
x="859.7326"
y="955.91815"
x="883.9375"
id="tspan3088"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">ABC</tspan></text>
@ -1234,16 +1302,8 @@
sodipodi:role="line"
style="font-size:32px;line-height:125%;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#af0063;fill-opacity:1">999.99</tspan></text>
<path
style="fill:none;stroke:#cecdce;stroke-width:2.4611;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 20.951614,914.85538 v 82.41763 m 4.201291,-92.8082 -4.04,-8.83104 -4.040001,8.50433 L 12,914.85538 h 8.951614 l 8.467743,0.21255 z"
id="vorLSym"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc"
inkscape:label="#path3100"
inkscape:transform-center-y="-498.20098"
inkscape:transform-center-x="-0.080644898" /><path
style="fill:none;stroke:#cecdce;stroke-width:2.38918;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 997.8036,974.07643 V 919.81909 H 987.5 l 17.7357,-42.20198 m 7.1787,96.45932 v -54.25734 h 10.557 l -17.7357,-42.20198"
style="display:inline;fill:none;stroke:#cecdce;stroke-width:3.28819;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1006.4144,954.86998 v -26.25734 h 10.557 l -17.7357,-26.20198 m -7.4321,52.45932 V 928.61264 H 981.5 l 17.7357,-26.20198 v -6.00909"
id="vorRSym"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc"
@ -1353,7 +1413,59 @@
x="872.1673"
id="tspan748"
sodipodi:role="line"
style="font-size:36px;line-height:1.25;fill:#179ab7;fill-opacity:1">999</tspan></text></g><g
style="font-size:36px;line-height:1.25;fill:#179ab7;fill-opacity:1">999</tspan></text><path
id="vorLSym"
style="display:inline;fill:none;stroke:#cecdce;stroke-width:3.28819;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 23.634,896.5254 v 7.83228 m 1.26e-4,24.4977 v 24.41763 M 23.634,903.63377 8.682512,928.85538 H 23.634 l 14.467869,0.21255 z"
sodipodi:nodetypes="ccccccccc" /><g
id="dmeLDist"
transform="translate(2)"><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="56.791557"
y="993.85461"
id="dmeLDist1"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;text-align:end;text-anchor:end;fill:#0dc04b"
sodipodi:role="line"
id="tspan3068"
x="56.791557"
y="993.85461">999</tspan></text><text
inkscape:label="#text7243"
id="dmeLDist2"
y="993.85461"
x="55.73262"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="55.73262"
id="tspan1329"
sodipodi:role="line"
style="font-size:24px;line-height:1.25;fill:#0dc04b">.9</tspan></text></g><g
id="dmeRDist"
transform="translate(-0.90081787)"><text
inkscape:label="#text7243"
id="dmeRDist1"
y="993.85461"
x="936.79144"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="936.79144"
id="tspan3084"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;text-align:end;text-anchor:end;fill:#0dc04b">999</tspan></text><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="935.7326"
y="993.85461"
id="dmeRDist2"
inkscape:label="#text7243"><tspan
style="font-size:24px;line-height:1.25;fill:#0dc04b"
sodipodi:role="line"
id="tspan1346"
x="935.7326"
y="993.85461">.9</tspan></text></g></g><g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="CTR"
@ -2056,7 +2168,7 @@
id="layer9"
inkscape:label="ND_BOTTOM_MEMO"
style="display:inline"><rect
style="opacity:0.99;fill:none;stroke:#ffffff;stroke-width:3.15553"
style="opacity:0.99;fill:none;stroke:#ffffff;stroke-width:3.15591;stroke-miterlimit:4;stroke-dasharray:none"
id="nd_warn_msgbox"
width="563.05048"
height="46.844471"
@ -2158,4 +2270,15 @@
id="tspan2199"
x="510.7153"
y="399.58936"
style="font-size:53.3333px;line-height:1.25;fill:#ff0000">MAP NOT AVAIL</tspan></text></g></svg>
style="font-size:53.3333px;line-height:1.25;fill:#ff0000">MAP NOT AVAIL</tspan></text></g><text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:53.3333px;line-height:0%;font-family:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="510.7153"
y="537.58936"
id="nd_msg_change"
inkscape:label="#text3401"><tspan
sodipodi:role="line"
id="tspan3544"
x="510.7153"
y="537.58936"
style="font-size:53.3333px;line-height:1.25;fill:#0dc04b">RANGE CHANGE</tspan></text></svg>

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

View file

@ -12,6 +12,14 @@ var adirs_3 = props.globals.getNode("/instrumentation/efis[0]/nd/ir-3", 1);
var vhdg_bug = props.globals.getNode("/it-autoflight/input/hdg",0); # ND compass position deg
var terrain_minalt = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/min-altitude", 0);
var terrain_maxalt = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-altitude", -9999);
var terrain_maxcol = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-color", 0);
var terrain_alert = props.globals.getNode("/instrumentation/mk-viii/outputs/alert-mode",0);
var GREEN = [0.0509,0.7529,0.2941];
var YELLOW = [0.949,0.949,0.207];
var RED = [1.0000,0.0000,0.0000];
canvas.NDStyles["Airbus"] = {
font_mapper: func(family, weight) {
@ -84,15 +92,36 @@ canvas.NDStyles["Airbus"] = {
}
},
layers: [
{
name:"TERRAIN",
isMapStructure: 1,
update_on:[ {rate_hz: 10}, "toggle_range","toggle_display_mode","toggle_terrain"],
predicate: func(nd, layer) {
#print("TERRAIN TOGGLE: " ~ nd.get_switch("toggle_terrain"));
var visible = nd.get_switch("toggle_terrain") and
nd.get_switch("toggle_display_mode") != "PLAN" and (nd.rangeNm() <= 40) and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting));
if (visible) {
layer.update();
} else {
layer.display_changed = 1;
}
layer.group.setVisible(visible);
}, # end of layer update predicate
options: {
viewport_radius: 670, #512, #706,
},
"z-index": -100,
},
{
name:"WXR_live",
isMapStructure:1,
always_update: 1,
update_on:[ "toggle_range","toggle_weather","toggle_display_mode","toggle_weather_live"],
update_on:[ "toggle_range","toggle_weather","toggle_display_mode","toggle_weather_live","toggle_terrain"],
predicate: func(nd, layer) {
var visible=nd.get_switch("toggle_weather") and
nd.get_switch("toggle_weather_live") and
nd.get_switch("toggle_display_mode") != "PLAN" and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting));
nd.get_switch("toggle_display_mode") != "PLAN" and !nd.get_switch("toggle_terrain") and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting));
layer.group.setVisible(visible);
if (visible) {
layer.update();
@ -891,7 +920,8 @@ canvas.NDStyles["Airbus"] = {
id:"hdgBug2ValR", #"hdgBug2ValL"",
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered"),
predicate: func(nd) nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)),
is_true: func(nd) {
var bugRot = vhdg_bug.getValue();
var diffRot = (bugRot>=nd.userHdgTrk) ? (bugRot-nd.userHdgTrk) : (360+bugRot-nd.userHdgTrk);
@ -909,7 +939,8 @@ canvas.NDStyles["Airbus"] = {
id:"hdgBug2ValL",
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered"),
predicate: func(nd) nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)),
is_true: func(nd) {
var bugRot = vhdg_bug.getValue();
var diffRot = (bugRot>nd.userHdgTrk) ? (360+nd.userHdgTrk-bugRot) : (nd.userHdgTrk-bugRot);
@ -1266,9 +1297,9 @@ canvas.NDStyles["Airbus"] = {
impl: {
init: func(nd,symbol),
predicate: func(nd){
nd.get_switch("toggle_display_mode") == "MAP" and
!nd.get_switch("toggle_centered") and
(
nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")
and (nd.change_phase != 1)
and (
getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val or
nd.get_switch("toggle_trk_line")
)
@ -1284,6 +1315,7 @@ canvas.NDStyles["Airbus"] = {
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered")
and (nd.change_phase != 1)
and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
is_true: func(nd) {
nd.symbols.trkInd2.show();
@ -1297,7 +1329,7 @@ canvas.NDStyles["Airbus"] = {
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and
nd.get_switch("toggle_centered") and
nd.get_switch("toggle_centered") and (nd.change_phase != 1) and
getprop(nd.options.defaults.lat_ctrl) != nd.options.defaults.managed_val and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
is_true: func(nd) {
@ -1310,7 +1342,7 @@ canvas.NDStyles["Airbus"] = {
id:"vorCrsPtr",
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered")),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered")) and (nd.change_phase != 1),
is_true: func(nd) {
nd.symbols.vorCrsPtr.show();
if (is_ils) {
@ -1327,7 +1359,7 @@ canvas.NDStyles["Airbus"] = {
id:"vorCrsPtr2",
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and nd.get_switch("toggle_centered")),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and nd.get_switch("toggle_centered")) and (nd.change_phase != 1),
is_true: func(nd) {
nd.symbols.vorCrsPtr2.show();
var is_ils = (nd.get_switch("toggle_display_mode") == "APP");
@ -1354,7 +1386,7 @@ canvas.NDStyles["Airbus"] = {
id: "gsDiamond",
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]),
predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]) and (nd.change_phase != 1),
is_true: func(nd) {
if(getprop("/instrumentation/nav/gs-needle-deflection-norm") != nil)
nd.symbols.gsDiamond.setTranslation(getprop("/instrumentation/nav[0]/gs-needle-deflection-norm")*150,0);
@ -1422,7 +1454,7 @@ canvas.NDStyles["Airbus"] = {
var ils_mode = getprop("/Flight-management/freq/ils-mode");
var has_ils = (nav_id != nil and nav_id != "");
(nd.get_switch("toggle_display_mode") == "MAP" and
!nd.get_switch("toggle_centered") and has_ils and ils_mode);
!nd.get_switch("toggle_centered") and has_ils and ils_mode and (nd.change_phase != 1));
},
is_true: func(nd) {
nd.symbols.locTrkPointer.show();
@ -1442,7 +1474,7 @@ canvas.NDStyles["Airbus"] = {
var ils_mode = getprop("/Flight-management/freq/ils-mode");
var has_ils = (nav_id != nil and nav_id != "");
(nd.get_switch("toggle_display_mode") == "MAP" and
nd.get_switch("toggle_centered") and has_ils and ils_mode);
nd.get_switch("toggle_centered") and has_ils and ils_mode and (nd.change_phase != 1));
},
is_true: func(nd) {
nd.symbols.locTrkPointer2.show();
@ -1602,15 +1634,15 @@ canvas.NDStyles["Airbus"] = {
nd.symbols.vorL.setText("ADF 1");
nd.symbols.vorL.setColor(0.195,0.96,0.097);
nd.symbols.vorLId.setColor(0.195,0.96,0.097);
nd.symbols.dmeLDist.setColor(0.195,0.96,0.097);
}
else{
#nd.symbols.dmeLDist.setColor(0.195,0.96,0.097);
nd.symbols.dmeL.setText("");
} else {
nd.symbols.vorL.setText("VOR 1");
nd.symbols.vorL.setColor(1,1,1);
nd.symbols.vorLId.setColor(1,1,1);
nd.symbols.dmeLDist.setColor(1,1,1);
#nd.symbols.dmeLDist.setColor(1,1,1);
nd.symbols.dmeL.setText("NM");
}
nd.symbols.dmeL.setText("NM");
nd.symbols.dmeL.setColor(0,0.59,0.8);
},
is_false: func(nd){
@ -1629,14 +1661,14 @@ canvas.NDStyles["Airbus"] = {
nd.symbols.vorR.setText("ADF 2");
nd.symbols.vorR.setColor(0.195,0.96,0.097);
nd.symbols.vorRId.setColor(0.195,0.96,0.097);
nd.symbols.dmeRDist.setColor(0.195,0.96,0.097);
nd.symbols.dmeR.setText("");
} else {
nd.symbols.vorR.setText("VOR 2");
nd.symbols.vorR.setColor(1,1,1);
nd.symbols.vorRId.setColor(1,1,1);
nd.symbols.dmeRDist.setColor(1,1,1);
#nd.symbols.dmeRDist.setColor(1,1,1);
nd.symbols.dmeR.setText("NM");
}
nd.symbols.dmeR.setText("NM");
nd.symbols.dmeR.setColor(0,0.59,0.8);
},
is_false: func(nd){
@ -1692,6 +1724,8 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_lh_vor_adf") != 0),
is_true: func(nd) {
if (nd.get_switch("toggle_lh_vor_adf") < 0) nd.symbols.vorLSym.setColor(0.195,0.96,0.097);
else nd.symbols.vorLSym.setColor(1,1,1);
nd.symbols.vorLSym.show();
},
is_false: func(nd){
@ -1747,6 +1781,8 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_rh_vor_adf") != 0),
is_true: func(nd) {
if (nd.get_switch("toggle_rh_vor_adf") < 0) nd.symbols.vorRSym.setColor(0.195,0.96,0.097);
else nd.symbols.vorRSym.setColor(1,1,1);
nd.symbols.vorRSym.show();
},
is_false: func(nd){
@ -1958,6 +1994,53 @@ canvas.NDStyles["Airbus"] = {
nd.symbols.offsetLbl.hide();
}
}
},
{
id: "terrGroup",
impl: {
init: func(nd,symbol),
predicate: func(nd) ( nd.get_switch("toggle_terrain") and
nd.get_switch("toggle_display_mode") != "PLAN" and (nd.rangeNm() <= 40) and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) ),
is_true: func(nd){
if (terrain_maxalt.getValue() != -9999) {
var alert = terrain_alert.getValue();
if (alert == 0) {
nd.symbols.TerrLabel.setVisible(1);
nd.symbols.terrAhead.setVisible(0);
} else {
nd.symbols.TerrLabel.setVisible(0);
nd.symbols.terrAhead.setVisible(1);
if (alert == 1) nd.symbols.terrAhead.setColor(YELLOW[0],YELLOW[1],YELLOW[2]);
else nd.symbols.terrAhead.setColor(RED[0],RED[1],RED[2]);
}
nd.symbols.terrLO.setText(sprintf("%03d",math.round(terrain_minalt.getValue()/100)));
nd.symbols.terrHI.setText(sprintf("%03d",math.round(terrain_maxalt.getValue()/100)));
if (terrain_maxcol.getValue() == 0) nd.symbols.terrHI.setColor(GREEN[0],GREEN[1],GREEN[2]);
else if (terrain_maxcol.getValue() == 1) nd.symbols.terrHI.setColor(YELLOW[0],YELLOW[1],YELLOW[2]);
else nd.symbols.terrHI.setColor(RED[0],RED[1],RED[2]);
nd.symbols.terrGroup.show();
terrain_maxalt.setValue(-9999); #update visual at radar cycle
}
},
is_false: func(nd){
nd.symbols.terrGroup.hide();
}
}
},
{
id: "nd_msg_change",
impl: {
init: func(nd, symbol),
predicate: func(nd) ( (nd.change_phase != 0) and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) ),
is_true: func(nd) {
nd.symbols.nd_msg_change.show();
},
is_false: func(nd) {
nd.symbols.nd_msg_change.hide();
}
}
}
], # end of vector with features

View file

@ -1698,6 +1698,41 @@
<command>property-toggle</command>
<property>instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit</property>
</binding>
<binding>
<condition>
<equals>
<property>instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit</property>
<value>1</value>
</equals>
</condition>
<command>property-assign</command>
<property>instrumentation/efis/inputs/terr</property>
<value>0</value>
</binding>
<binding>
<condition>
<equals>
<property>instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit</property>
<value>1</value>
</equals>
</condition>
<command>property-assign</command>
<property>instrumentation/efis[1]/inputs/terr</property>
<value>0</value>
</binding>
<binding>
<condition>
<equals>
<property>instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit</property>
<value>0</value>
</equals>
</condition>
<command>nasal</command>
<script>
setprop("instrumentation/efis/inputs/terr",getprop("controls/switches/terr_on_nd_l"));
setprop("instrumentation/efis[1]/inputs/terr",getprop("controls/switches/terr_on_nd_r"));
</script>
</binding>
<binding>
<command>nasal</command>
<script>libraries.pushbutton();</script>

View file

@ -60,7 +60,7 @@ var drawBlip = func(elem, threatLvl) {
.lineTo(0,-14)
.lineTo(10,0)
.lineTo(0,14)
.close();
.lineTo(-10,0);
}
};
@ -329,9 +329,8 @@ var TrafficLayer = {
var color = canvas._getColor(rgb);
var (r, g, b) = rgb;
if (threatLevel > 0) {
item.elems.blip.setColorFill(r, g, b);
} else {
item.elems.blip.setColorFill(0,0,0);
item.elems.blip.setColorFill(r, g, b);
} else {
item.elems.blip.setColor(r, g, b);
}
item.elems.text.setColor(r, g, b);

View file

@ -3569,7 +3569,7 @@ var messages_right_memo = func {
wing_aice.active = 0;
}
if (getprop("instrumentation/comm[2]/frequencies/selected-mhz") != 0 and (phaseVarMemo3 == 1 or phaseVarMemo3 == 2 or phaseVarMemo3 == 6 or phaseVarMemo3 == 9 or phaseVarMemo3 == 10)) {
if (!getprop("/systems/radio/vhf3-data-mode") and (phaseVarMemo3 == 1 or phaseVarMemo3 == 2 or phaseVarMemo3 == 6 or phaseVarMemo3 == 9 or phaseVarMemo3 == 10)) {
vhf3_voice.active = 1;
} else {
vhf3_voice.active = 0;

View file

@ -198,10 +198,12 @@ var systemsLoop = func(notification) {
# GPWS
var GPWS = {
inhibitNode: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit"),
tatcfInhibit: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit"),
volume: props.globals.getNode("/instrumentation/mk-viii/speaker/volume"),
flapAllOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-all-override"),
flap3Override: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override"),
flapOverride: props.globals.getNode("/instrumentation/mk-viii/inputs/discretes/momentary-flap-override"),
alertMode: props.globals.initNode("/instrumentation/mk-viii/outputs/alert-mode",0,"INT"),
};
setlistener("/instrumentation/mk-viii/inputs/discretes/gpws-inhibit", func() {
@ -228,6 +230,20 @@ setlistener("/instrumentation/mk-viii/inputs/discretes/momentary-flap-3-override
updateGPWSFlap();
}, 0, 0);
# GPWS alert pooling for get mode change - a little esoteric way but it works
var gpws_alert_watch = maketimer(0.8,func {
var alert = 0;
if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-warning")) alert = 2; # MODE2 - warning - RED
else if (getprop("instrumentation/mk-viii/outputs/discretes/gpws-alert")) alert = 1; # MODE1 - caution - YELLOW
if (GPWS.alertMode.getValue()!=alert) GPWS.alertMode.setValue(alert);
});
setlistener("/instrumentation/mk-viii/inputs/discretes/ta-tcf-inhibit", func{ # detect GPWS switch status
var failure = GPWS.tatcfInhibit.getBoolValue();
if (!failure) gpws_alert_watch.start();
else gpws_alert_watch.stop();
},1,0);
# Replay
var replayState = props.globals.getNode("/sim/replay/replay-state");
setlistener("/sim/replay/replay-state", func() {

View file

@ -96,6 +96,9 @@ var am_mode_rmp3 = props.globals.initNode("/systems/radio/rmp[2]/am-active", 0,
var sel_crs_rmp1 = props.globals.initNode("/systems/radio/rmp[0]/select-crs", 1, "BOOL");
var sel_crs_rmp2 = props.globals.initNode("/systems/radio/rmp[1]/select-crs", 1, "BOOL");
var vhf3_data_mode = props.globals.initNode("/systems/radio/vhf3-data-mode", 1, "BOOL");
var data_mode_stby_rmp = props.globals.initNode("/systems/radio/data-mode-stby-rmp", 0, "INT");
var init = func() {
chan_rmp1.setValue("vhf1");
chan_rmp2.setValue("vhf2");
@ -153,57 +156,52 @@ var update_active_vhf = func(vhf) {
var sel3 = chan_rmp3.getValue();
if (vhf == 1) {
if (sel1 == "vhf1" or sel2 == "vhf1") {
var act = sprintf("%3.3f", act_vhf1.getValue());
var act = sprintf("%3.3f", act_vhf1.getValue());
if (sel1 == "vhf1") {
act_display_rmp1.setValue(act);
}
if (sel2 == "vhf1") {
act_display_rmp2.setValue(act);
}
if (sel3 == "vhf1") {
act_display_rmp3.setValue(act);
}
if (sel1 == "vhf1") {
act_display_rmp1.setValue(act);
}
if (sel2 == "vhf1") {
act_display_rmp2.setValue(act);
}
if (sel3 == "vhf1") {
act_display_rmp3.setValue(act);
}
} else if (vhf == 2) {
if (sel1 == "vhf2" or sel2 == "vhf2") {
var act = sprintf("%3.3f", act_vhf2.getValue());
var act = sprintf("%3.3f", act_vhf2.getValue());
if (sel1 == "vhf2") {
act_display_rmp1.setValue(act);
}
if (sel2 == "vhf2") {
act_display_rmp2.setValue(act);
}
if (sel3 == "vhf2") {
act_display_rmp3.setValue(act);
}
if (sel1 == "vhf2") {
act_display_rmp1.setValue(act);
}
if (sel2 == "vhf2") {
act_display_rmp2.setValue(act);
}
if (sel3 == "vhf2") {
act_display_rmp3.setValue(act);
}
} else if (vhf == 3) {
if (sel1 == "vhf3" or sel2 == "vhf3") {
var act = sprintf("%3.3f", act_vhf3.getValue());
var act = sprintf("%3.3f", act_vhf3.getValue());
var data_mode = vhf3_data_mode.getValue();
if (sel1 == "vhf3") {
if (act == 0) {
act_display_rmp1.setValue("data");
} else {
act_display_rmp1.setValue(act);
}
if (sel1 == "vhf3") {
if (data_mode == 1) {
act_display_rmp1.setValue("data");
} else {
act_display_rmp1.setValue(act);
}
if (sel2 == "vhf3") {
if (act == 0) {
act_display_rmp2.setValue("data");
} else {
act_display_rmp2.setValue(act);
}
}
if (sel2 == "vhf3") {
if (data_mode == 1) {
act_display_rmp2.setValue("data");
} else {
act_display_rmp2.setValue(act);
}
if (sel3 == "vhf3") {
if (act == 0) {
act_display_rmp3.setValue("data");
} else {
act_display_rmp3.setValue(act);
}
}
if (sel3 == "vhf3") {
if (data_mode == 1) {
act_display_rmp3.setValue("data");
} else {
act_display_rmp3.setValue(act);
}
}
} else if (vhf == 4) {
@ -283,6 +281,7 @@ var update_displays_nav = func(nav) {
}
var update_stby_freq = func(rmp_no, freq) {
var data_mode = vhf3_data_mode.getValue();
if (rmp_no == 0) {
if (freq == 1) {
var stby = sprintf("%3.3f", stby_rmp1_vhf1.getValue());
@ -296,7 +295,7 @@ var update_stby_freq = func(rmp_no, freq) {
var stby = sprintf("%5.0f", stby_rmp1_hf2.getValue());
}
if (stby == 0) {
if (data_mode == 0 and data_mode_stby_rmp.getValue() == 0) {
stby_display_rmp1.setValue("data");
} else {
stby_display_rmp1.setValue(stby);
@ -314,7 +313,7 @@ var update_stby_freq = func(rmp_no, freq) {
var stby = sprintf("%5.0f", stby_rmp2_hf2.getValue());
}
if (stby == 0) {
if (data_mode == 0 and data_mode_stby_rmp.getValue() == 1) {
stby_display_rmp2.setValue("data");
} else {
stby_display_rmp2.setValue(stby);
@ -332,7 +331,7 @@ var update_stby_freq = func(rmp_no, freq) {
var stby = sprintf("%5.0f", stby_rmp3_hf2.getValue());
}
if (stby == 0) {
if (data_mode == 0 and data_mode_stby_rmp.getValue() == 2) {
stby_display_rmp3.setValue("data");
} else {
stby_display_rmp3.setValue(stby);
@ -399,6 +398,18 @@ var transfer = func(rmp_no) {
var sel_crs = getprop("/systems/radio/rmp[" ~ rmp_no ~ "]/select-crs");
if (string.match(sel_chan, "vhf[1-3]")) {
var data_mode = vhf3_data_mode.getValue();
if (string.match(sel_chan, "vhf3") and ((data_mode_stby_rmp.getValue() == rmp_no and data_mode == 0) or data_mode == 1)) {
if (data_mode == 0)
{
vhf3_data_mode.setValue(1);
}
else
{
vhf3_data_mode.setValue(0);
data_mode_stby_rmp.setValue(rmp_no);
}
}
var mod1 = int(string.replace(sel_chan, "vhf", ""));
var mod = mod1 - 1;

View file

@ -21,6 +21,9 @@ It is highly reccomended to purchase a NAVIGRAPH subscription and download their
To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml.
## Remote MCDU
If you want to run the MCDU on a phone or tablet for better realism and easier input, put mcdu.html into the FGDATA/Phi folder, run FlightGear with enabled HTTP server (i.e. command line --httpd=8080) and open http://your-flightgear-computer:8080/mcdu.html in the browser on your phone or tablet.
## Installation
If you have issues installing, please check INSTALL.MD!
Specifically, make sure you remove -dev from the folder name!

211
mcdu.html Normal file
View file

@ -0,0 +1,211 @@
<!DOCTYPE html>
<html>
<head>
<title>MCDU</title>
<meta charset="utf-8"/>
<script>
let screen;
let screen_src;
let loading = 0;
let scheduled_load = 0;
function refresh_screen() {
if (loading) {
scheduled_load = 1;
}
else {
loading = 1;
screen.src = screen_src + '&random=' + (new Date).getTime()
}
}
function press_button(type, text) {
let request = new XMLHttpRequest;
request.open(
"POST",
window.location.protocol + "//" + window.location.host + "/run.cgi?value=nasal"
);
request.setRequestHeader("Content-Type", "application/json");
let body = JSON.stringify({
"name": "",
"children": [
{
"name": "script",
"index": 0,
"value": "mcdu." + type + "(\"" + text + "\", 0);"
}
]
});
request.send(body);
request.addEventListener('load', function() {
refresh_screen();
}, true);
}
window.addEventListener('load', function() {
let tds = document.querySelectorAll('.input td');
for (const td of tds) {
td.addEventListener('click', function() {
press_button("button", td.textContent);
}, true);
}
tds = document.querySelectorAll('.enter td');
for (const td of tds) {
td.addEventListener('click', function() {
press_button(td.nextSibling ? "lskbutton" : "rskbutton", td.textContent);
}, true);
}
tds = document.querySelectorAll('.menu td');
for (const td of tds) {
td.addEventListener('click', function() {
press_button("pagebutton", td.className);
}, true);
}
tds = document.querySelectorAll('.arrows td');
for (const td of tds) {
td.addEventListener('click', function() {
press_button(td.className == 'airport' ? "pagebutton" : "arrowbutton", td.className);
}, true);
}
screen = document.querySelector('img');
screen.addEventListener('load', function() {
loading = 0;
if (scheduled_load) {
scheduled_load = 0;
refresh_screen();
}
});
screen_src = screen.src;
window.setInterval(refresh_screen, 1000);
}, true);
</script>
<style>
body { font-size: 5rem; margin: 0; padding: 0; background-color: black; color: white; }
table { margin: 0; padding: 0 }
tr { margin: 0; padding: 0 }
td { margin: 0; padding: 0; text-align: center; outline: 1px solid gray; }
td:active { background-color: white; color: black }
.enter { font-size: 60% }
.enter tr:first-child { font-size: 70% }
.enter tr:last-child { font-size: 50% }
.enter td:first-child, .enter td:last-child { padding: 0 0.55em; }
.menu, .arrows .airport { font-size: 40%; line-height: 1em; }
.menu td { height: 2.5em; }
.arrows td { width: 50%; padding: 0; font-size: 60%; }
img { display: block; }
</style>
</head>
<body style="width: 100%">
<table class="enter" style="width: 92%">
<tr>
<td>&nbsp;</td>
<td rowspan="8" style="vertical-align: top"><img src="/screenshot?canvasindex=10&type=png" style="width: 100%"/></td>
<td>&nbsp;</td>
</tr>
<tr><td>1</td><td>1</td></tr>
<tr><td>2</td><td>2</td></tr>
<tr><td>3</td><td>3</td></tr>
<tr><td>4</td><td>4</td></tr>
<tr><td>5</td><td>5</td></tr>
<tr><td>6</td><td>6</td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>
<table class="menu" style="width: 92%">
<tr>
<td class="dirto">DIR</td>
<td class="prog">PROG</td>
<td class="perf">PERF</td>
<td class="init">INIT</td>
<td class="data">DATA</td>
<td></td>
<td>BRT</td>
</tr>
<tr>
<td class="f-pln">F-PLN</td>
<td class="radnav">RAD<br/>NAV</td>
<td class="fuel-pred">FUEL<br/>PRED</td>
<td>SEC<br/>F-PLN</td>
<td class="atc">ATC<br/>COMM</td>
<td class="mcdu">MCDU<br/>MENU</td>
<td>DIM</td>
</tr>
</table>
<table class="input" style="float: right; width: 62.5%">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
<td>E</td>
</tr>
<tr>
<td>F</td>
<td>G</td>
<td>H</td>
<td>I</td>
<td>J</td>
</tr>
<tr>
<td>K</td>
<td>L</td>
<td>M</td>
<td>N</td>
<td>O</td>
</tr>
<tr>
<td>P</td>
<td>Q</td>
<td>R</td>
<td>S</td>
<td>T</td>
</tr>
<tr>
<td>U</td>
<td>V</td>
<td>W</td>
<td>X</td>
<td>Y</td>
</tr>
<tr>
<td>Z</td>
<td>/</td>
<td style="font-size: 50%">SP</td>
<td style="font-size: 25%">OVFY</td>
<td style="font-size: 33%">CLR</td>
</tr>
</table>
<table class="arrows" style="width: 25%">
<tr>
<td class="airport">AIR<br/>PORT</td>
<td></td>
</tr>
<tr>
<td class="left"></td>
<td class="up"></td>
</tr>
<tr>
<td class="right"></td>
<td class="down"></td>
</tr>
</table>
<table class="input" style="width: 30%">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>.</td>
<td>0</td>
<td>-</td>
</tr>
</table>
</body>
</html>

View file

@ -1 +1 @@
47
48