diff --git a/Models/Instruments/PFD-WIP/PFD.nas b/Models/Instruments/PFD-WIP/PFD.nas index 55187cd7..0e8ba5e2 100644 --- a/Models/Instruments/PFD-WIP/PFD.nas +++ b/Models/Instruments/PFD-WIP/PFD.nas @@ -117,7 +117,7 @@ var canvas_PFD_1 = { 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"]; + "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"]; }, update: func() { state1 = getprop("/systems/thrust/state1"); @@ -514,11 +514,39 @@ var canvas_PFD_1 = { me["GS_pointer"].setTranslation(0, getprop("/instrumentation/nav[0]/gs-needle-deflection-norm") * -197); # Heading -# if (getprop("/it-autoflight/custom/show-hdg") == 1) { -# me["HDG_target"].show(); -# } else { + 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)); + + if (getprop("/it-autoflight/custom/show-hdg") == 1) { + me["HDG_target"].show(); + } else { me["HDG_target"].hide(); -# } + } }, }; @@ -547,3 +575,8 @@ var showPFD1 = func { var dlg = canvas.Window.new([512, 512], "dialog").set("resize", 1); dlg.setCanvas(PFD_display); } + +var roundabout = func(x) { + var y = x - int(x); + return y < 0.5 ? int(x) : 1 + int(x) ; +}; diff --git a/Models/Instruments/PFD-WIP/res/pfd.svg b/Models/Instruments/PFD-WIP/res/pfd.svg index 38dabea7..67f0a517 100644 --- a/Models/Instruments/PFD-WIP/res/pfd.svg +++ b/Models/Instruments/PFD-WIP/res/pfd.svg @@ -22,7 +22,7 @@ image/svg+xml - + @@ -41,14 +41,14 @@ inkscape:window-height="1030" id="namedview371" showgrid="false" - inkscape:zoom="1.4142136" - inkscape:cx="641.32764" - inkscape:cy="629.48321" + inkscape:zoom="4" + inkscape:cx="651.96329" + inkscape:cy="66.473575" inkscape:window-x="1592" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="svg2" - showguides="false" + showguides="true" inkscape:snap-global="false" units="pt" fit-margin-top="0" @@ -1059,6 +1059,13 @@ 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" /> + - + + - - - - - - + + + + + 60 - - - - - + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.4000001;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.4000001;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> - + + + 00 + + 00 + + + + + 00 + 00 + 00 + + + + + + 00 + + + 00 + + + + + + + + + + diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index ea4fd644..b1663a54 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -268,6 +268,7 @@ var lateral = func { setprop("/it-autoflight/output/lat", 9); setprop("/it-autoflight/mode/lat", " "); setprop("/it-autoflight/mode/arm", " "); + setprop("/it-autoflight/custom/show-hdg", 1); } } diff --git a/Nasal/FMGC-c.nas b/Nasal/FMGC-c.nas index ea58bd25..b7a8d304 100644 --- a/Nasal/FMGC-c.nas +++ b/Nasal/FMGC-c.nas @@ -35,6 +35,7 @@ setprop("/modes/pfd/fma/roll-mode-armed-time", 0); setprop("/modes/pfd/fma/ap-mode-time", 0); setprop("/modes/pfd/fma/fd-mode-time", 0); setprop("/modes/pfd/fma/athr-mode-time", 0); +setprop("/modes/fcu/hdg-time", 0); setlistener("sim/signals/fdm-initialized", func { loopFMA.start(); @@ -141,52 +142,59 @@ var loopFMA = maketimer(0.05, func { } # Boxes - var boxtime = getprop("/sim/time/elapsed-sec"); - if (getprop("/modes/pfd/fma/ap-mode-time") + 10 >= boxtime) { + var elapsedtime = getprop("/sim/time/elapsed-sec"); + if (getprop("/modes/pfd/fma/ap-mode-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/ap-mode-box", 1); } else { setprop("/modes/pfd/fma/ap-mode-box", 0); } - if (getprop("/modes/pfd/fma/fd-mode-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/fd-mode-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/fd-mode-box", 1); } else { setprop("/modes/pfd/fma/fd-mode-box", 0); } - if (getprop("/modes/pfd/fma/athr-mode-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/athr-mode-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/athr-mode-box", 1); } else { setprop("/modes/pfd/fma/athr-mode-box", 0); } - if (getprop("/modes/pfd/fma/throttle-mode-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/throttle-mode-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/throttle-mode-box", 1); } else { setprop("/modes/pfd/fma/throttle-mode-box", 0); } - if (getprop("/modes/pfd/fma/roll-mode-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/roll-mode-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/roll-mode-box", 1); } else { setprop("/modes/pfd/fma/roll-mode-box", 0); } - if (getprop("/modes/pfd/fma/pitch-mode-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/pitch-mode-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/pitch-mode-box", 1); } else { setprop("/modes/pfd/fma/pitch-mode-box", 0); } - if (getprop("/modes/pfd/fma/roll-mode-armed-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/roll-mode-armed-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/roll-mode-armed-box", 1); } else { setprop("/modes/pfd/fma/roll-mode-armed-box", 0); } - if (getprop("/modes/pfd/fma/pitch-mode-armed-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/pitch-mode-armed-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/pitch-mode-armed-box", 1); } else { setprop("/modes/pfd/fma/pitch-mode-armed-box", 0); } - if (getprop("/modes/pfd/fma/pitch-mode2-armed-time") + 10 >= boxtime) { + if (getprop("/modes/pfd/fma/pitch-mode2-armed-time") + 10 >= elapsedtime) { setprop("/modes/pfd/fma/pitch-mode2-armed-box", 1); } else { setprop("/modes/pfd/fma/pitch-mode2-armed-box", 0); } + + # Preselect HDG + if (getprop("/modes/fcu/hdg-time") + 10 >= elapsedtime) { + setprop("/it-autoflight/custom/show-hdg", 1); + } else if (getprop("/it-autoflight/output/lat") != 0 and getprop("/it-autoflight/output/lat") != 5 and getprop("/it-autoflight/output/lat") != 9) { + setprop("/it-autoflight/custom/show-hdg", 0); + } }); var loopFMA_b = func { diff --git a/Nasal/buttons.nas b/Nasal/buttons.nas index 973d4bfb..b251702c 100644 --- a/Nasal/buttons.nas +++ b/Nasal/buttons.nas @@ -48,6 +48,7 @@ var variousReset = func { setprop("/controls/lighting/DU/du4", 1); setprop("/controls/lighting/DU/du5", 1); setprop("/controls/lighting/DU/du6", 1); + setprop("/modes/fcu/hdg-time", 0); } setlistener("/sim/signals/fdm-initialized", func { @@ -145,19 +146,6 @@ var CVR_master = func { } } -#setlistener("/it-autoflight/input/spd-kts", func { -# if (getprop("/it-autoflight/input/spd-kts") < getprop("/FMGC/internal/alpha-prot-speed")) { -# setprop("/it-autoflight/input/spd-kts", getprop("/FMGC/internal/alpha-prot-speed")); -# } -#}); - -#setlistener("/it-autoflight/input/spd-mach", func { -# var alphaProtMach = (getprop("/instrumentation/airspeed-indicator/indicated-mach") / getprop("/instrumentation/airspeed-indicator/indicated-speed-kt") * getprop("/FMGC/internal/alpha-prot-speed")); -# if (getprop("/it-autoflight/input/spd-mach") < alphaProtMach) { -# setprop("/it-autoflight/input/spd-mach", alphaProtMach); -# } -#}); - var mcpSPDKnbPull = func { setprop("/it-autoflight/input/spd-managed", 0); fmgc.ManagedSPD.stop(); @@ -192,35 +180,31 @@ var mcpSPDKnbPush = func { } var mcpHDGKnbPull = func { - var latmode = getprop("/it-autoflight/output/lat"); - var showhdg = getprop("/it-autoflight/custom/show-hdg"); - if (latmode == 0 or showhdg == 0) { - setprop("/it-autoflight/input/lat", 3); - setprop("/it-autoflight/custom/show-hdg", 1); - } else { - setprop("/it-autoflight/input/lat", 0); - setprop("/it-autoflight/custom/show-hdg", 1); + if (getprop("/it-autoflight/output/fd1") == 1 or getprop("/it-autoflight/output/fd2") == 1 or getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) { + var latmode = getprop("/it-autoflight/output/lat"); + var showhdg = getprop("/it-autoflight/custom/show-hdg"); + if (latmode == 0 or showhdg == 0) { + setprop("/it-autoflight/input/lat", 3); + setprop("/it-autoflight/custom/show-hdg", 1); + } else { + setprop("/it-autoflight/input/lat", 0); + setprop("/it-autoflight/custom/show-hdg", 1); + } } } -var mcpHDGKnbPush = func { - setprop("/it-autoflight/input/lat", 1); -} - var hdgInput = func { var latmode = getprop("/it-autoflight/output/lat"); if (latmode != 0) { setprop("/it-autoflight/custom/show-hdg", 1); var hdgnow = getprop("/it-autoflight/input/hdg"); - settimer(func { - var hdgnew = getprop("/it-autoflight/input/hdg"); - var showhdg = getprop("/it-autoflight/custom/show-hdg"); - if (hdgnow == hdgnew and latmode != 5 and showhdg == 1) { - settimer(func { - setprop("/it-autoflight/custom/show-hdg", 0); - }, 10); - } - }, 2); + setprop("/modes/fcu/hdg-time", getprop("/sim/time/elapsed-sec")); + } +} + +var mcpHDGKnbPush = func { + if (getprop("/it-autoflight/output/fd1") == 1 or getprop("/it-autoflight/output/fd2") == 1 or getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) { + setprop("/it-autoflight/input/lat", 1); } } diff --git a/Systems/pfd.xml b/Systems/pfd.xml index ec46aec8..86cff0b9 100644 --- a/Systems/pfd.xml +++ b/Systems/pfd.xml @@ -66,12 +66,6 @@ 0 instrumentation/pfd/heading-deg - - - /it-autoflight/output/lat - 0 - - @@ -90,12 +84,6 @@ 0 instrumentation/pfd/track-deg - - - /it-autoflight/output/lat - 0 - - @@ -116,12 +104,6 @@ instrumentation/pfd/heading-deg instrumentation/pfd/track-diff - - - /it-autoflight/output/vert - 5 - - @@ -148,15 +130,8 @@ -180.0 180.0 - - - /it-autoflight/output/lat - 0 - - - Localizer course diff gain