1
0
Fork 0

PFD: fix bugs

This commit is contained in:
Jonathan Redpath 2022-05-03 16:19:17 +01:00
parent 12e7258f23
commit 6aac392eec
2 changed files with 49 additions and 43 deletions

View file

@ -234,10 +234,10 @@ var canvas_pfd = {
obj["VS_box"].show(); obj["VS_box"].show();
} }
}), }),
props.UpdateManager.FromHashValue("localizer", 0.01, func(val) { props.UpdateManager.FromHashValue("localizer", 0.0025, func(val) {
obj["LOC_pointer"].setTranslation(val * 197, 0); obj["LOC_pointer"].setTranslation(val * 197, 0);
}), }),
props.UpdateManager.FromHashValue("glideslope", 0.01, func(val) { props.UpdateManager.FromHashValue("glideslope", 0.0025, func(val) {
obj["GS_pointer"].setTranslation(0, val * -197); obj["GS_pointer"].setTranslation(0, val * -197);
}), }),
props.UpdateManager.FromHashList(["athr", "thrustLvrClb"], 1, func(val) { props.UpdateManager.FromHashList(["athr", "thrustLvrClb"], 1, func(val) {
@ -331,7 +331,7 @@ var canvas_pfd = {
} }
}), }),
props.UpdateManager.FromHashList(["apBox","apMode"], nil, func(val) { props.UpdateManager.FromHashList(["apBox","apMode"], nil, func(val) {
obj["FMA_athr"].setText(val.apMode); obj["FMA_ap"].setText(val.apMode);
if (val.apBox and val.apMode != " ") { if (val.apBox and val.apMode != " ") {
obj["FMA_ap_box"].show(); obj["FMA_ap_box"].show();
} else { } else {
@ -692,7 +692,7 @@ var canvas_pfd = {
obj["QNH_setting"].setText(sprintf("%2.2f", val.altimeterInhg)); obj["QNH_setting"].setText(sprintf("%2.2f", val.altimeterInhg));
} }
}), }),
props.UpdateManager.FromHashList(["altimeterStd","altitudeAutopilot"], 25, func(val) { props.UpdateManager.FromHashList(["altimeterStd","altitudeAutopilot"], 1, func(val) {
if (val.altimeterStd == 1) { if (val.altimeterStd == 1) {
if (val.altitudeAutopilot < 10000) { if (val.altitudeAutopilot < 10000) {
obj["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ val.altitudeAutopilot / 100)); obj["ALT_digit_UP"].setText(sprintf("%s", "FL " ~ val.altitudeAutopilot / 100));
@ -1219,36 +1219,42 @@ var canvas_pfd = {
obj["Metric_cur_alt"].hide(); obj["Metric_cur_alt"].hide();
} }
}), }),
props.UpdateManager.FromHashValue("altitudePFD", 0.5, func(val) { props.UpdateManager.FromHashList(["altitudePFD","altError"], 0.5, func(val) {
obj["Metric_cur_alt"].setText(sprintf("%5.0f", val * 0.3048)); if (!val.altError) {
obj["Metric_cur_alt"].setText(sprintf("%5.0f", val.altitudePFD * 0.3048));
obj.middleAltText = roundaboutAlt(val / 100);
obj.middleAltText = roundaboutAlt(val.altitudePFD / 100);
obj["ALT_five"].setText(sprintf("%03d", abs(obj.middleAltText + 10)));
obj["ALT_four"].setText(sprintf("%03d", abs(obj.middleAltText + 5))); obj["ALT_five"].setText(sprintf("%03d", abs(obj.middleAltText + 10)));
obj["ALT_three"].setText(sprintf("%03d", abs(obj.middleAltText))); obj["ALT_four"].setText(sprintf("%03d", abs(obj.middleAltText + 5)));
obj["ALT_two"].setText(sprintf("%03d", abs(obj.middleAltText - 5))); obj["ALT_three"].setText(sprintf("%03d", abs(obj.middleAltText)));
obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText - 10))); obj["ALT_two"].setText(sprintf("%03d", abs(obj.middleAltText - 5)));
obj["ALT_one"].setText(sprintf("%03d", abs(obj.middleAltText - 10)));
if (val < 0) {
obj["ALT_neg"].show(); if (val.altitudePFD < 0) {
obj["ALT_neg"].show();
} else {
obj["ALT_neg"].hide();
}
} else { } else {
obj["ALT_neg"].hide(); obj["ALT_neg"].hide();
} }
}), }),
props.UpdateManager.FromHashValue("altitudePFD", 0.1, func(val) { props.UpdateManager.FromHashList(["altitudePFD","altError"], 0.1, func(val) {
obj.altOffset = val / 500 - int(val / 500); if (!val.altError) {
obj.middleAltOffset = nil; obj.altOffset = val / 500 - int(val.altitudePFD / 500);
obj.middleAltOffset = nil;
if (obj.altOffset > 0.5) {
obj.middleAltOffset = -(obj.altOffset - 1) * 243.3424; if (obj.altOffset > 0.5) {
} else { obj.middleAltOffset = -(obj.altOffset - 1) * 243.3424;
obj.middleAltOffset = -obj.altOffset * 243.3424; } else {
obj.middleAltOffset = -obj.altOffset * 243.3424;
}
obj["ALT_scale"].setTranslation(0, -obj.middleAltOffset);
obj["ALT_scale"].update();
obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val.altitudePFD), 2)) * 1.392);
} }
obj["ALT_scale"].setTranslation(0, -obj.middleAltOffset);
obj["ALT_scale"].update();
obj["ALT_tens"].setTranslation(0, num(right(sprintf("%02d", val), 2)) * 1.392);
}), }),
props.UpdateManager.FromHashValue("altitudeDigits", 1, func(val) { props.UpdateManager.FromHashValue("altitudeDigits", 1, func(val) {
obj["ALT_digits"].setText(sprintf("%d", val)); obj["ALT_digits"].setText(sprintf("%d", val));
@ -1695,6 +1701,7 @@ var canvas_pfd = {
alt_going2 = 0; alt_going2 = 0;
amber_going2 = 0; amber_going2 = 0;
} }
me["ALT_box"].show();
me["ALT_box_flash"].hide(); me["ALT_box_flash"].hide();
me["ALT_box_amber"].hide(); me["ALT_box_amber"].hide();
} else { } else {
@ -2073,14 +2080,14 @@ var canvas_pfd = {
getAOAForPFD1: func() { 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_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(); if (air_data_switch.getValue() == -1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue();
return nil; return 0;
}, },
# Get Angle of Attack from ADR2 or, depending on Switching panel, ADR3 # Get Angle of Attack from ADR2 or, depending on Switching panel, ADR3
getAOAForPFD2: func() { 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_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(); if (air_data_switch.getValue() == 1 and adr_3_switch.getValue() and !adr_3_fault.getValue()) return aoa_3.getValue();
return nil; return 0;
}, },
# Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs # Convert difference between magnetic heading and track measured in degrees to pixel for display on PFDs

View file

@ -22,7 +22,6 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
@ -37,13 +36,13 @@
units="pt" units="pt"
inkscape:snap-global="false" inkscape:snap-global="false"
showguides="true" showguides="true"
inkscape:current-layer="ALT_group" inkscape:current-layer="svg2"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:window-y="-11" inkscape:window-y="-11"
inkscape:window-x="-11" inkscape:window-x="-11"
inkscape:cy="673.69595" inkscape:cy="228.04193"
inkscape:cx="1065.6983" inkscape:cx="941.86619"
inkscape:zoom="5.6568545" inkscape:zoom="2.8284273"
showgrid="false" showgrid="false"
id="namedview371" id="namedview371"
inkscape:window-height="974" inkscape:window-height="974"
@ -2397,15 +2396,15 @@
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
id="path1283" id="path1283"
d="m 856.4002,481.90842 2.2e-4,-15.92813 h 52.07464 v 93.34657 h -52.07457 v -15.26583" d="m 856.4002,481.90842 2.2e-4,-15.92813 h 52.07464 v 93.34657 h -52.07457 v -15.26583"
style="fill:#000000;fill-opacity:1;stroke:#ffff00;stroke-width:3.19994998;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> style="fill:#000000;fill-opacity:1;stroke:#ffff00;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path <path
sodipodi:nodetypes="cc" sodipodi:nodetypes="cc"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
id="path1285" id="path1285"
d="m 770.31078,481.90873 86.08971,-3.1e-4" d="m 770.31078,481.90873 86.08971,-3.1e-4"
style="fill:none;fill-opacity:1;stroke:#ffff00;stroke-width:3.19994998;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:#ffff00;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" />
<path <path
style="fill:none;fill-opacity:1;stroke:#ffff00;stroke-width:3.19994998;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:#ffff00;stroke-width:3.19995;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
d="m 770.31078,544.06163 86.08971,-6e-4" d="m 770.31078,544.06163 86.08971,-6e-4"
id="path1287" id="path1287"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
@ -2631,26 +2630,26 @@
transform="scale(0.87678236,1.1405339)" transform="scale(0.87678236,1.1405339)"
id="FMA_dh" id="FMA_dh"
y="115.05846" y="115.05846"
x="831.23047" x="826.09802"
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:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.657577" 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:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.657577"
xml:space="preserve" xml:space="preserve"
inkscape:label="#text983"><tspan inkscape:label="#text983"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:0.657577" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:0.657577"
y="115.05846" y="115.05846"
x="831.23047" x="826.09802"
id="tspan4301" id="tspan4301"
sodipodi:role="line">RADIO</tspan></text> sodipodi:role="line">RADIO</tspan></text>
<text <text
inkscape:label="#text983" inkscape:label="#text983"
xml:space="preserve" xml:space="preserve"
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;display:inline;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:0.657577" 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;display:inline;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:0.657577"
x="934.0097" x="937.43134"
y="115.05846" y="115.05846"
id="FMA_dhn" id="FMA_dhn"
transform="scale(0.87678236,1.1405339)"><tspan transform="scale(0.87678236,1.1405339)"><tspan
sodipodi:role="line" sodipodi:role="line"
id="tspan4305" id="tspan4305"
x="934.0097" x="937.43134"
y="115.05846" y="115.05846"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke-width:0.657577">0250</tspan></text> style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke-width:0.657577">0250</tspan></text>
<g <g

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 348 KiB