1
0
Fork 0

Add basic FPV functionality

This commit is contained in:
sgilchrist123 2020-08-30 09:37:22 +10:00
parent 30799c7de0
commit e8fd43885d
2 changed files with 32 additions and 1 deletions

View file

@ -15,6 +15,7 @@ var updateR = 0;
var elapsedtime = 0; var elapsedtime = 0;
var altTens = 0; var altTens = 0;
var altPolarity = ""; var altPolarity = "";
var FPV_Y_COEFFICIENT = 12.5;
# Fetch nodes: # Fetch nodes:
var state1 = props.globals.getNode("/systems/thrust/state1", 1); var state1 = props.globals.getNode("/systems/thrust/state1", 1);
@ -126,6 +127,9 @@ var inner_marker = props.globals.getNode("/instrumentation/marker-beacon/inner",
var flap_config = props.globals.getNode("/controls/flight/flaps-input", 1); var flap_config = props.globals.getNode("/controls/flight/flaps-input", 1);
var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1); var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1);
var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 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);
# Create Nodes: # Create Nodes:
var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE"); var alt_diff = props.globals.initNode("/instrumentation/pfd/alt-diff", 0.0, "DOUBLE");
@ -212,7 +216,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", "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", "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", "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"]; "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"];
}, },
updateDu1: func() { updateDu1: func() {
var elapsedtime_act = elapsedtime.getValue(); var elapsedtime_act = elapsedtime.getValue();
@ -1079,6 +1083,17 @@ var canvas_PFD_1 = {
me["FD_pitch"].hide(); me["FD_pitch"].hide();
} }
# FPV
# If TRK FPA selected on the FCU, display FPV on PFD1
# TODO - Deal with situation if AOA not available from ADR1
# TODO - Hide FPV if error on PFD1
if (ap_trk_sw.getValue() == 0) {
me["FPV"].hide();
} else {
me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, math.clamp(aoa_1.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT);
me["FPV"].show();
}
# ILS # ILS
if (ap_ils_mode.getValue() == 1) { if (ap_ils_mode.getValue() == 1) {
me["LOC_scale"].show(); me["LOC_scale"].show();
@ -1817,6 +1832,17 @@ var canvas_PFD_2 = {
me["FD_pitch"].hide(); me["FD_pitch"].hide();
} }
# FPV
# If TRK FPA selected on the FCU, display FPV on PFD2
# TODO - Deal with situation if AOA not available from ADR2
# TODO - Hide FPV if error on PFD2
if (ap_trk_sw.getValue() == 0) {
me["FPV"].hide();
} else {
me["FPV"].setTranslation((math.clamp(track_diff.getValue(), -23.62, 23.62) / 10) * 98.5416, math.clamp(aoa_2.getValue(), -9.9, 9.9)*FPV_Y_COEFFICIENT);
me["FPV"].show();
}
# ILS # ILS
if (ap_ils_mode2.getValue() == 1) { if (ap_ils_mode2.getValue() == 1) {
me["LOC_scale"].show(); me["LOC_scale"].show();

View file

@ -6656,4 +6656,9 @@
x="61.095329" x="61.095329"
y="74.429939" y="74.429939"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:35.9995px;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">FLX</tspan></text> style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:35.9995px;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">FLX</tspan></text>
<path
style="fill:none;fill-opacity:1;stroke:#0dc04b;stroke-width:5.877913;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 447.59808,482.4841 v 9.38782 h 1.06691 v -9.38782 z m 0.38115,12.7416 a 16.427645,16.427645 0 0 0 -16.42755,16.42754 16.427645,16.427645 0 0 0 16.42755,16.42754 16.427645,16.427645 0 0 0 16.42754,-16.42754 16.427645,16.427645 0 0 0 -16.42754,-16.42754 z m -54.20078,16.02956 v 0.35359 h 36.64816 v -0.35359 z m 71.88043,0.35359 v 0.35512 h 36.64664 v -0.35512 z"
id="FPV"
inkscape:connector-curvature="0" />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 367 KiB