A32X: Major WIP PFD Improvements

This commit is contained in:
Joshua Davidson 2017-11-15 21:41:36 -05:00
parent 780769a9c7
commit fdfe2a5cf9
7 changed files with 686 additions and 63 deletions

View file

@ -297,8 +297,11 @@
<binding>
<command>nasal</command>
<script>
setprop("/options/test-canvas", 1);
canvas_pfd.showPFD1();
if (getprop("/options/test-canvas") != 1) {
setprop("/options/test-canvas", 1);
} else {
setprop("/options/test-canvas", 0);
}
</script>
</binding>
</item>

View file

@ -152,7 +152,7 @@
<!-- Primary Flight Displays -->
<model>
<name>PFD1-WIP</name>
<name>PFD1</name>
<path>Aircraft/IDG-A32X/Models/Instruments/PFD-WIP/PFD1.xml</path>
<offsets>
<x-m>-0.55415</x-m>
@ -162,20 +162,6 @@
</offsets>
<condition>
<and>
<or>
<greater-than-equals>
<property>systems/electrical/bus/ac1</property>
<value>110</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/ac2</property>
<value>110</value>
</greater-than-equals>
</or>
<not-equals>
<property>modes/cpt-du-xfr</property>
<value>2</value>
</not-equals>
<equals>
<property>systems/acconfig/mismatch-code</property>
<value>0x000</value>
@ -209,10 +195,6 @@
<value>110</value>
</greater-than-equals>
</or>
<not-equals>
<property>modes/cpt-du-xfr</property>
<value>2</value>
</not-equals>
<equals>
<property>systems/acconfig/mismatch-code</property>
<value>0x000</value>
@ -255,6 +237,29 @@
</axis>
</animation>
<model>
<name>PFD2</name>
<path>Aircraft/IDG-A32X/Models/Instruments/PFD-WIP/PFD2.xml</path>
<offsets>
<x-m>-0.55415</x-m>
<y-m>0.5526</y-m>
<z-m>0.22256</z-m>
<pitch-deg>-16.534</pitch-deg>
</offsets>
<condition>
<and>
<equals>
<property>systems/acconfig/mismatch-code</property>
<value>0x000</value>
</equals>
<equals>
<property>options/test-canvas</property>
<value>1</value>
</equals>
</and>
</condition>
</model>
<model>
<name>PFD2</name>
<path>Aircraft/IDG-A32X/Models/Instruments/PFD/PFD2.xml</path>
@ -274,10 +279,6 @@
<property>systems/electrical/bus/ac2</property>
<value>25</value>
</greater-than-equals>
<not-equals>
<property>modes/fo-du-xfr</property>
<value>2</value>
</not-equals>
<not-equals>
<property>controls/electrical/switches/emer-gen</property>
<value>1</value>

View file

