Implement manual ILS mode
This commit is contained in:
parent
32b44374db
commit
a031c4b90e
1 changed files with 64 additions and 30 deletions
|
@ -117,6 +117,8 @@ var ils_data1 = props.globals.getNode("/FMGC/internal/ils1-mcdu/", 1);
|
|||
# var ils_data2 = props.globals.getNode("/FMGC/internal/ils2-mcdu/", 1);
|
||||
var dme_in_range = props.globals.getNode("/instrumentation/nav[0]/dme-in-range", 1);
|
||||
var dme_data = props.globals.getNode("/instrumentation/dme[0]/indicated-distance-nm", 1);
|
||||
var ils_crs = props.globals.getNode("/instrumentation/nav[0]/radials/selected-deg", 1);
|
||||
var ils1_crs_set = props.globals.getNode("/FMGC/internal/ils1crs-set/", 1);
|
||||
var arrival_airport = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
|
||||
|
||||
# Create Nodes:
|
||||
|
@ -769,42 +771,74 @@ var canvas_PFD_base = {
|
|||
|
||||
me["TRK_pointer"].setTranslation((track_diff.getValue() / 10) * 98.5416, 0);
|
||||
split_ils = split("/", ils_data1.getValue());
|
||||
if (ap_ils_mode.getValue() == 1 and arrival_airport.getValue() != "" and size(split_ils) == 2) {
|
||||
var runways = airportinfo(airportinfo(arrival_airport.getValue()).id).runways;
|
||||
var runway_keys = sort(keys(runways), string.icmp);
|
||||
foreach(var rwy; runway_keys) {
|
||||
var r = runways[rwy];
|
||||
if (r.ils_frequency_mhz == split_ils[1]) {
|
||||
magnetic_hdg = r.heading - getprop("/environment/magnetic-variation-deg");
|
||||
magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue());
|
||||
if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) {
|
||||
me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0);
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].show();
|
||||
} else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) {
|
||||
me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg)));
|
||||
me["ILS_HDG_L"].show();
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
} else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) {
|
||||
me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg)));
|
||||
me["ILS_HDG_R"].show();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
} else {
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#Secondary via RAD-NAV
|
||||
if (ap_ils_mode.getValue() == 1 and ils1_crs_set.getValue() == 1 and size(split_ils) == 2) {
|
||||
magnetic_hdg = ils_crs.getValue();
|
||||
magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue());
|
||||
if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) {
|
||||
me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0);
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].show();
|
||||
} else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) {
|
||||
me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg)));
|
||||
me["ILS_HDG_L"].show();
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
} else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) {
|
||||
me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg)));
|
||||
me["ILS_HDG_R"].show();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
} else {
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
}
|
||||
} else {
|
||||
me["ILS_HDG_R"].hide();
|
||||
me["ILS_HDG_L"].hide();
|
||||
me["CRS_pointer"].hide();
|
||||
}
|
||||
|
||||
# Primary via MCDU, not implemented yet
|
||||
# if (ap_ils_mode.getValue() == 1 and arrival_airport.getValue() != "" and size(split_ils) == 2) {
|
||||
# var runways = airportinfo(airportinfo(arrival_airport.getValue()).id).runways;
|
||||
# var runway_keys = sort(keys(runways), string.icmp);
|
||||
# foreach(var rwy; runway_keys) {
|
||||
# var r = runways[rwy];
|
||||
# if (r.ils_frequency_mhz == split_ils[1]) {
|
||||
# magnetic_hdg = r.heading - getprop("/environment/magnetic-variation-deg");
|
||||
# magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue());
|
||||
# if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) {
|
||||
# me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0);
|
||||
# me["ILS_HDG_R"].hide();
|
||||
# me["ILS_HDG_L"].hide();
|
||||
# me["CRS_pointer"].show();
|
||||
# } else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) {
|
||||
# me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg)));
|
||||
# me["ILS_HDG_L"].show();
|
||||
# me["ILS_HDG_R"].hide();
|
||||
# me["CRS_pointer"].hide();
|
||||
# } else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) {
|
||||
# me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg)));
|
||||
# me["ILS_HDG_R"].show();
|
||||
# me["ILS_HDG_L"].hide();
|
||||
# me["CRS_pointer"].hide();
|
||||
# } else {
|
||||
# me["ILS_HDG_R"].hide();
|
||||
# me["ILS_HDG_L"].hide();
|
||||
# me["CRS_pointer"].hide();
|
||||
# }
|
||||
# break;
|
||||
# }
|
||||
# }
|
||||
# } else {
|
||||
# me["ILS_HDG_R"].hide();
|
||||
# me["ILS_HDG_L"].hide();
|
||||
# me["CRS_pointer"].hide();
|
||||
# }
|
||||
|
||||
# AI HDG
|
||||
me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825);
|
||||
|
|
Loading…
Reference in a new issue