From d92279b6fc3e00b530ebde2ddc916fbc5541e4e2 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 4 Aug 2021 17:17:35 +0100 Subject: [PATCH] Metric altitude --- Models/FlightDeck/a320.flightdeck.xml | 16 ++++++++ Models/Instruments/PFD/PFD.nas | 54 ++++++++++++++++++++++++-- Models/Instruments/PFD/res/pfd.svg | 56 ++++++++++++++++++++++++--- Nasal/FMGC/FCU.nas | 6 +++ 4 files changed, 124 insertions(+), 8 deletions(-) diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml index 8102b1b5..c312fea1 100644 --- a/Models/FlightDeck/a320.flightdeck.xml +++ b/Models/FlightDeck/a320.flightdeck.xml @@ -5591,6 +5591,22 @@ + + + pick + metric_alt + + + false + + nasal + + + + diff --git a/Models/Instruments/PFD/PFD.nas b/Models/Instruments/PFD/PFD.nas index 4fd4074b..956e118a 100644 --- a/Models/Instruments/PFD/PFD.nas +++ b/Models/Instruments/PFD/PFD.nas @@ -219,9 +219,9 @@ var canvas_PFD_base = { "FMA_athr_box","FMA_Middle1","FMA_Middle2","ALPHA_MAX","ALPHA_PROT","ALPHA_SW","ALPHA_bars","VLS_min","ASI_max","ASI_scale","ASI_target","ASI_mach","ASI_mach_decimal","ASI_trend_up","ASI_trend_down","ASI_digit_UP","ASI_digit_DN","ASI_decimal_UP", "ASI_decimal_DN","ASI_index","ASI_error","ASI_group","ASI_frame","AI_center","AI_bank","AI_bank_lim","AI_bank_lim_X","AI_pitch_lim","AI_pitch_lim_X","AI_slipskid","AI_horizon","AI_horizon_ground","AI_horizon_sky","AI_stick","AI_stick_pos","AI_heading", "AI_agl_g","AI_agl","AI_error","AI_group","FD_roll","FD_pitch","ALT_box_flash","ALT_box","ALT_box_amber","ALT_scale","ALT_target","ALT_target_digit","ALT_one","ALT_two","ALT_three","ALT_four","ALT_five","ALT_digits","ALT_tens","ALT_digit_UP", - "ALT_digit_DN","ALT_error","ALT_neg","ALT_group","ALT_group2","ALT_frame","VS_pointer","VS_box","VS_digit","VS_error","VS_group","QNH","QNH_setting","QNH_std","QNH_box","LOC_pointer","LOC_scale","GS_scale","GS_pointer","CRS_pointer","HDG_target","HDG_scale", + "ALT_digit_DN","ALT_digit_UP_metric","ALT_error","ALT_neg","ALT_group","ALT_group2","ALT_frame","VS_pointer","VS_box","VS_digit","VS_error","VS_group","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","HDG_error","HDG_group","HDG_frame","TRK_pointer","machError","ilsError","ils_code","ils_freq","dme_dist","dme_dist_legend","ILS_HDG_R","ILS_HDG_L", - "ILS_right","ILS_left","outerMarker","middleMarker","innerMarker","v1_group","v1_text","vr_speed","F_target","S_target","FS_targets","flap_max","clean_speed","ground","ground_ref","FPV","spdLimError","vsFMArate","tailstrikeInd"]; + "ILS_right","ILS_left","outerMarker","middleMarker","innerMarker","v1_group","v1_text","vr_speed","F_target","S_target","FS_targets","flap_max","clean_speed","ground","ground_ref","FPV","spdLimError","vsFMArate","tailstrikeInd","Metric_box","Metric_letter","Metric_cur_alt"]; }, off: 0, on: 0, @@ -346,6 +346,7 @@ var canvas_PFD_base = { PFD_2_mismatch.page.show(); } }, + showMetricAlt: 0, updateCommon: func () { # FMA MAN TOGA MCT FLX THR # Set properties used a lot to a variable to avoid calling getValue() multiple times @@ -1039,7 +1040,6 @@ var canvas_PFD_base = { me["QNH_std"].hide(); me["QNH_box"].hide(); } - }, # Get Angle of Attack from ADR1 or, depending on Switching panel, ADR3 @@ -1702,6 +1702,18 @@ var canvas_PFD_1 = { me["ALT_scale"].show(); me.altitude = dmc.DMController.DMCs[0].outputs[1].getValue(); + + if (me.showMetricAlt) { + me["Metric_box"].show(); + me["Metric_letter"].show(); + me["Metric_cur_alt"].show(); + me["Metric_cur_alt"].setText(sprintf("%5.0f", me.altitude * 0.3048)); + } else { + me["Metric_box"].hide(); + me["Metric_letter"].hide(); + me["Metric_cur_alt"].hide(); + } + me.altOffset = me.altitude / 500 - int(me.altitude / 500); me.middleAltText = roundaboutAlt(me.altitude / 100); me.middleAltOffset = nil; @@ -1729,6 +1741,14 @@ var canvas_PFD_1 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); + + if (me.showMetricAlt) { + me["ALT_digit_UP_metric"].show(); + me["ALT_digit_UP_metric"].setText(sprintf("%5.0fM", ap_alt_cur * 0.3048)); + } else { + me["ALT_digit_UP_metric"].hide(); + } + alt_diff_cur = dmc.DMController.DMCs[0].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); @@ -1838,6 +1858,10 @@ var canvas_PFD_1 = { me["ALT_box_flash"].hide(); me["ALT_box_amber"].hide(); me["ALT_box"].hide(); + me["Metric_box"].hide(); + me["Metric_letter"].hide(); + me["Metric_cur_alt"].hide(); + me["ALT_digit_UP_metric"].hide(); } me.updateCommon(); @@ -2474,6 +2498,18 @@ var canvas_PFD_2 = { me["ALT_scale"].show(); me.altitude = dmc.DMController.DMCs[1].outputs[1].getValue(); + + if (me.showMetricAlt) { + me["Metric_box"].show(); + me["Metric_letter"].show(); + me["Metric_cur_alt"].show(); + me["Metric_cur_alt"].setText(sprintf("%5.0f", me.altitude * 0.3048)); + } else { + me["Metric_box"].hide(); + me["Metric_letter"].hide(); + me["Metric_cur_alt"].hide(); + } + me.altOffset = me.altitude / 500 - int(me.altitude / 500); me.middleAltText = roundaboutAlt(me.altitude / 100); me.middleAltOffset = nil; @@ -2501,6 +2537,14 @@ var canvas_PFD_2 = { me["ALT_tens"].setTranslation(0, altTens * 1.392); ap_alt_cur = ap_alt.getValue(); + + if (me.showMetricAlt) { + me["ALT_digit_UP_metric"].show(); + me["ALT_digit_UP_metric"].setText(sprintf("%5.0fM", ap_alt_cur * 0.3048)); + } else { + me["ALT_digit_UP_metric"].hide(); + } + alt_diff_cur = dmc.DMController.DMCs[1].outputs[7].getValue(); if (alt_diff_cur >= -565 and alt_diff_cur <= 565) { me["ALT_target"].setTranslation(0, (alt_diff_cur / 100) * -48.66856); @@ -2610,6 +2654,10 @@ var canvas_PFD_2 = { me["ALT_box_flash"].hide(); me["ALT_box_amber"].hide(); me["ALT_box"].hide(); + me["Metric_box"].hide(); + me["Metric_letter"].hide(); + me["Metric_cur_alt"].hide(); + me["ALT_digit_UP_metric"].hide(); } me.updateCommon(); diff --git a/Models/Instruments/PFD/res/pfd.svg b/Models/Instruments/PFD/res/pfd.svg index 7eb9c07a..28c3d817 100644 --- a/Models/Instruments/PFD/res/pfd.svg +++ b/Models/Instruments/PFD/res/pfd.svg @@ -41,9 +41,9 @@ inkscape:window-maximized="1" inkscape:window-y="-8" inkscape:window-x="-8" - inkscape:cy="876.13786" - inkscape:cx="522.86542" - inkscape:zoom="5.6568542" + inkscape:cy="1074.3176" + inkscape:cx="955.3885" + inkscape:zoom="2" showgrid="true" id="namedview371" inkscape:window-height="705" @@ -2269,11 +2269,11 @@ id="QNH_setting" y="885.26117" x="907.61713" - style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#0dc04b;fill-opacity:1;stroke:none;stroke-width:0.75" + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#0dc04b;fill-opacity:1;stroke:none;stroke-width:0.75;stroke-opacity:1;" xml:space="preserve" transform="scale(1.0000144,0.9999856)" inkscape:label="#text979">-800 + + 11070 + M + 10000M diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 69196aa4..cbe4d337 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -460,6 +460,12 @@ var FCUController = { } } }, + MetricAlt: func() { + if (me.FCUworking) { + canvas_pfd.PFD_1.showMetricAlt = !canvas_pfd.PFD_1.showMetricAlt; + canvas_pfd.PFD_2.showMetricAlt = !canvas_pfd.PFD_2.showMetricAlt; + } + }, }; # Master / slave principle of operation depending on the autopilot / flight director engagement