1
0
Fork 0

Misc port

This commit is contained in:
Jonathan Redpath 2022-01-16 22:28:50 +00:00
parent b8336d52b2
commit 7b4a4df40d
4 changed files with 43 additions and 28 deletions

View file

@ -637,11 +637,9 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
me.symbols.dmeRDist.setText("");
}
# Hide heading bug 10 secs after change
# Hide heading bug 45 secs after change
var vhdg_bug = getprop("/it-autoflight/input/hdg") or 0;
var hdg_bug_active = getprop("/it-autoflight/custom/show-hdg");
if (hdg_bug_active == nil)
hdg_bug_active = 1;
var hdg_bug_active = getprop("/it-autoflight/custom/show-hdg") or 1;
if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT")
or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD"))

View file

@ -595,18 +595,18 @@ canvas.NDStyles["Airbus"] = {
isMapStructure: 1,
update_on: ["toggle_display_mode","toggle_range"],
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));
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)) and getprop("/instrumentation/nd/symbols/decel/show");
layer.group.setVisible( visible );
if (visible) {
layer.update();
}
},
options: {
# Overridable options:
# decel_node: node containing latitude-deg and longitude-deg used to mark the deceleration point
# managed_speed_node: boolean property indicating that the aircraft is flying in managed speed mode
decel_node: "/instrumentation/nd/symbols/decel",
listen: [
"fplan_active",
"current_wp",
"wp_count",
"spd_ctrl",
"ver_ctrl",
"athr"
@ -746,14 +746,15 @@ canvas.NDStyles["Airbus"] = {
},
},
{
id: "taOnly", # the SVG ID
impl: { # implementation hash
init: func(nd, symbol), # for updateCenter stuff, called during initialization in the ctor
predicate: func(nd) getprop("/instrumentation/tcas/inputs/mode") == 2, # the condition
is_true: func(nd) nd.symbols.taOnly.show(), # if true, run this
is_false: func(nd) nd.symbols.taOnly.hide(), # if false, run this
}, # end of taOnly behavior/callbacks
}, # end of taOnly
# TODO: taOnly doesn"t need to use getprop polling in update(), use a listener instead!
id: "taOnly",
impl: {
init: func(nd, symbol),
predicate: func(nd) getprop("/instrumentation/tcas/inputs/mode") == 2,
is_true: func(nd) nd.symbols.taOnly.show(),
is_false: func(nd) nd.symbols.taOnly.hide(),
},
},
{
id: "tas",
impl: {
@ -761,7 +762,6 @@ canvas.NDStyles["Airbus"] = {
predicate: func(nd) getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 60,
is_true: func(nd) {
nd.symbols.tas.setText(sprintf("%3.0f",getprop("/instrumentation/airspeed-indicator/true-speed-kt")));
nd.symbols.tas.show();
},
is_false: func(nd){
nd.symbols.tas.setText("---");
@ -1324,7 +1324,7 @@ canvas.NDStyles["Airbus"] = {
id:"curTrkPtr",
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and !nd.get_switch("toggle_centered")
predicate: func(nd) (nd.get_switch("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))
and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42),
is_true: func(nd) {
@ -1368,7 +1368,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.change_phase != 1) and
nd.get_switch("toggle_centered") and (nd.change_phase != 1) and
getprop(nd.options.defaults.lat_ctrl) == 0 and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42 and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
is_true: func(nd) {
@ -1531,6 +1531,8 @@ canvas.NDStyles["Airbus"] = {
predicate: func(nd) (getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100),
is_true: func(nd) {
var windDir = pts.Instrumentation.PFD.windDirection.getValue() or 0;
if(nd.get_switch("toggle_true_north"))
windDir = windDir + getprop("/environment/magnetic-variation-deg");
nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,pts.Instrumentation.PFD.windSpeed.getValue() or 0));
},
is_false: func(nd) {
@ -1545,7 +1547,18 @@ canvas.NDStyles["Airbus"] = {
predicate: func(nd) (!(nd.in_mode("toggle_display_mode", ["PLAN"]) and (nd.get_switch("toggle_display_type") == "LCD")) and (pts.Instrumentation.PFD.windSpeed.getValue() or 0) >= 2 and getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100),
is_true: func(nd) {
nd.symbols.windArrow.show();
var windArrowRot = (pts.Instrumentation.PFD.windDirection.getValue() or 0) - nd.aircraft_source.get_hdg_tru();
var windArrowRot = pts.Instrumentation.PFD.windDirection.getValue() or 0;
if(nd.in_mode("toggle_display_mode", ["MAP","PLAN"])) {
if(nd.get_switch("toggle_true_north"))
windArrowRot = windArrowRot - nd.aircraft_source.get_trk_tru();
else
windArrowRot = windArrowRot - nd.aircraft_source.get_trk_mag();
} else {
if(nd.get_switch("toggle_true_north"))
windArrowRot = windArrowRot - nd.aircraft_source.get_hdg_tru();
else
windArrowRot = windArrowRot - nd.aircraft_source.get_hdg_mag();
}
nd.symbols.windArrow.setRotation(windArrowRot*D2R);
},
is_false: func(nd) nd.symbols.windArrow.hide(),

View file

@ -365,9 +365,9 @@ var ITAF = {
# Preselect Heading
if (Output.latTemp != 0 and Output.latTemp != 9) { # Modes that always show HDG
if (Custom.hdgTime.getValue() + 45 >= Misc.elapsedSec.getValue()) {
setprop("it-autoflight/custom/show-hdg", 1);
Custom.showHdg.setBoolValue(1);
} else {
setprop("it-autoflight/custom/show-hdg", 0);
Custom.showHdg.setBoolValue(0);
}
}

View file

@ -26,8 +26,6 @@ var altitude = 0;
var flap = 0;
var flaps = 0;
var ktsmach = 0;
var kts_sel = 0;
var mach_sel = 0;
var srsSPD = 0;
var mng_alt_spd = 0;
var mng_alt_mach = 0;
@ -74,9 +72,9 @@ var FMGCinit = func {
var FMGCInternal = {
# phase logic
phase: 0,
decel: 0,
minspeed: 0,
maxspeed: 0,
decel: 0,
clbSpdLim: 250,
desSpdLim: 250,
clbSpdLimAlt: 10000,
@ -301,9 +299,15 @@ var updateARPT = func {
}
}
var updateArptLatLon = func {
var apt = nil;
var dms = nil;
var degrees = nil;
var minutes = nil;
var sign = nil;
var updateArptLatLon = func() {
#ref lat
dms = getprop("/FMGC/flightplan[2]/wp[0]/lat");
apt = airportinfo(FMGCInternal.depApt);
dms = apt.lat;
degrees = int(dms);
minutes = sprintf("%.1f",abs((dms - degrees) * 60));
sign = degrees >= 0 ? "N" : "S";
@ -311,7 +315,7 @@ var updateArptLatLon = func {
setprop("/FMGC/internal/align-ref-lat-minutes", minutes);
setprop("/FMGC/internal/align-ref-lat-sign", sign);
#ref long
dms = getprop("/FMGC/flightplan[2]/wp[0]/lon");
dms = apt.lon;
degrees = int(dms);
minutes = sprintf("%.1f",abs((dms - degrees) * 60));
sign = degrees >= 0 ? "E" : "W";