# Set properties used a lot to a variable to avoid calling getValue() multiple times
state1_act = state1.getValue();
state2_act = state2.getValue();
thrust_limit_act = thrust_limit.getValue();
alpha_floor_act = alpha_floor.getValue();
toga_lk_act = toga_lk.getValue();
thr1_act = thr1.getValue();
thr2_act = thr2.getValue();
if (athr.getValue() == 1 and (state1_act == "TOGA" or state1_act == "MCT" or state1_act == "MAN THR" or state2_act == "TOGA" or state2_act == "MCT" or state2_act == "MAN THR") and eng_out.getValue() != 1 and alpha_floor_act != 1 and
toga_lk_act != 1) {
me["FMA_man"].show();
me["FMA_manmode"].show();
if (state1_act == "TOGA" or state2_act == "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_act == "MAN THR" and thr1_act >= 0.83) or (state2_act == "MAN THR" and thr2_act >= 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_act == "MCT" or state2_act == "MCT") and thrust_limit_act != "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_act == "MCT" or state2_act == "MCT") and thrust_limit_act == "FLX") {
} else if ((state1_act == "MAN THR" and thr1_act < 0.83) or (state2_act == "MAN THR" and thr2_act < 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 (athr.getValue() == 1 and (state1_act == "TOGA" or (state1_act == "MCT" and thrust_limit_act == "FLX") or (state1_act == "MAN THR" and thr1_act >= 0.83) or state2_act == "TOGA" or (state2_act == "MCT" and
thrust_limit_act == "FLX") or (state2_act == "MAN THR" and thr2_act >= 0.83)) and eng_out.getValue() == 1 and alpha_floor_act != 1 and toga_lk_act != 1) {
me["FMA_man"].show();
me["FMA_manmode"].show();
if (state1_act == "TOGA" or state2_act == "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_act == "MAN THR" and thr1_act >= 0.83) or (state2_act == "MAN THR" and thr2_act >= 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_act == "MCT" or state2_act == "MCT") and thrust_limit_act == "FLX") {
if ((state1_act == "CL" and state2_act != "CL") or (state1_act != "CL" and state2_act == "CL") and eng_out.getValue() != 1) {
me["FMA_lvrclb"].setText("LVR ASYM");
} else {
if (eng_out.getValue() == 1) {
me["FMA_lvrclb"].setText("LVR MCT");
} else {
me["FMA_lvrclb"].setText("LVR CLB");
}
}
if (athr.getValue() == 1 and lvr_clb.getValue() == 1) {
me["FMA_lvrclb"].show();
} else {
me["FMA_lvrclb"].hide();
}
# FMA A/THR
if (alpha_floor_act != 1 and toga_lk_act != 1) {
if (athr.getValue() == 1 and eng_out.getValue() != 1 and (state1_act == "MAN" or state1_act == "CL") and (state2_act == "MAN" or state2_act == "CL")) {
me["FMA_thrust"].show();
if (throt_box.getValue() == 1 and throttle_mode.getValue() != " ") {
me["FMA_thrust_box"].show();
} else {
me["FMA_thrust_box"].hide();
}
} else if (athr.getValue() == 1 and eng_out.getValue() == 1 and (state1_act == "MAN" or state1_act == "CL" or (state1_act == "MAN THR" and thr1_act < 0.83) or (state1_act == "MCT" and thrust_limit_act != "FLX")) and
(state2_act == "MAN" or state2_act == "CL" or (state2_act == "MAN THR" and thr2_act < 0.83) or (state2_act == "MCT" and thrust_limit_act != "FLX"))) {
me["FMA_thrust"].show();
if (throt_box.getValue() == 1 and throttle_mode.getValue() != " ") {
if (pitch_mode_act == "LAND" or pitch_mode_act == "FLARE" or pitch_mode_act == "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 (fbw_curlaw == 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 (fbw_curlaw == 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 (pitch_box.getValue() == 1 and pitch_mode_act != " ") {
me["FMA_combined_box"].show();
} else {
me["FMA_combined_box"].hide();
}
} else {
me["FMA_combined"].hide();
me["FMA_combined_box"].hide();
if (fbw_curlaw == 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 (fbw_curlaw == 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.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1) {
me["FMA_pitch"].show();
me["FMA_roll"].show();
} else {
me["FMA_pitch"].hide();
me["FMA_roll"].hide();
}
if (pitch_box.getValue() == 1 and pitch_mode_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) {
me["FMA_pitch_box"].show();
} else {
me["FMA_pitch_box"].hide();
}
if (pitch_mode_armed_act == " " and pitch_mode2_armed_act == " ") {
me["FMA_pitcharm_box"].hide();
} else {
if ((pitch_mode_armed_box.getValue() == 1 or pitch_mode2_armed_box.getValue() == 1) and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) {
me["FMA_pitcharm_box"].show();
} else {
me["FMA_pitcharm_box"].hide();
}
}
if (roll_mode_box.getValue() == 1 and roll_mode_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) {
me["FMA_roll_box"].show();
} else {
me["FMA_roll_box"].hide();
}
if (roll_mode_armed_box.getValue() == 1 and roll_mode_armed_act != " " and (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1)) {
me["FMA_rollarm_box"].show();
} else {
me["FMA_rollarm_box"].hide();
}
}
if (ap1.getValue() == 1 or ap2.getValue() == 1 or fd1.getValue() == 1 or fd2.getValue() == 1) {
if ((wow1.getValue() == 1 or wow2.getValue() == 1) and FMGCphase_act != 0 and FMGCphase_act != 1) {
me["AI_stick"].show();
me["AI_stick_pos"].show();
} else if ((wow1.getValue() == 1 or wow2.getValue() == 1) and (FMGCphase_act == 0 or FMGCphase_act == 1) and (eng0_state.getValue() == 3 or eng1_state.getValue() == 3)) {
var m = {parents: [canvas_PFD_1, canvas_PFD_base]};
m.init(canvas_group, file);
return m;
},
update: func() {
fd1_act = fd1.getValue();
pitch_mode_cur = pitch_mode.getValue();
roll_mode_cur = roll_mode.getValue();
pitch_cur = pitch.getValue();
roll_cur = roll.getValue();
wow1_act = wow1.getValue();
wow2_act = wow2.getValue();
# Errors
if ((adirs0_active.getValue() == 1) or (air_switch.getValue() == -1 and adirs2_active.getValue() == 1)) {
me["ASI_group"].show();
me["ALT_group"].show();
me["ALT_group2"].show();
me["ALT_scale"].show();
me["VS_group"].show();
me["ASI_error"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ALT_error"].hide();
me["ALT_frame"].setColor(1,1,1);
me["VS_error"].hide();
} else {
me["ASI_error"].show();
me["ASI_frame"].setColor(1,0,0);
me["ALT_error"].show();
me["ALT_frame"].setColor(1,0,0);
me["VS_error"].show();
me["ASI_group"].hide();
me["ALT_group"].hide();
me["ALT_group2"].hide();
me["ALT_scale"].hide();
me["VS_group"].hide();
}
if ((ir0_aligned.getValue() == 1) or (ir2_aligned.getValue() == 1 and att_switch.getValue() == -1)) {
me["AI_group"].show();
me["HDG_group"].show();
me["AI_error"].hide();
me["HDG_error"].hide();
me["HDG_frame"].setColor(1,1,1);
} else {
me["AI_error"].show();
me["HDG_error"].show();
me["HDG_frame"].setColor(1,0,0);
me["AI_group"].hide();
me["HDG_group"].hide();
}
# FD
if (fd1_act == 1 and ((!wow1_act and !wow2_act and roll_mode_cur != " ") or roll_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) {
me["FD_roll"].show();
} else {
me["FD_roll"].hide();
}
if (fd1_act == 1 and ((!wow1_act and !wow2_act and pitch_mode_cur != " ") or pitch_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) {
me["FD_pitch"].show();
} else {
me["FD_pitch"].hide();
}
# ILS
if (ap_ils_mode.getValue() == 1) {
me["LOC_scale"].show();
me["GS_scale"].show();
} else {
me["LOC_scale"].hide();
me["GS_scale"].hide();
}
if (ap_ils_mode.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) {
me["LOC_pointer"].show();
} else {
me["LOC_pointer"].hide();
}
if (ap_ils_mode.getValue() == 1 and gs_in_range.getValue() == 1 and hasgs.getValue() == 1 and nav0_signalq.getValue() > 0.99) {
me["GS_pointer"].show();
} else {
me["GS_pointer"].hide();
}
me.updateCommon();
},
updateFast: func() {
me.updateCommonFast();
},
};
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;
},
update: func() {
fd2_act = fd2.getValue();
pitch_mode_cur = pitch_mode.getValue();
roll_mode_cur = roll_mode.getValue();
pitch_cur = pitch.getValue();
roll_cur = roll.getValue();
wow1_act = wow1.getValue();
wow2_act = wow2.getValue();
# Errors
if ((adirs1_active.getValue() == 1) or (air_switch.getValue() == 1 and adirs2_active.getValue() == 1)) {
me["ASI_group"].show();
me["ALT_group"].show();
me["ALT_group2"].show();
me["ALT_scale"].show();
me["VS_group"].show();
me["ASI_error"].hide();
me["ASI_frame"].setColor(1,1,1);
me["ALT_error"].hide();
me["ALT_frame"].setColor(1,1,1);
me["VS_error"].hide();
} else {
me["ASI_error"].show();
me["ASI_frame"].setColor(1,0,0);
me["ALT_error"].show();
me["ALT_frame"].setColor(1,0,0);
me["VS_error"].show();
me["ASI_group"].hide();
me["ALT_group"].hide();
me["ALT_group2"].hide();
me["ALT_scale"].hide();
me["VS_group"].hide();
}
if ((ir1_aligned.getValue() == 1) or (ir2_aligned.getValue() == 1 and att_switch.getValue() == 1)) {
me["AI_group"].show();
me["HDG_group"].show();
me["AI_error"].hide();
me["HDG_error"].hide();
me["HDG_frame"].setColor(1,1,1);
} else {
me["AI_error"].show();
me["HDG_error"].show();
me["HDG_frame"].setColor(1,0,0);
me["AI_group"].hide();
me["HDG_group"].hide();
}
# FD
if (fd2_act == 1 and ((!wow1_act and !wow2_act and roll_mode_cur != " ") or roll_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) {
me["FD_roll"].show();
} else {
me["FD_roll"].hide();
}
if (fd2_act == 1 and ((!wow1_act and !wow2_act and pitch_mode_cur != " ") or pitch_mode_cur != " ") and ap_trk_sw.getValue() == 0 and pitch_cur < 25 and pitch_cur > -13 and roll_cur < 45 and roll_cur > -45) {
me["FD_pitch"].show();
} else {
me["FD_pitch"].hide();
}
# ILS
if (ap_ils_mode2.getValue() == 1) {
me["LOC_scale"].show();
me["GS_scale"].show();
} else {
me["LOC_scale"].hide();
me["GS_scale"].hide();
}
if (ap_ils_mode2.getValue() == 1 and loc_in_range.getValue() == 1 and hasloc.getValue() == 1 and nav0_signalq.getValue() > 0.99) {
me["LOC_pointer"].show();
} else {
me["LOC_pointer"].hide();
}
if (ap_ils_mode2.getValue() == 1 and gs_in_range.getValue() == 1 and hasgs.getValue() == 1 and nav0_signalq.getValue() > 0.99) {