1
0
Fork 0

Add top of climb / level off symbols to the navdisplay

This commit is contained in:
Jonathan Redpath 2022-06-28 20:31:01 +01:00
parent 1e38f24926
commit d65fde3726
3 changed files with 74 additions and 99 deletions

View file

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg2985"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="airbus_tc.svg">
<defs
id="defs2987" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.27"
inkscape:cx="14.464853"
inkscape:cy="15.800695"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1075"
inkscape:window-height="665"
inkscape:window-x="93"
inkscape:window-y="92"
inkscape:window-maximized="0" />
<metadata
id="metadata2990">
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(0,16)">
<g
id="tc_symbol"
transform="matrix(1.4141414,0,0,1.4141414,-2.4444435,-18.040404)">
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path2993"
d="m 2.9285709,34.185715 12.3428571,-12.685716 30.514286,0 -4.8,-7.542856"
style="fill:none;stroke:#118eff;stroke-width:2.4000001;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
style="fill:none;stroke:#118eff;stroke-width:2.4000001px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 45.785714,21.561266 -4.8,7.542856"
id="path3094"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -181,7 +181,7 @@ canvas.NDStyles["Airbus"] = {
{
name: "ALT-profile",
isMapStructure: 1,
update_on: ["toggle_display_mode","toggle_range",{rate_hz: 2}],
update_on: ["toggle_display_mode","toggle_range", {rate_hz: 0.5}],
predicate: func(nd, layer) {
var visible = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting));
layer.group.setVisible( visible );
@ -205,7 +205,6 @@ canvas.NDStyles["Airbus"] = {
# /autopilot/route-manager/vnav/td/
# Each node should have the latitude-deg and longitude-deg properties.
# Available nodes are:
# tc (top of climb)
# td (top of descent)
# ec (end of climb)
# ed (end of descent)
@ -214,14 +213,13 @@ canvas.NDStyles["Airbus"] = {
# If ec and ed are altitude constraints, their node should have the
# boolean "alt-cstr" property set to 1.
vnav_node: "/autopilot/route-manager/vnav/",
types: ["tc", "td", "ec", "ed","sc","sd"],
types: ["ec","ed","sc","sd","td"],
svg_path: {
tc: get_local_path("res/airbus_tc.svg"),
td: get_local_path("res/airbus_td.svg"),
ec: get_local_path("res/airbus_ec.svg"),
ed: get_local_path("res/airbus_ed.svg"),
sc: get_local_path("res/airbus_sc.svg"),
sd: get_local_path("res/airbus_sd.svg")
sd: get_local_path("res/airbus_sd.svg"),
td: get_local_path("res/airbus_td.svg")
},
listen: [
"fplan_active",
@ -233,31 +231,32 @@ canvas.NDStyles["Airbus"] = {
draw_callback: func(){
var name = me.model.getName();
var grp = me.element.getElementById(name~"_symbol");
if(grp == nil) return;
var dfcolor = me.getStyle("default_color");
var armed_color = me.getStyle("armed_color");
var managed_color = me.getStyle("managed_color");
#print("Draw: -> " ~ name);
if(name == "td" or name == "sd" or name == "sc"){
var vnav_armed = me.model.getValue("vnav-armed");
if(vnav_armed and name != "td")
grp.setColor(armed_color);
else
grp.setColor(dfcolor);
if (grp == nil) return;
if (me.model.getValue("show")) {
grp.show();
} else {
grp.hide();
}
elsif(name == "ed" or name == "ec"){
var is_cstr = me.model.getValue("alt-cstr");
if(is_cstr)
grp.setColor(managed_color);
else
grp.setColor(armed_color);
if (name == "ed" or name == "ec") {
if (me.model.getValue("alt-cstr")) {
grp.setColor(me.getStyle("managed_color"));
} else {
grp.setColor(me.getStyle("armed_color"));
}
} elsif(name == "td" or name == "sd" or name == "sc"){
if (me.model.getValue("vnav-armed") and name != "td") {
grp.setColor(me.getStyle("armed_color"));
} else {
grp.setColor(me.getStyle("default_color"));
}
}
},
init_after_callback: func{
var name = me.model.getName();
var grp = me.element.getElementById(name~"_symbol");
if(name != "td" and name != "sd" and name != "sc"){
grp.setTranslation(-66,0);
if (name != "td" and name != "sd" and name != "sc") {
me.element.getElementById(name~"_symbol").setTranslation(-66,0);
}
}
}

View file

@ -45,6 +45,7 @@ var flightPlanController = {
_timeTemp: nil,
_altTemp: nil,
decelPoint: nil,
lvlOffPoint: nil,
init: func() {
me.resetFlightplan(2);
@ -60,8 +61,18 @@ var flightPlanController = {
me.resetFlightplan(0);
me.resetFlightplan(1);
me.resetFlightplan(2);
me.decelPoint = nil;
setprop("/instrumentation/nd/symbols/decel/show", 0);
me.lvlOffPoint = nil;
setprop("/autopilot/route-manager/vnav/ec/latitude-deg", 0); # necessary to prevent canvas glitching out because properties don't exist
setprop("/autopilot/route-manager/vnav/ed/latitude-deg", 0);
setprop("/autopilot/route-manager/vnav/ec/longitude-deg", 0);
setprop("/autopilot/route-manager/vnav/ed/longitude-deg", 0);
setprop("/autopilot/route-manager/vnav/ec/show", 0);
setprop("/autopilot/route-manager/vnav/ed/show", 0);
me.flightplans[2].activate();
},
@ -763,6 +774,36 @@ var flightPlanController = {
setprop("/instrumentation/nd/symbols/decel/index", me.indexTemp);
},
calculateLvlOffPoint: func(deltaAltitude) {
me.distLvl = (deltaAltitude * pts.Velocities.groundspeedKt.getValue()) / (fmgc.Internal.vs.getValue() * 60);
if (fmgc.Output.lat.getValue() == 1) { # NAV
me.lvlOffPoint = me.flightplans[2].pathGeod(me.currentToWptIndex.getValue() - 1, me.flightplans[2].getWP(me.currentToWptIndex.getValue()).leg_distance - me.distToWpt.getValue() + abs(me.distLvl));
} elsif (fmgc.Output.lat.getValue() == 0) { # HDG TRK
#var coord = geo.aircraft_position();
#coord.apply_course_distance(fmgc.Internal.hdg.getValue(), me.distLvl * FT2M);
#me.lvlOffPoint = {lat: coord.lat(), lon: coord.lon()};
me.lvlOffPoint = me.flightplans[2].pathGeod(me.currentToWptIndex.getValue(), 10);
} else {
setprop("/autopilot/route-manager/vnav/ec/show", 0);
setprop("/autopilot/route-manager/vnav/ed/show", 0);
me.lvlOffPoint = nil;
}
if (deltaAltitude >= 100 and me.lvlOffPoint != nil) {
setprop("/autopilot/route-manager/vnav/ec/latitude-deg", me.lvlOffPoint.lat);
setprop("/autopilot/route-manager/vnav/ec/longitude-deg", me.lvlOffPoint.lon);
setprop("/autopilot/route-manager/vnav/ec/show", 1);
setprop("/autopilot/route-manager/vnav/ed/show", 0);
} elsif (deltaAltitude <= -100 and me.lvlOffPoint != nil) {
setprop("/autopilot/route-manager/vnav/ed/latitude-deg", me.lvlOffPoint.lat);
setprop("/autopilot/route-manager/vnav/ed/longitude-deg", me.lvlOffPoint.lon);
setprop("/autopilot/route-manager/vnav/ec/show", 0);
setprop("/autopilot/route-manager/vnav/ed/show", 1);
}
},
# insertPlaceBearingDistance - insert PBD waypoint at specified index,
# at some specified bearing, distance from a specified location
# args: wp, index, plan
@ -898,6 +939,14 @@ var flightPlanController = {
me.calculateDecelPoint();
}
var deltaAltitude = fmgc.Input.alt.getValue() - pts.Instrumentation.Altimeter.indicatedFt.getValue();
if (abs(deltaAltitude) >= 100) {
me.calculateLvlOffPoint(deltaAltitude);
} else {
setprop("/autopilot/route-manager/vnav/ec/show", 0);
setprop("/autopilot/route-manager/vnav/ed/show", 0);
}
for (var i = 0; i <= 1; i += 1) {
if (canvas_mcdu.myFpln[i] != nil) {
canvas_mcdu.myFpln[i].updatePlan();