1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2020-10-20 01:23:00 +01:00
commit 26205d7bec
9 changed files with 242 additions and 32 deletions

View file

@ -479,6 +479,15 @@
<value>1</value>
</binding>
</item>
<item>
<label>Canvas QRH</label>
<binding>
<command>nasal</command>
<script>
canvas_qrh.createCanvasQRH();
</script>
</binding>
</item>
</menu>
</default>
</menubar>
@ -4403,6 +4412,9 @@
<canvas_qnh>
<file>Aircraft/A320-family/Nasal/Displays/CanvasQNH.nas</file>
</canvas_qnh>
<canvas_qrh>
<file>Aircraft/A320-family/Nasal/QRH/QRH.nas</file>
</canvas_qrh>
<mcdu_scratchpad> <!-- delay till after canvas mcdu -->
<file>Aircraft/A320-family/Nasal/FMGC/mcdu-messages.nas</file>
</mcdu_scratchpad>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View file

@ -15,6 +15,8 @@ var updateR = 0;
var et = 0;
var altTens = 0;
var altPolarity = "";
var track_diff = 0;
var AICenter = nil;
# Fetch nodes:
var state1 = props.globals.getNode("/systems/thrust/state1", 1);
@ -126,6 +128,16 @@ var inner_marker = props.globals.getNode("/instrumentation/marker-beacon/inner",
var flap_config = props.globals.getNode("/controls/flight/flaps-input", 1);
var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1);
var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1);
var aoa_1 = props.globals.getNode("/systems/navigation/adr/output/aoa-1", 1);
var aoa_2 = props.globals.getNode("/systems/navigation/adr/output/aoa-2", 1);
var aoa_3 = props.globals.getNode("/systems/navigation/adr/output/aoa-3", 1);
var adr_1_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-1", 1);
var adr_2_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-2", 1);
var adr_3_switch = props.globals.getNode("/controls/navigation/adirscp/switches/adr-3", 1);
var adr_1_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-1-fault", 1);
var adr_2_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-2-fault", 1);
var adr_3_fault = props.globals.getNode("/controls/navigation/adirscp/lights/adr-3-fault", 1);
var air_data_switch = props.globals.getNode("/controls/navigation/switching/air-data", 1);
# Create Nodes:
var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE");
@ -137,7 +149,7 @@ var horizon_ground = props.globals.initNode("/instrumentation/pfd/horizon-ground
var hdg_diff = props.globals.initNode("/instrumentation/pfd/hdg-diff", 0.0, "DOUBLE");
var hdg_scale = props.globals.initNode("/instrumentation/pfd/heading-scale", 0.0, "DOUBLE");
var track = props.globals.initNode("/instrumentation/pfd/track-deg", 0.0, "DOUBLE");
var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE");
#var track_diff = props.globals.initNode("/instrumentation/pfd/track-hdg-diff", 0.0, "DOUBLE"); # returns incorrect value
var du1_test = props.globals.initNode("/instrumentation/du/du1-test", 0, "BOOL");
var du1_test_time = props.globals.initNode("/instrumentation/du/du1-test-time", 0.0, "DOUBLE");
var du1_offtime = props.globals.initNode("/instrumentation/du/du1-off-time", 0.0, "DOUBLE");
@ -200,6 +212,9 @@ var canvas_PFD_base = {
me.AI_horizon_hdg_trans = me["AI_heading"].createTransform();
me.AI_horizon_hdg_rot = me["AI_heading"].createTransform();
me.AI_fpv_trans = me["FPV"].createTransform();
me.AI_fpv_rot = me["FPV"].createTransform();
me.page = canvas_group;
return me;
@ -212,7 +227,7 @@ var canvas_PFD_base = {
"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_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","spdLimError"];
"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"];
},
updateDu1: func() {
var elapsedtime_act = elapsedtime.getValue();
@ -961,12 +976,15 @@ var canvas_PFD_base = {
me["HDG_target"].hide();
}
me["TRK_pointer"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, 0);
var heading_deg = heading.getValue();
track_diff = geo.normdeg180(track.getValue() - heading_deg);
me["TRK_pointer"].setTranslation(me.getTrackDiffPixels(track_diff),0);
split_ils = split("/", ils_data1.getValue());
if (ap_ils_mode.getValue() == 1 and size(split_ils) == 2) {
magnetic_hdg = ils_crs.getValue();
magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading.getValue());
magnetic_hdg_dif = geo.normdeg180(magnetic_hdg - heading_deg);
if (magnetic_hdg_dif >= -23.62 and magnetic_hdg_dif <= 23.62) {
me["CRS_pointer"].setTranslation((magnetic_hdg_dif / 10) * 98.5416, 0);
me["ILS_HDG_R"].hide();
@ -1010,6 +1028,28 @@ var canvas_PFD_base = {
me.AI_horizon_hdg_rot.setRotation(-roll_cur * D2R, me["AI_center"].getCenter());
me["AI_heading"].update();
},
# Get Angle of Attack from ADR1 or, depending on Switching panel, ADR3
getAOAForPFD1: func() {
if (air_data_switch.getValue() != -1 and adr_1_switch.getValue() and !adr_1_fault.getValue()) return aoa_1.getValue();
if (air_data_switch.getValue() == -1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue();
return nil;
},
# Get Angle of Attack from ADR2 or, depending on Switching panel, ADR3
getAOAForPFD2: func() {
if (air_data_switch.getValue() != 1 and adr_2_switch.getValue() and !adr_2_fault.getValue()) return aoa_2.getValue();
if (air_data_switch.getValue() == 1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue();
return nil;
},
# Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs
# And set max and minimum values
getTrackDiffPixels: func(track_diff_deg) {
return ((math.clamp(track_diff_deg, -23.62, 23.62) / 10) * 98.5416);
},
};
var canvas_PFD_1 = {
@ -1087,6 +1127,26 @@ var canvas_PFD_1 = {
me["FD_pitch"].hide();
}
# If TRK FPA selected, display FPV on PFD1
if (ap_trk_sw.getValue() == 0 ) {
me["FPV"].hide();
} else {
var aoa = me.getAOAForPFD1();
if (aoa == nil or (systems.ADIRS.ADIRunits[0].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == -1)){
me["FPV"].hide();
} else {
var roll_deg = roll.getValue() or 0;
AICenter = me["AI_center"].getCenter();
var track_x_translation = me.getTrackDiffPixels(track_diff);
me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(aoa, -20, 20) * 12.5);
me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter);
me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be
me["FPV"].show();
}
}
# ILS
if (ap_ils_mode.getValue() == 1) {
me["LOC_scale"].show();
@ -1842,6 +1902,25 @@ var canvas_PFD_2 = {
me["FD_pitch"].hide();
}
# If TRK FPA selected, display FPV on PFD2
if (ap_trk_sw.getValue() == 0 ) {
me["FPV"].hide();
} else {
var aoa = me.getAOAForPFD2();
if (aoa == nil or (systems.ADIRS.ADIRunits[1].aligned != 1 and att_switch.getValue() == 0) or (systems.ADIRS.ADIRunits[2].aligned != 1 and att_switch.getValue() == 1)) {
me["FPV"].hide();
} else {
var roll_deg = roll.getValue() or 0;
AICenter = me["AI_center"].getCenter();
var track_x_translation = me.getTrackDiffPixels(track_diff);
me.AI_fpv_trans.setTranslation(track_x_translation, math.clamp(aoa, -20, 20) * 12.5);
me.AI_fpv_rot.setRotation(-roll_deg * D2R, AICenter);
me["FPV"].setRotation(roll_deg * D2R); # It shouldn't be rotated, only the axis should be
me["FPV"].show();
}
}
# ILS
if (ap_ils_mode2.getValue() == 1) {
me["LOC_scale"].show();

View file

@ -8,7 +8,7 @@
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="pfd.svg"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
id="svg2"
version="1.1"
viewBox="0 0 1024 1024"
@ -39,15 +39,15 @@
showguides="true"
inkscape:current-layer="svg2"
inkscape:window-maximized="1"
inkscape:window-y="-8"
inkscape:window-x="-8"
inkscape:cy="567.21927"
inkscape:cx="992.76655"
inkscape:zoom="1.0773413"
inkscape:window-y="18"
inkscape:window-x="3840"
inkscape:cy="557.03495"
inkscape:cx="619.57094"
inkscape:zoom="0.53867065"
showgrid="true"
id="namedview371"
inkscape:window-height="705"
inkscape:window-width="1366"
inkscape:window-height="1062"
inkscape:window-width="1920"
inkscape:pageshadow="2"
inkscape:pageopacity="1"
guidetolerance="10"
@ -1396,9 +1396,10 @@
<path
sodipodi:nodetypes="cccccccccccc"
inkscape:connector-curvature="0"
id="rect4760-1"
id="fixed_aircraft_outline_1"
d="m 279.39676,473.84829 20.67975,-1.3e-4 v 15.43882 0 l 1.8e-4,25.65723 h -15.4389 l -0.14628,-25.65723 v 0 l -81.2588,-5e-5 v -15.43891 l 76.16405,2.1e-4 z"
style="fill:none;fill-opacity:1;stroke:#c9d121;stroke-width:3.54375;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
style="fill:none;fill-opacity:1;stroke:#c9d121;stroke-width:3.54375;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:label="fixed_aircraft_outline_1" />
</g>
<g
id="g4856"
@ -1420,9 +1421,10 @@
<path
style="fill:none;fill-opacity:1;stroke:#c9d121;stroke-width:3.54375;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 279.39676,473.84829 20.67975,-1.3e-4 v 15.43882 0 l 1.8e-4,25.65723 h -15.4389 l -0.14628,-25.65723 v 0 l -81.2588,-5e-5 v -15.43891 l 76.16405,2.1e-4 z"
id="path4854"
id="fixed_aircraft_outline_2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccc" />
sodipodi:nodetypes="cccccccccccc"
inkscape:label="fixed_aircraft_outline_2" />
</g>
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
@ -2864,17 +2866,12 @@
</g>
<text
id="ALT_tens"
y="289.66925"
y="317.73038"
x="898.703"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0dc04b;fill-opacity:1;stroke:none;stroke-width:0.75"
xml:space="preserve"
inkscape:label="#text913"
transform="scale(0.96366556,1.0377044)"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:30.8364px;line-height:95%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#0dc04b;fill-opacity:1;stroke-width:0.75"
y="289.66925"
x="898.703"
id="tspan911"
sodipodi:role="line" /><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:30.8364px;line-height:87%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#0dc04b;fill-opacity:1;stroke-width:0.75"
y="317.73038"
x="898.703"
@ -6661,7 +6658,7 @@
id="spdLimError"
y="742.30011"
x="135.06754"
style="font-style:normal;font-weight:normal;font-size:30.00000191px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.75"
style="font-style:normal;font-weight:normal;font-size:30px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;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;line-height:0.5;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#ff0000;fill-opacity:1;stroke-width:0.75"
y="742.30011"
@ -6673,4 +6670,37 @@
x="135.06754"
sodipodi:role="line"
id="tspan1860">LIM</tspan></text>
<g
id="FPV"
inkscape:label="#g4866"
transform="matrix(1.1096488,0,0,1.1096488,-44.149294,-44.038907)">
<rect
transform="rotate(90)"
style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:4.32775;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4864"
width="11.546137"
height="4.3256927"
x="471.68945"
y="-445.96243" />
<path
style="fill:none;fill-opacity:1;stroke:#00ff00;stroke-width:4.32569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 461.34624,502.24844 c 0,9.69662 -7.86065,17.55727 -17.55727,17.55727 -9.69662,0 -17.55727,-7.86065 -17.55727,-17.55727 0,-9.69662 7.86065,-17.55727 17.55727,-17.55727 9.69662,0 17.55727,7.86065 17.55727,17.55727 z"
id="path4858"
inkscape:connector-curvature="0"
sodipodi:nodetypes="zzzzz" />
<rect
y="500.03757"
x="399.82227"
height="4.3256927"
width="25.012779"
id="rect4860"
style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:6.36979;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:6.36977;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4862"
width="25.012671"
height="4.3256927"
x="462.76437"
y="500.03757" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 369 KiB

94
Nasal/QRH/QRH.nas Normal file
View file

@ -0,0 +1,94 @@
# A3XX Canvas QRH
# Jonathan Redpath (legoboyvdlp)
# Copyright (c) 2020 Jonathan Redpath (legoboyvdlp)
var QRHpageNo = props.globals.initNode("/canvas/canvasQRH/page-number", 1, "INT");
var _pageNo = 1;
var _MAXPAGE = 3;
var width = 550;
var height = 625;
var QRH = nil;
var prevPage = func() {
_pageNo = QRHpageNo.getValue();
if (_pageNo == 1) { return; }
QRHpageNo.setValue(_pageNo - 1);
};
var nextPage = func() {
_pageNo = QRHpageNo.getValue();
if (_pageNo == _MAXPAGE) { return; }
QRHpageNo.setValue(_pageNo + 1);
};
var createCanvasQRH = func() {
var window = canvas.Window.new([width,height],"dialog")
.set("title","A320 QRH");
var qrhCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color"));
var root = qrhCanvas.createGroup();
var myHBox = canvas.HBoxLayout.new();
qrhCanvas.setLayout(myHBox);
QRH = canvas.gui.widgets.Label.new(root, canvas.style, {} )
.setImage("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg")
.move(0,-25)
.setSize(400,625);
myHBox.addItem(QRH);
var verticalGroup = canvas.VBoxLayout.new();
myHBox.addItem(verticalGroup);
var buttonInc = canvas.gui.widgets.Button.new(root, canvas.style, {})
.setText("Size Up")
.setFixedSize(75,25);
var buttonReset = canvas.gui.widgets.Button.new(root, canvas.style, {})
.setText("Reset Size")
.setFixedSize(75,25);
var buttonDec = canvas.gui.widgets.Button.new(root, canvas.style, {})
.setText("Size Down")
.setFixedSize(75,25);
var buttonPrev = canvas.gui.widgets.Button.new(root, canvas.style, {})
.setText("Prev Page")
.setFixedSize(75,25);
var buttonNext = canvas.gui.widgets.Button.new(root, canvas.style, {})
.setText("Next Page")
.setFixedSize(75,25);
buttonInc.listen("clicked", func {
width = width * 1.10;
height = height * 1.10;
window.setSize(width, height);
});
buttonReset.listen("clicked", func {
width = 550;
height = 650;
window.setSize(width, height);
});
buttonDec.listen("clicked", func {
width = width * 0.91;
height = height * 0.91;
window.setSize(width, height);
});
buttonPrev.listen("clicked", func {
prevPage();
QRH.setImage("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg");
});
buttonNext.listen("clicked", func {
nextPage();
QRH.setImage("Aircraft/A320-family/Models/FlightDeck/QRH/" ~ QRHpageNo.getValue() ~ ".jpeg");
});
verticalGroup.addItem(buttonInc);
verticalGroup.addItem(buttonReset);
verticalGroup.addItem(buttonDec);
verticalGroup.addItem(buttonPrev);
verticalGroup.addItem(buttonNext);
}

View file

@ -1600,13 +1600,6 @@
</test>
</switch>
<switch name="/systems/electrical/relay/dc-ess-shed-switch/output">
<default value="0"/>
<test value="/systems/electrical/bus/dc-ess">
/systems/electrical/relay/dc-ess-shed-switch/contact-pos eq 1
</test>
</switch>
<!-- DC Service Bus -->
<switch name="/systems/electrical/relay/dc-svc-bus-contactor-tr/contact-pos"> <!-- TODO: via 1PX CB on 124VU -->
<default value="0"/>
@ -1806,7 +1799,7 @@
<pure_gain name="/systems/electrical/bus/dc-ess-shed">
<input>/systems/electrical/bus/dc-ess</input>
<gain>1</gain>
<gain>/systems/electrical/relay/dc-ess-shed-switch/contact-pos</gain>
</pure_gain>
<!-- Hot Buses -->

View file

@ -768,7 +768,9 @@
/consumables/fuel/tank[3]/level-norm lt 0.9999
</test>
</switch>
</channel>
<channel name="Final Flow Rates">
<summer name="/systems/fuel/internal/left-outer-flow-rate">
<input>/systems/fuel/internal/left-outer-wing-tank-refuel</input>
<input>-/systems/fuel/internal/left-wing-outer-to-inner-tank</input>