1
0
Fork 0

Implement manual ILS mode

This commit is contained in:
hayden2000 2020-02-04 08:15:08 -05:00
parent 32b44374db
commit a031c4b90e

View file

@ -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 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_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 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); var arrival_airport = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
# Create Nodes: # Create Nodes:
@ -769,36 +771,30 @@ var canvas_PFD_base = {
me["TRK_pointer"].setTranslation((track_diff.getValue() / 10) * 98.5416, 0); me["TRK_pointer"].setTranslation((track_diff.getValue() / 10) * 98.5416, 0);
split_ils = split("/", ils_data1.getValue()); 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; #Secondary via RAD-NAV
var runway_keys = sort(keys(runways), string.icmp); if (ap_ils_mode.getValue() == 1 and ils1_crs_set.getValue() == 1 and size(split_ils) == 2) {
foreach(var rwy; runway_keys) { magnetic_hdg = ils_crs.getValue();
var r = runways[rwy]; magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue());
if (r.ils_frequency_mhz == split_ils[1]) { if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) {
magnetic_hdg = r.heading - getprop("/environment/magnetic-variation-deg"); me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0);
magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue()); me["ILS_HDG_R"].hide();
if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) { me["ILS_HDG_L"].hide();
me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0); me["CRS_pointer"].show();
me["ILS_HDG_R"].hide(); } else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) {
me["ILS_HDG_L"].hide(); me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg)));
me["CRS_pointer"].show(); me["ILS_HDG_L"].show();
} else if (magnetic_hdg_dif < -23.62 and magnetic_hdg_dif >= -180) { me["ILS_HDG_R"].hide();
me["ILS_left"].setText(sprintf("%3.0f", int(magnetic_hdg))); me["CRS_pointer"].hide();
me["ILS_HDG_L"].show(); } else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) {
me["ILS_HDG_R"].hide(); me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg)));
me["CRS_pointer"].hide(); me["ILS_HDG_R"].show();
} else if (magnetic_hdg_dif > 23.62 and magnetic_hdg_dif <= 180) { me["ILS_HDG_L"].hide();
me["ILS_right"].setText(sprintf("%3.0f", int(magnetic_hdg))); me["CRS_pointer"].hide();
me["ILS_HDG_R"].show(); } else {
me["ILS_HDG_L"].hide(); me["ILS_HDG_R"].hide();
me["CRS_pointer"].hide(); me["ILS_HDG_L"].hide();
} else { me["CRS_pointer"].hide();
me["ILS_HDG_R"].hide();
me["ILS_HDG_L"].hide();
me["CRS_pointer"].hide();
}
break;
}
} }
} else { } else {
me["ILS_HDG_R"].hide(); me["ILS_HDG_R"].hide();
@ -806,6 +802,44 @@ var canvas_PFD_base = {
me["CRS_pointer"].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 # AI HDG
me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825); me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, horizon_pitch.getValue() * 11.825);
me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter()); me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter());