Proper mda/dh implementation
This commit is contained in:
parent
bf68dbf4d4
commit
04ee431d13
2 changed files with 128 additions and 49 deletions
|
@ -167,6 +167,7 @@ var altFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/al
|
|||
var altFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/alt-flash-2", 0, "BOOL");
|
||||
var amberFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-1", 0, "BOOL");
|
||||
var amberFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-2", 0, "BOOL");
|
||||
var dhFlash = props.globals.initNode("/instrumentation/pfd/flash-indicators/dh-flash", 0, "BOOL");
|
||||
|
||||
var canvas_PFD_base = {
|
||||
init: func(canvas_group, file) {
|
||||
|
@ -754,58 +755,119 @@ var canvas_PFD_base = {
|
|||
|
||||
me["AI_agl"].setText(sprintf("%s", math.round(math.clamp(gear_agl_cur, 0, 2500))));
|
||||
|
||||
if (gear_agl_cur <= 2500) {
|
||||
me["AI_agl"].show();
|
||||
me["FMA_dh_box"].hide(); #not implemented
|
||||
me["dhReached"].hide(); #not implemented
|
||||
if (getprop("FMGC/internal/radio") != -1) {
|
||||
me["FMA_dh"].setText("DH");
|
||||
me["FMA_dh"].show();
|
||||
me["FMA_dhn"].setText(sprintf("%.0f", getprop("FMGC/internal/radio")));
|
||||
me["FMA_dhn"].show();
|
||||
me["FMA_nodh"].hide();
|
||||
if (gear_agl_cur <= getprop("FMGC/internal/radio") + 100) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
} else if (getprop("FMGC/internal/baro") != -1) {
|
||||
me["FMA_dh"].setText("MDA");
|
||||
me["FMA_dh"].show();
|
||||
me["FMA_dhn"].setText(sprintf("%.0f", getprop("FMGC/internal/radio")));
|
||||
me["FMA_dhn"].show();
|
||||
me["FMA_nodh"].hide();
|
||||
if (gear_agl_cur <= getprop("FMGC/internal/baro") + 100) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
} else if (getprop("FMGC/internal/radio-no")) {
|
||||
me["FMA_dh"].setText("DH");
|
||||
me["FMA_dh"].show();
|
||||
me["FMA_dhn"].setText("100");
|
||||
me["FMA_dhn"].show();
|
||||
me["FMA_nodh"].hide();
|
||||
if (gear_agl_cur <= 100) {
|
||||
if (FMGCphase.getValue() < 3) {
|
||||
me["FMA_dh_box"].hide();
|
||||
me["FMA_dh"].hide();
|
||||
me["FMA_dhn"].hide();
|
||||
me["FMA_nodh"].hide();
|
||||
me["dhReached"].hide();
|
||||
if (gear_agl_cur <= 2500) {
|
||||
me["AI_agl"].show();
|
||||
if (gear_agl_cur <= decision.getValue()) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
} else {
|
||||
me["FMA_dh"].hide();
|
||||
me["FMA_dhn"].hide();
|
||||
me["FMA_nodh"].show();
|
||||
if (gear_agl_cur <= 400) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
me["AI_agl"].hide();
|
||||
}
|
||||
} else {
|
||||
me["AI_agl"].hide();
|
||||
me["FMA_nodh"].hide();
|
||||
me["FMA_dh_box"].hide();
|
||||
me["dhReached"].hide();
|
||||
if (gear_agl_cur <= 2500) {
|
||||
me["AI_agl"].show();
|
||||
me["FMA_dh_box"].hide(); #not implemented
|
||||
if (getprop("FMGC/internal/radio") != -1) {
|
||||
me["FMA_dh"].setText("DH");
|
||||
me["FMA_dh"].show();
|
||||
me["FMA_dhn"].setText(sprintf("%.0f", getprop("FMGC/internal/radio")));
|
||||
me["FMA_dhn"].show();
|
||||
me["FMA_nodh"].hide();
|
||||
if (gear_agl_cur <= getprop("FMGC/internal/radio") + 100) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
me["dhReached"].hide();
|
||||
# if (gear_agl_cur <= getprop("FMGC/internal/radio")) {
|
||||
# if (dh_going == 0) {
|
||||
# dh_going = 1;
|
||||
# }
|
||||
# if (dh_going == 1) {
|
||||
# dhTimer.start();
|
||||
# if (dhFlash.getValue() == 1) {
|
||||
# me["dhReached"].show();
|
||||
# } else {
|
||||
# me["dhReached"].hide();
|
||||
# }
|
||||
# }
|
||||
# if (dh_going == -1) {
|
||||
# me["dhReached"].show();
|
||||
# }
|
||||
# } else {
|
||||
# dhTimer.stop();
|
||||
# dh_going = 0;
|
||||
# me["dhReached"].hide();
|
||||
# }
|
||||
} else if (getprop("FMGC/internal/baro") != -1) {
|
||||
me["FMA_dh"].setText("MDA");
|
||||
me["FMA_dh"].show();
|
||||
me["FMA_dhn"].setText(sprintf("%.0f", getprop("FMGC/internal/radio")));
|
||||
me["FMA_dhn"].show();
|
||||
me["FMA_nodh"].hide();
|
||||
if (gear_agl_cur <= getprop("FMGC/internal/baro") + 100) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
me["dhReached"].hide();
|
||||
} else if (getprop("FMGC/internal/radio-no")) {
|
||||
me["FMA_dh"].setText("DH");
|
||||
me["FMA_dh"].show();
|
||||
me["FMA_dhn"].setText("100");
|
||||
me["FMA_dhn"].show();
|
||||
me["FMA_nodh"].hide();
|
||||
if (gear_agl_cur <= 100) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
me["dhReached"].hide();
|
||||
# if (gear_agl_cur <= getprop("FMGC/internal/radio")) {
|
||||
# if (dh_going == 0) {
|
||||
# dh_going = 1;
|
||||
# }
|
||||
# if (dh_going == 1) {
|
||||
# dhTimer.start();
|
||||
# if (dhFlash.getValue() == 1) {
|
||||
# me["dhReached"].show();
|
||||
# } else {
|
||||
# me["dhReached"].hide();
|
||||
# }
|
||||
# }
|
||||
# if (dh_going == -1) {
|
||||
# me["dhReached"].show();
|
||||
# }
|
||||
# } else {
|
||||
# dhTimer.stop();
|
||||
# dh_going = 0;
|
||||
# me["dhReached"].hide();
|
||||
# }
|
||||
} else {
|
||||
me["FMA_dh"].hide();
|
||||
me["FMA_dhn"].hide();
|
||||
me["FMA_nodh"].show();
|
||||
if (gear_agl_cur <= 400) {
|
||||
me["AI_agl"].setColor(0.7333,0.3803,0);
|
||||
} else {
|
||||
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
|
||||
}
|
||||
me["dhReached"].hide();
|
||||
}
|
||||
} else {
|
||||
me["AI_agl"].hide();
|
||||
me["FMA_nodh"].hide();
|
||||
me["FMA_dh_box"].hide();
|
||||
me["dhReached"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
me["AI_agl_g"].setRotation(-roll_cur * D2R);
|
||||
|
@ -2675,3 +2737,18 @@ var amberTimer2 = maketimer(0.50, func {
|
|||
}
|
||||
});
|
||||
|
||||
var dh_going = 0;
|
||||
var dh_count = 0;
|
||||
var dhTimer = maketimer(0.50, func {
|
||||
if (!dhFlash.getBoolValue()) {
|
||||
dhFlash.setBoolValue(1);
|
||||
} else {
|
||||
dhFlash.setBoolValue(0);
|
||||
}
|
||||
if (dh_count == 18) {
|
||||
dh_count = 0;
|
||||
} else {
|
||||
dh_count = dh_count + 1;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -469,9 +469,9 @@ var masterFMGC = maketimer(0.2, func {
|
|||
|
||||
#handle radios, runways, v1/vr/v2
|
||||
if (fmgc.flightPlanController.flightplans[2].approach != nil and phase >= 2) {
|
||||
var airport = airportinfo(getprop("FMGC/internal/arr-arpt")).id;
|
||||
var airport = airportinfo(getprop("FMGC/internal/arr-arpt"));
|
||||
setprop("FMGC/internal/ldg-elev", airport.elevation * M2FT);
|
||||
var runways = airportinfo(airport).runways;
|
||||
var runways = airportinfo(airport.id).runways;
|
||||
var rwy = string.replace(fmgc.flightPlanController.flightplans[2].approach.id, "ILS", "");
|
||||
if (runways[rwy] != nil) {
|
||||
var r = runways[rwy];
|
||||
|
@ -482,12 +482,13 @@ var masterFMGC = maketimer(0.2, func {
|
|||
#print(r.heading);
|
||||
#print(r.stopway);
|
||||
#print(r.threshold);
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
magnetic_hdg = geo.normdeg(r.heading - getprop("environment/magnetic-variation-deg"));
|
||||
if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
} else if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set")) {
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
|
||||
} else if (!getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
|
@ -498,12 +499,13 @@ var masterFMGC = maketimer(0.2, func {
|
|||
var rwy = fmgc.flightPlanController.flightplans[2].departure_runway.id;
|
||||
if (runways[rwy] != nil) {
|
||||
var r = runways[rwy];
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
magnetic_hdg = geo.normdeg(r.heading - getprop("environment/magnetic-variation-deg"));
|
||||
if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set") and !getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
} else if (r.ils_frequency_mhz != nil and !getprop("FMGC/internal/ils1freq-set")) {
|
||||
setprop("FMGC/internal/ils1freq-calculated", r.ils_frequency_mhz);
|
||||
setprop("instrumentation/nav[0]/frequencies/selected-mhz", r.ils_frequency_mhz);
|
||||
} else if (!getprop("FMGC/internal/ils1crs-set")) {
|
||||
setprop("instrumentation/nav[0]/radials/selected-deg", magnetic_hdg);
|
||||
|
|
Loading…
Reference in a new issue