@ -6,7 +6,9 @@
#########################################
var PFD_1 = nil;
var PFD_display = nil;
var PFD_2 = nil;
var PFD1_display = nil;
var PFD2_display = nil;
setprop("/instrumentation/pfd/vs-needle", 0);
setprop("/instrumentation/pfd/vs-digit-trans", 0);
setprop("/it-autoflight/input/spd-managed", 0);
@ -17,6 +19,8 @@ setprop("/it-autoflight/output/fd1", 0);
setprop("/it-autoflight/output/fd2", 0);
setprop("/it-autoflight/output/athr", 0);
setprop("/instrumentation/pfd/horizon-pitch", 0);
setprop("/instrumentation/pfd/horizon-ground", 0);
setprop("/instrumentation/pfd/hdg-diff", 0);
setprop("/it-autoflight/internal/vert-speed-fpm-pfd", 0);
setprop("/position/gear-agl-ft", 0);
setprop("/controls/flight/aileron-input-fast", 0);
@ -80,6 +84,8 @@ var canvas_PFD_base = {
}
}
}
me.page = canvas_group;
me.AI_horizon_trans = me["AI_horizon"].createTransform();
me.AI_horizon_rot = me["AI_horizon"].createTransform();
@ -88,8 +94,9 @@ var canvas_PFD_base = {
me.AI_horizon_ground_rot = me["AI_horizon_ground"].createTransform();
me.AI_horizon_sky_rot = me["AI_horizon_sky"].createTransform();
me.page = canvas_group;
me.AI_horizon_hdg_trans = me["AI_heading"].createTransform();
me.AI_horizon_hdg_rot = me["AI_heading"].createTransform();
return me;
},
@ -103,6 +110,14 @@ var canvas_PFD_base = {
} else {
PFD_1.page.hide();
}
if (getprop("/systems/electrical/bus/ac1") >= 110 and getprop("/systems/electrical/ac1-src") != "RAT" and getprop("/systems/electrical/bus/ac2") >= 110 and getprop("/systems/electrical/ac2-src") != "RAT" and getprop("/options/test-canvas") == 1
and getprop("/controls/lighting/DU/du6") > 0) {
PFD_2.page.show();
PFD_2.update();
} else {
PFD_2.page.hide();
}
},
};
@ -116,8 +131,9 @@ var canvas_PFD_1 = {
getKeys: func() {
return ["FMA_man","FMA_manmode","FMA_flxtemp","FMA_thrust","FMA_lvrclb","FMA_pitch","FMA_pitcharm","FMA_pitcharm2","FMA_roll","FMA_rollarm","FMA_combined","FMA_ctr_msg","FMA_catmode","FMA_cattype","FMA_nodh","FMA_dh","FMA_dhn","FMA_ap","FMA_fd",
"FMA_athr","FMA_man_box","FMA_flx_box","FMA_thrust_box","FMA_pitch_box","FMA_pitcharm_box","FMA_roll_box","FMA_rollarm_box","FMA_combined_box","FMA_catmode_box","FMA_cattype_box","FMA_cat_box","FMA_dh_box","FMA_ap_box","FMA_fd_box","FMA_athr_box",
"FMA_Middle1","FMA_Middle2","ASI_scale","ASI_target","ASI_mach","ASI_mach_decimal","ASI_ten_sec","AI_center","AI_bank","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_agl_g","AI_agl","FD_roll","FD_pitch",
"ALT_digits","ALT_tens","VS_pointer","VS_box","VS_digit","QNH","QNH_setting","QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five","HDG_six","HDG_seven"];
"FMA_Middle1","FMA_Middle2","ASI_scale","ASI_target","ASI_mach","ASI_mach_decimal","ASI_ten_sec","AI_center","AI_bank","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading","AI_agl_g","AI_agl","FD_roll",
"FD_pitch","ALT_digits","ALT_tens","VS_pointer","VS_box","VS_digit","QNH","QNH_setting","QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","CRS_pointer","HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five",
"HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","TRK_pointer"];
},
update: func() {
state1 = getprop("/systems/thrust/state1");
@ -542,27 +558,514 @@ var canvas_PFD_1 = {
me["HDG_seven"].setText(sprintf("%d", me.rightText3));
me["HDG_one"].setText(sprintf("%d", me.leftText3));
if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") >= -23.62 and getprop("/instrumentation/pfd/hdg-diff") <= 23.62) {
me["HDG_target"].setTranslation((getprop("/instrumentation/pfd/hdg-diff") / 10) * 98.5416, 0);
me["HDG_digit_L"].hide();
me["HDG_digit_R"].hide();
me["HDG_target"].show();
} else if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") < -23.62 and getprop("/instrumentation/pfd/hdg-diff") >= -180) {
me["HDG_digit_L"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/hdg")));
me["HDG_digit_L"].show();
me["HDG_digit_R"].hide();
me["HDG_target"].hide();
} else if (getprop("/it-autoflight/custom/show-hdg") == 1 and getprop("/instrumentation/pfd/hdg-diff") > 23.62 and getprop("/instrumentation/pfd/hdg-diff") <= 180) {
me["HDG_digit_R"].setText(sprintf("%3.0f", getprop("/it-autoflight/input/hdg")));
me["HDG_digit_R"].show();
me["HDG_digit_L"].hide();
me["HDG_target"].hide();
} else {
me["HDG_digit_L"].hide();
me["HDG_digit_R"].hide();
me["HDG_target"].hide();
}
me["CRS_pointer"].hide();
me["TRK_pointer"].hide();
# AI HDG
me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, getprop("/instrumentation/pfd/horizon-pitch") * 11.825);
me.AI_horizon_hdg_rot.setRotation(-roll * D2R, me["AI_center"].getCenter());
me["AI_heading"].update();
},
};
var canvas_PFD_2 = {
new: func(canvas_group, file) {
var m = {parents: [canvas_PFD_2, canvas_PFD_base]};
m.init(canvas_group, file);
return m;
},
getKeys: func() {
return ["FMA_man","FMA_manmode","FMA_flxtemp","FMA_thrust","FMA_lvrclb","FMA_pitch","FMA_pitcharm","FMA_pitcharm2","FMA_roll","FMA_rollarm","FMA_combined","FMA_ctr_msg","FMA_catmode","FMA_cattype","FMA_nodh","FMA_dh","FMA_dhn","FMA_ap","FMA_fd",
"FMA_athr","FMA_man_box","FMA_flx_box","FMA_thrust_box","FMA_pitch_box","FMA_pitcharm_box","FMA_roll_box","FMA_rollarm_box","FMA_combined_box","FMA_catmode_box","FMA_cattype_box","FMA_cat_box","FMA_dh_box","FMA_ap_box","FMA_fd_box","FMA_athr_box",
"FMA_Middle1","FMA_Middle2","ASI_scale","ASI_target","ASI_mach","ASI_mach_decimal","ASI_ten_sec","AI_center","AI_bank","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading","AI_agl_g","AI_agl","FD_roll",
"FD_pitch","ALT_digits","ALT_tens","VS_pointer","VS_box","VS_digit","QNH","QNH_setting","QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","CRS_pointer","HDG_target","HDG_scale","HDG_one","HDG_two","HDG_three","HDG_four","HDG_five",
"HDG_six","HDG_seven","HDG_digit_L","HDG_digit_R","TRK_pointer"];
},
update: func() {
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
ap1 = getprop("/it-autoflight/output/ap1");
ap2 = getprop("/it-autoflight/output/ap2");
fd1 = getprop("/it-autoflight/output/fd1");
fd2 = getprop("/it-autoflight/output/fd2");
athr = getprop("/it-autoflight/output/athr");
throttle_mode = getprop("/modes/pfd/fma/throttle-mode");
pitch_mode = getprop("/modes/pfd/fma/pitch-mode");
pitch_mode_armed = getprop("/modes/pfd/fma/pitch-mode-armed");
pitch_mode2_armed = getprop("/modes/pfd/fma/pitch-mode2-armed");
roll_mode = getprop("/modes/pfd/fma/roll-mode");
roll_mode_armed = getprop("/modes/pfd/fma/roll-mode-armed");
thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
pitch = getprop("/orientation/pitch-deg");
roll = getprop("/orientation/roll-deg");
wow1 = getprop("/gear/gear[1]/wow");
wow2 = getprop("/gear/gear[2]/wow");
# FMA MAN TOGA MCT FLX THR
if (athr == 1 and (state1 == "TOGA" or state1 == "MCT" or state1 == "MAN THR" or state2 == "TOGA" or state2 == "MCT" or state2 == "MAN THR")) {
me["FMA_man"].show();
me["FMA_manmode"].show();
if (state1 == "TOGA" or state2 == "TOGA") {
me["FMA_flx_box"].hide();
me["FMA_flxtemp"].hide();
me["FMA_man_box"].show();
me["FMA_manmode"].setText("TOGA");
me["FMA_man_box"].setColor(0.8078,0.8039,0.8078);
} else if ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)) {
me["FMA_flx_box"].hide();
me["FMA_flxtemp"].hide();
me["FMA_man_box"].show();
me["FMA_manmode"].setText("THR");
me["FMA_man_box"].setColor(0.7333,0.3803,0);
} else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") != "FLX") {
me["FMA_flx_box"].hide();
me["FMA_flxtemp"].hide();
me["FMA_man_box"].show();
me["FMA_manmode"].setText("MCT");
me["FMA_man_box"].setColor(0.8078,0.8039,0.8078);
} else if ((state1 == "MCT" or state2 == "MCT") and getprop("/controls/engines/thrust-limit") == "FLX") {
me["FMA_flxtemp"].setText(sprintf("%s", "+" ~ getprop("/FMGC/internal/flex")));
me["FMA_man_box"].hide();
me["FMA_flx_box"].show();
me["FMA_flxtemp"].show();
me["FMA_manmode"].setText("FLX ");
me["FMA_man_box"].setColor(0.8078,0.8039,0.8078);
} else if ((state1 == "MAN THR" and thr1 < 0.83) or (state2 == "MAN THR" and thr2 < 0.83)) {
me["FMA_flx_box"].hide();
me["FMA_flxtemp"].hide();
me["FMA_man_box"].show();
me["FMA_manmode"].setText("THR");
me["FMA_man_box"].setColor(0.7333,0.3803,0);
}
} else {
me["FMA_man"].hide();
me["FMA_manmode"].hide();
me["FMA_man_box"].hide();
me["FMA_flx_box"].hide();
me["FMA_flxtemp"].hide();
}
if (athr == 1 and getprop("/systems/thrust/lvrclb") == 1) {
me["FMA_lvrclb"].show();
} else {
me["FMA_lvrclb"].hide();
}
# FMA A/THR
if (athr == 1 and ((state1 == "MAN" or state1 == "CL") and (state2 == "MAN" or state2 == "CL"))) {
me["FMA_thrust"].show();
if (getprop("/modes/pfd/fma/throttle-mode-box") == 1 and throttle_mode != " ") {
me["FMA_thrust_box"].show();
} else {
me["FMA_thrust_box"].hide();
}
} else {
me["FMA_thrust"].hide();
me["FMA_thrust_box"].hide();
}
me["FMA_thrust"].setText(sprintf("%s", throttle_mode));
# FMA Pitch Roll Common
me["FMA_combined"].setText(sprintf("%s", pitch_mode));
if (pitch_mode == "LAND" or pitch_mode == "FLARE" or pitch_mode == "ROLL OUT") {
me["FMA_pitch"].hide();
me["FMA_roll"].hide();
me["FMA_pitch_box"].hide();
me["FMA_roll_box"].hide();
me["FMA_pitcharm_box"].hide();
me["FMA_rollarm_box"].hide();
me["FMA_Middle1"].hide();
me["FMA_Middle2"].hide();
if (getprop("/it-fbw/law") == 2) {
me["FMA_ctr_msg"].setText("USE MAN PITCH TRIM");
me["FMA_ctr_msg"].setColor(0.7333,0.3803,0);
me["FMA_ctr_msg"].show();
} else if (getprop("/it-fbw/law") == 3) {
me["FMA_ctr_msg"].setText("MAN PITCH TRIM ONLY");
me["FMA_ctr_msg"].setColor(1,0,0);
me["FMA_ctr_msg"].show();
} else {
me["FMA_ctr_msg"].hide();
}
me["FMA_combined"].show();
if (getprop("/modes/pfd/fma/pitch-mode-box") == 1 and pitch_mode != " ") {
me["FMA_combined_box"].show();
} else {
me["FMA_combined_box"].hide();
}
} else {
me["FMA_combined"].hide();
me["FMA_combined_box"].hide();
if (getprop("/it-fbw/law") == 2) {
me["FMA_ctr_msg"].setText("USE MAN PITCH TRIM");
me["FMA_ctr_msg"].setColor(0.7333,0.3803,0);
me["FMA_Middle1"].hide();
me["FMA_Middle2"].show();
me["FMA_ctr_msg"].show();
} else if (getprop("/it-fbw/law") == 3) {
me["FMA_ctr_msg"].setText("MAN PITCH TRIM ONLY");
me["FMA_ctr_msg"].setColor(1,0,0);
me["FMA_Middle1"].hide();
me["FMA_Middle2"].show();
me["FMA_ctr_msg"].show();
} else {
me["FMA_ctr_msg"].hide();
me["FMA_Middle1"].show();
me["FMA_Middle2"].hide();
}
if (ap1 or ap2 or fd1 or fd2) {
me["FMA_pitch"].show();
me["FMA_roll"].show();
} else {
me["FMA_pitch"].hide();
me["FMA_roll"].hide();
}
if (getprop("/modes/pfd/fma/pitch-mode-box") == 1 and pitch_mode != " " and (ap1 or ap2 or fd1 or fd2)) {
me["FMA_pitch_box"].show();
} else {
me["FMA_pitch_box"].hide();
}
if (pitch_mode_armed == " " and pitch_mode2_armed == " ") {
me["FMA_pitcharm_box"].hide();
} else {
if ((getprop("/modes/pfd/fma/pitch-mode-armed-box") == 1 or getprop("/modes/pfd/fma/pitch-mode2-armed-box") == 1) and (ap1 or ap2 or fd1 or fd2)) {
me["FMA_pitcharm_box"].show();
} else {
me["FMA_pitcharm_box"].hide();
}
}
if (getprop("/modes/pfd/fma/roll-mode-box") == 1 and roll_mode != " " and (ap1 or ap2 or fd1 or fd2)) {
me["FMA_roll_box"].show();
} else {
me["FMA_roll_box"].hide();
}
if (getprop("/modes/pfd/fma/roll-mode-armed-box") == 1 and roll_mode_armed != " " and (ap1 or ap2 or fd1 or fd2)) {
me["FMA_rollarm_box"].show();
} else {
me["FMA_rollarm_box"].hide();
}
}
if (ap1 or ap2 or fd1 or fd2) {
me["FMA_pitcharm"].show();
me["FMA_pitcharm2"].show();
me["FMA_rollarm"].show();
} else {
me["FMA_pitcharm"].hide();
me["FMA_pitcharm2"].hide();
me["FMA_rollarm"].hide();
}
# FMA Pitch
me["FMA_pitch"].setText(sprintf("%s", pitch_mode));
me["FMA_pitcharm"].setText(sprintf("%s", pitch_mode_armed));
me["FMA_pitcharm2"].setText(sprintf("%s", pitch_mode2_armed));
# FMA Roll
me["FMA_roll"].setText(sprintf("%s", roll_mode));
me["FMA_rollarm"].setText(sprintf("%s", roll_mode_armed));
# FMA CAT DH
me["FMA_catmode"].hide();
me["FMA_cattype"].hide();
me["FMA_catmode_box"].hide();
me["FMA_cattype_box"].hide();
me["FMA_cat_box"].hide();
me["FMA_nodh"].hide();
me["FMA_dh_box"].hide();
# FMA AP FD ATHR
me["FMA_ap"].setText(sprintf("%s", getprop("/modes/pfd/fma/ap-mode")));
me["FMA_fd"].setText(sprintf("%s", getprop("/modes/pfd/fma/fd-mode")));
me["FMA_athr"].setText(sprintf("%s", getprop("/modes/pfd/fma/at-mode")));
if ((state1 == "MAN" or state1 == "CL") and (state2 == "MAN" or state2 == "CL")) {
me["FMA_athr"].setColor(0.8078,0.8039,0.8078);
} else {
me["FMA_athr"].setColor(0.0862,0.5176,0.6470);
}
if (getprop("/modes/pfd/fma/ap-mode-box") == 1 and getprop("/modes/pfd/fma/ap-mode") != " ") {
me["FMA_ap_box"].show();
} else {
me["FMA_ap_box"].hide();
}
if (getprop("/modes/pfd/fma/fd-mode-box") == 1 and getprop("/modes/pfd/fma/fd-mode") != " ") {
me["FMA_fd_box"].show();
} else {
me["FMA_fd_box"].hide();
}
if (getprop("/modes/pfd/fma/athr-mode-box") == 1 and getprop("/modes/pfd/fma/at-mode") != " ") {
me["FMA_athr_box"].show();
} else {
me["FMA_athr_box"].hide();
}
# Airspeed
# Subtract 30, since the scale starts at 30, but don't allow less than 0, or more than 420 situations
if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") <= 30) {
ASI = 0;
} else if (getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") >= 420) {
ASI = 390;
} else {
ASI = getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") - 30;
}
me["ASI_scale"].setTranslation(0, ASI * 6.6);
if (getprop("/instrumentation/airspeed-indicator/indicated-mach") >= 0.5) {
me["ASI_mach_decimal"].show();
me["ASI_mach"].show();
} else {
me["ASI_mach_decimal"].hide();
me["ASI_mach"].hide();
}
if (getprop("/instrumentation/airspeed-indicator/indicated-mach") >= 0.999) {
me["ASI_mach"].setText("999");
} else {
me["ASI_mach"].setText(sprintf("%3.0f", getprop("/instrumentation/airspeed-indicator/indicated-mach") * 1000));
}
if (getprop("/it-autoflight/input/spd-managed") == 1) {
me["ASI_target"].setColor(0.6901,0.3333,0.7450);
} else {
me["ASI_target"].setColor(0.0862,0.5176,0.6470);
}
if (getprop("/FMGC/internal/target-ias-pfd") <= 30) {
ASItrgt = 0 - ASI;
} else if (getprop("/FMGC/internal/target-ias-pfd") >= 420) {
ASItrgt = 390 - ASI;
} else {
ASItrgt = getprop("/FMGC/internal/target-ias-pfd") - 30 - ASI;
}
me["ASI_target"].setTranslation(0, ASItrgt * -6.6);
me["ASI_ten_sec"].hide();
# Attitude Indicator
pitch = getprop("/orientation/pitch-deg") or 0;
roll = getprop("/orientation/roll-deg") or 0;
me.AI_horizon_trans.setTranslation(0, pitch * 11.825);
me.AI_horizon_rot.setRotation(-roll * D2R, me["AI_center"].getCenter());
me.AI_horizon_ground_trans.setTranslation(0, getprop("/instrumentation/pfd/horizon-ground") * 11.825);
me.AI_horizon_ground_rot.setRotation(-roll * D2R, me["AI_center"].getCenter());
me.AI_horizon_sky_rot.setRotation(-roll * D2R, me["AI_center"].getCenter());
me["AI_slipskid"].setTranslation(getprop("/instrumentation/slip-skid-ball/indicated-slip-skid") * -15, 0);
me["AI_bank"].setRotation(-roll * D2R);
if (fd2 == 1 and ((!wow1 and !wow2 and roll_mode != " ") or roll_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) {
me["FD_roll"].show();
} else {
me["FD_roll"].hide();
}
if (fd2 == 1 and ((!wow1 and !wow2 and pitch_mode != " ") or pitch_mode != " ") and getprop("/it-autoflight/custom/trk-fpa") == 0 and pitch < 25 and pitch > -13 and roll < 45 and roll > -45) {
me["FD_pitch"].show();
} else {
me["FD_pitch"].hide();
}
if (getprop("/it-autoflight/fd/roll-bar") != nil) {
me["FD_roll"].setTranslation((getprop("/it-autoflight/fd/roll-bar")) * 2.2, 0);
}
if (getprop("/it-autoflight/fd/pitch-bar") != nil) {
me["FD_pitch"].setTranslation(0, -(getprop("/it-autoflight/fd/pitch-bar")) * 3.8);
}
me["AI_agl"].setText(sprintf("%s", math.round(getprop("/position/gear-agl-ft"))));
if (getprop("/position/gear-agl-ft") <= getprop("/instrumentation/mk-viii/inputs/arinc429/decision-height")) {
me["AI_agl"].setColor(0.7333,0.3803,0);
} else {
me["AI_agl"].setColor(0.0509,0.7529,0.2941);
}
if (getprop("/position/gear-agl-ft") <= 2500) {
me["AI_agl"].show();
} else {
me["AI_agl"].hide();
}
me["AI_agl_g"].setRotation(-roll * D2R);
if ((wow1 or wow2) and getprop("/FMGC/status/phase") != 0 and getprop("/FMGC/status/phase") != 1) {
me["AI_stick"].show();
me["AI_stick_pos"].show();
} else if ((wow1 or wow2) and (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) and (getprop("/engines/engine[0]/state") == 3 or getprop("/engines/engine[1]/state") == 3)) {
me["AI_stick"].show();
me["AI_stick_pos"].show();
} else {
me["AI_stick"].hide();
me["AI_stick_pos"].hide();
}
me["AI_stick_pos"].setTranslation(getprop("/controls/flight/aileron-input-fast") * 196.8, getprop("/controls/flight/elevator-input-fast") * 151.5);
# Altitude
me["ALT_digits"].setText(sprintf("%s", getprop("/instrumentation/altimeter/indicated-altitude-ft-pfd")));
altTens = num(right(sprintf("%02d", getprop("/instrumentation/altimeter/indicated-altitude-ft")), 2));
me["ALT_tens"].setTranslation(0, altTens * 1.392);
# QNH
if (getprop("/modes/altimeter/std") == 1) {
me["QNH"].hide();
me["QNH_setting"].hide();
me["QNH_std"].show();
me["QNH_box"].show();
} else if (getprop("/modes/altimeter/inhg") == 0) {
me["QNH_setting"].setText(sprintf("%4.0f", getprop("/instrumentation/altimeter/setting-hpa")));
me["QNH"].show();
me["QNH_setting"].show();
me["QNH_std"].hide();
me["QNH_box"].hide();
} else if (getprop("/modes/altimeter/inhg") == 1) {
me["QNH_setting"].setText(sprintf("%2.2f", getprop("/instrumentation/altimeter/setting-inhg")));
me["QNH"].show();
me["QNH_setting"].show();
me["QNH_std"].hide();
me["QNH_box"].hide();
}
# Vertical Speed
me["VS_pointer"].setRotation(getprop("/instrumentation/pfd/vs-needle") * D2R);
me["VS_box"].setTranslation(0, getprop("/instrumentation/pfd/vs-digit-trans"));
if (getprop("/it-autoflight/internal/vert-speed-fpm-pfd") < 2) {
me["VS_box"].hide();
} else {
me["VS_box"].show();
}
if (getprop("/it-autoflight/internal/vert-speed-fpm-pfd") < 10) {
me["VS_digit"].setText(sprintf("%s", "0" ~ getprop("/it-autoflight/internal/vert-speed-fpm-pfd")));
} else {
me["VS_digit"].setText(sprintf("%s", getprop("/it-autoflight/internal/vert-speed-fpm-pfd")));
}
# ILS
if (getprop("/modes/pfd/ILS2") == 1) {
me["LOC_scale"].show();
me["GS_scale"].show();
} else {
me["LOC_scale"].hide();
me["GS_scale"].hide();
}
if (getprop("/modes/pfd/ILS2") == 1 and getprop("/instrumentation/nav[0]/in-range") == 1 and getprop("/instrumentation/nav[0]/nav-loc") == 1) {
me["LOC_pointer"].show();
} else {
me["LOC_pointer"].hide();
}
if (getprop("/modes/pfd/ILS2") == 1 and getprop("/instrumentation/nav[0]/gs-in-range") == 1 and getprop("/instrumentation/nav[0]/has-gs") == 1) {
me["GS_pointer"].show();
} else {
me["GS_pointer"].hide();
}
me["LOC_pointer"].setTranslation(getprop("/instrumentation/nav[0]/heading-needle-deflection-norm") * 197, 0);
me["GS_pointer"].setTranslation(0, getprop("/instrumentation/nav[0]/gs-needle-deflection-norm") * -197);
# Heading
me.heading = getprop("/instrumentation/pfd/heading-deg");
me.headOffset = me.heading / 10 - int (me.heading / 10);
me.middleText = roundabout(me.heading / 10);
me.middleOffset = nil;
if(me.middleText == 36) {
me.middleText = 0;
}
me.leftText1 = me.middleText == 0?35:me.middleText - 1;
me.rightText1 = me.middleText == 35?0:me.middleText + 1;
me.leftText2 = me.leftText1 == 0?35:me.leftText1 - 1;
me.rightText2 = me.rightText1 == 35?0:me.rightText1 + 1;
me.leftText3 = me.leftText2 == 0?35:me.leftText2 - 1;
me.rightText3 = me.rightText2 == 35?0:me.rightText2 + 1;
if (me.headOffset > 0.5) {
me.middleOffset = -(me.headOffset-1) * 98.5416;
} else {
me.middleOffset = -me.headOffset * 98.5416;
}
me["HDG_scale"].setTranslation(me.middleOffset, 0);
me["HDG_scale"].update();
me["HDG_four"].setText(sprintf("%d", me.middleText));
me["HDG_five"].setText(sprintf("%d", me.rightText1));
me["HDG_three"].setText(sprintf("%d", me.leftText1));
me["HDG_six"].setText(sprintf("%d", me.rightText2));
me["HDG_two"].setText(sprintf("%d", me.leftText2));
me["HDG_seven"].setText(sprintf("%d", me.rightText3));
me["HDG_one"].setText(sprintf("%d", me.leftText3));
me["HDG_target"].setTranslation((getprop("/instrumentation/pfd/hdg-diff") / 10) * 98.5416, 0);
if (getprop("/it-autoflight/custom/show-hdg") == 1) {
me["HDG_target"].show();
} else {
me["HDG_target"].hide();
}
me["CRS_pointer"].hide();
me["TRK_pointer"].hide();
# AI HDG
me.AI_horizon_hdg_trans.setTranslation(me.middleOffset, getprop("/instrumentation/pfd/horizon-pitch") * 11.825);
me.AI_horizon_hdg_rot.setRotation(-roll * D2R, me["AI_center"].getCenter());
me["AI_heading"].update();
},
};
setprop("/testing", 0); # REMOVE WHEN PFD FINISHED
setlistener("sim/signals/fdm-initialized", func {
PFD_display = canvas.new({
"name": "PFD",
PFD1_display = canvas.new({
"name": "PFD1",
"size": [1024, 1024],
"view": [1024, 1024],
"mipmapping": 1
});
PFD_display.addPlacement({"node": "pfd1.screen"});
var group_pfd1 = PFD_display.createGroup();
PFD2_display = canvas.new({
"name": "PFD2",
"size": [1024, 1024],
"view": [1024, 1024],
"mipmapping": 1
});
PFD1_display.addPlacement({"node": "pfd1.screen"});
PFD2_display.addPlacement({"node": "pfd2.screen"});
var group_pfd1 = PFD1_display.createGroup();
var group_pfd2 = PFD2_display.createGroup();
PFD_1 = canvas_PFD_1.new(group_pfd1, "Aircraft/IDG-A32X/Models/Instruments/PFD-WIP/res/pfd.svg");
PFD_2 = canvas_PFD_2.new(group_pfd2, "Aircraft/IDG-A32X/Models/Instruments/PFD-WIP/res/pfd.svg");
PFD_update.start();
});
@ -573,7 +1076,12 @@ var PFD_update = maketimer(0.05, func {
var showPFD1 = func {
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(PFD_display);
dlg.setCanvas(PFD1_display);
}
var showPFD2 = func {
var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1);
dlg.setCanvas(PFD2_display);
}
var roundabout = func(x) {

View file

@ -8,7 +8,7 @@
<PropertyList>
<path>res/PFD1.ac</path>
<path>res/PFD2.ac</path>
<animation>
<type>scale</type>
@ -19,25 +19,25 @@
<animation>
<type>pick</type>
<object-name>pfd1.screen</object-name>
<object-name>pfd2.screen</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>canvas_pfd.showPFD1();</script>
<script>canvas_pfd.showPFD2();</script>
</binding>
</action>
</animation>
<animation>
<type>material</type>
<object-name>pfd1.screen</object-name>
<object-name>pfd2.screen</object-name>
<emission>
<red>1</red>
<green>1</green>
<blue>1</blue>
<factor-prop>controls/lighting/DU/du1</factor-prop>
<factor-prop>controls/lighting/DU/du6</factor-prop>
</emission>
</animation>

View file

@ -0,0 +1,4 @@
123.177
61.5885
98.5416 is 123.177 in 1024

View file

@ -22,7 +22,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@ -41,9 +41,9 @@
inkscape:window-height="1030"
id="namedview371"
showgrid="false"
inkscape:zoom="4"
inkscape:cx="651.96329"
inkscape:cy="66.473575"
inkscape:zoom="2"
inkscape:cx="435.84224"
inkscape:cy="184.55281"
inkscape:window-x="1592"
inkscape:window-y="-8"
inkscape:window-maximized="1"
@ -85,6 +85,14 @@
x="203.79523"
y="229.74361"
inkscape:label="#rect9211" />
<rect
inkscape:label="#rect9211"
y="229.74397"
x="207.51085"
height="562.93683"
width="481.22961"
id="AI_heading_clip"
style="opacity:0.46000001;fill:#ff00ff;fill-opacity:1;stroke:none;stroke-width:1.27696717;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<g
id="AI_horizon"
transform="translate(0,-97.082454)"
@ -1059,6 +1067,53 @@
d="m -193.7976,610.26868 1284.1095,0"
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.20000005;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
</g>
<g
transform="translate(-153.56239,-430.12536)"
inkscape:label="#g4743"
id="AI_heading">
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 306.19037,944.75532 0,12.35406"
id="path4712"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4732"
d="m 404.73197,944.75532 0,12.35406"
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 503.27357,944.75532 0,12.35406"
id="path4734"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4736"
d="m 601.81517,944.75532 0,12.35406"
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 700.35638,944.75532 0,12.35406"
id="path4746"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path4754"
d="m 798.89798,944.75532 0,12.35406"
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995403;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 897.43958,944.75532 0,12.35406"
id="path4756"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.4000001;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
id="rect4671"
@ -1130,9 +1185,9 @@
<rect
inkscape:label="#rect9211"
y="890.56866"
x="213.58055"
x="188.53055"
height="54.440548"
width="469.54053"
width="519.64056"
id="HDG_target_clip"
style="opacity:0.46000001;fill:#ff00ff;fill-opacity:1;stroke:none;stroke-width:1.27696717;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
@ -1162,18 +1217,11 @@
<rect
style="opacity:0.46000001;fill:#ff00ff;fill-opacity:1;stroke:none;stroke-width:1.27696717;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="ASI_target_clip"
width="34.79776"
width="37.982773"
height="551.97998"
x="126.04519"
x="122.8552"
y="237.04402"
inkscape:label="#rect9211" />
<path
inkscape:label="#rect902"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="ASI_target"
d="m 158.57701,491.12121 -1e-5,43.41526 -40.47717,-21.70763 z"
style="fill:none;fill-opacity:1;stroke:#1684a5;stroke-width:4;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<rect
style="fill:#4c4c4c;fill-opacity:1;stroke:none;stroke-width:2.4000001;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
id="ASI_grey"
@ -1185,9 +1233,9 @@
<rect
inkscape:label="#rect9211"
y="237.03366"
x="8.3654346"
x="8.3655996"
height="552.00073"
width="117.69082"
width="117.6912"
id="ASI_scale_clip"
style="opacity:0.46000001;fill:#ff00ff;fill-opacity:1;stroke:none;stroke-width:1.27696717;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
@ -1946,6 +1994,13 @@
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
<path
inkscape:label="#rect902"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="ASI_target"
d="m 158.57701,491.12121 -1e-5,43.41526 -40.47717,-21.70763 z"
style="fill:none;fill-opacity:1;stroke:#1684a5;stroke-width:4;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<g
id="ASI_index"
inkscape:label="#g949"
@ -3080,7 +3135,7 @@
y="885.26117"
x="907.61713"
id="tspan977"
sodipodi:role="line">STD</tspan></text>
sodipodi:role="line">1013</tspan></text>
<g
id="AI_agl_g"
inkscape:transform-center-y="245.55742"
@ -3359,14 +3414,14 @@
<rect
style="fill:#c9d121;fill-opacity:1;stroke:none;stroke-width:4.64450645;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="HDG_pointer"
width="7.7972808"
height="58.119724"
width="7.7972717"
height="53.319752"
x="443.85849"
y="902.20178"
y="907.00177"
inkscape:label="#rect4954" />
<path
style="fill:none;fill-opacity:1;stroke:#1684a5;stroke-width:4;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 426.05644,897.87034 43.41526,10e-6 -21.70763,40.47717 z"
d="m 426.05644,912.48947 43.41526,10e-6 -21.70763,40.47717 z"
id="HDG_target"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc"
@ -3400,4 +3455,30 @@
width="14.344484"
id="TRK_pointer"
style="fill:none;fill-opacity:1;stroke:#08b837;stroke-width:3.86463165;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:30.52176857px;line-height:1.25;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#1684a5;fill-opacity:1;stroke:none;stroke-width:0.75"
x="218.92215"
y="895.6087"
id="HDG_digit_L"
transform="scale(0.95383278,1.0484018)"
inkscape:label="#text975"><tspan
sodipodi:role="line"
id="tspan4386-5"
x="218.92215"
y="895.6087"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;text-anchor:start;fill:#1684a5;fill-opacity:1;stroke-width:0.75">000</tspan></text>
<text
inkscape:label="#text975"
transform="scale(0.95383443,1.0484)"
id="HDG_digit_R"
y="895.61029"
x="721.2049"
style="font-style:normal;font-weight:normal;font-size:30.52176857px;line-height:1.25;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#1684a5;fill-opacity:1;stroke:none;stroke-width:0.75"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;text-anchor:end;fill:#1684a5;fill-opacity:1;stroke-width:0.75"
y="895.61029"
x="721.2049"
id="tspan4786"
sodipodi:role="line">000</tspan></text>
</svg>

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 197 KiB

View file

@ -112,7 +112,7 @@
<update-interval-secs type="double">0.05</update-interval-secs>
<gain>1.0</gain>
<input>
<property>/it-autoflight/settings/heading-bug-deg</property>
<property>/it-autoflight/input/hdg</property>
<period>
<min>-180.0</min>
<max>180.0</max>
@ -407,12 +407,38 @@
<name>Horizon Heading Pitch</name>
<type>gain</type>
<gain>1</gain>
<enable>
<condition>
<not-equals>
<property>/options/test-canvas</property>
<value>1</value>
</not-equals>
</condition>
</enable>
<input>/orientation/pitch-deg</input>
<output>/instrumentation/pfd/horizon-pitch</output>
<min>-15</min>
<max>16</max>
</filter>
<filter>
<name>Horizon Heading Pitch</name>
<type>gain</type>
<gain>1</gain>
<enable>
<condition>
<equals>
<property>/options/test-canvas</property>
<value>1</value>
</equals>
</condition>
</enable>
<input>/orientation/pitch-deg</input>
<output>/instrumentation/pfd/horizon-pitch</output>
<min>-17.35</min>
<max>17.35</max>
</filter>
<filter>
<name>Vertical Speed Needle</name>
<type>gain</type>