Add proper implementation of altitude alert, works according to spec, pls test
This commit is contained in:
parent
bc096f1ac2
commit
67ae1e461a
7 changed files with 4257 additions and 4074 deletions
|
@ -190,13 +190,13 @@ setlistener("/sim/signals/fdm-initialized", func {
|
|||
writeSettings();
|
||||
if (getprop("options/system/save-state") == 1)
|
||||
{
|
||||
save.restore(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
|
||||
save.restore(save.default, getprop("sim/fg-home") ~ "/Export/" ~ getprop("sim/aircraft") ~ "-save.xml");
|
||||
}
|
||||
spinning.stop();
|
||||
});
|
||||
|
||||
setlistener("/sim/signals/exit", func {
|
||||
save.save(save.default, getprop("/sim/fg-home") ~ "/Export/" ~ getprop("/sim/aircraft") ~ "-save.xml");
|
||||
save.save(save.default, getprop("sim/fg-home") ~ "/Export/" ~ getprop("sim/aircraft") ~ "-save.xml");
|
||||
});
|
||||
|
||||
var renderingSettings = {
|
||||
|
|
|
@ -5307,6 +5307,10 @@
|
|||
</condition>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (getprop("sim/sound/warnings/cchord")) {
|
||||
setprop("sim/sound/warnings/cchord-inhibit", 1);
|
||||
}
|
||||
|
||||
if (getprop("it-autoflight/output/ap-warning") == 1) {
|
||||
setprop("it-autoflight/output/ap-warning", 0);
|
||||
}
|
||||
|
|
|
@ -169,6 +169,8 @@ var ilsFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/il
|
|||
var qnhFlash = props.globals.initNode("/instrumentation/pfd/flash-indicators/qnh-flash", 0, "BOOL");
|
||||
var altFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/alt-flash-1", 0, "BOOL");
|
||||
var altFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/alt-flash-2", 0, "BOOL");
|
||||
var amberFlash1 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-1", 0, "BOOL");
|
||||
var amberFlash2 = props.globals.initNode("/instrumentation/pfd/flash-indicators/amber-flash-2", 0, "BOOL");
|
||||
|
||||
var canvas_PFD_base = {
|
||||
init: func(canvas_group, file) {
|
||||
|
@ -217,8 +219,8 @@ var canvas_PFD_base = {
|
|||
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_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_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",
|
||||
"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_amber","ALT_box_amber_flash",
|
||||
"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","flap_max","clean_speed"];
|
||||
},
|
||||
|
@ -1500,24 +1502,50 @@ var canvas_PFD_1 = {
|
|||
me["ALT_target"].hide();
|
||||
}
|
||||
|
||||
alt_target_diff = target_altitude.getValue() - altitude.getValue();
|
||||
if ((FMGCphase.getValue() == '2' and alt_target_diff < 750 and alt_target_diff > 200) or (FMGCphase.getValue() == '4' and alt_target_diff > -750 and alt_target_diff < -200)) {
|
||||
if (alt_going1 == 0) {
|
||||
alt_going1 = 1;
|
||||
}
|
||||
if (alt_going1 == 1) {
|
||||
altTimer1.start();
|
||||
if (!getprop("ECAM/alt-alert-flash") and !getprop("ECAM/alt-alert-steady")) {
|
||||
alt_going1 = 0;
|
||||
amber_going1 = 0;
|
||||
me["ALT_box_flash"].hide();
|
||||
me["ALT_box_amber"].hide();
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
} else {
|
||||
if (getprop("ECAM/alt-alert-flash")) {
|
||||
if (alt_going1 == 1) {
|
||||
me["ALT_box_flash"].hide();
|
||||
altTimer1.stop();
|
||||
}
|
||||
if (amber_going1 == 0) {
|
||||
amber_going1 = 1;
|
||||
}
|
||||
if (amber_going1 == 1) {
|
||||
me["ALT_box_amber"].show();
|
||||
amberTimer1.start();
|
||||
}
|
||||
if (amberFlash1.getValue() == 1) {
|
||||
me["ALT_box_amber_flash"].show();
|
||||
} else {
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
}
|
||||
} elsif (getprop("ECAM/alt-alert-steady")) {
|
||||
if (amber_going1 == 1) {
|
||||
me["ALT_box_amber"].hide();
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
amberTimer1.stop();
|
||||
}
|
||||
if (alt_going1 == 0) {
|
||||
alt_going1 = 1;
|
||||
}
|
||||
if (alt_going1 == 1) {
|
||||
me["ALT_box_flash"].show();
|
||||
altTimer1.start();
|
||||
}
|
||||
if (altFlash1.getValue() == 1) {
|
||||
me["ALT_box_flash"].show();
|
||||
} else {
|
||||
me["ALT_box_flash"].hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
altTimer1.stop();
|
||||
alt_going1 = 0;
|
||||
me["ALT_box_flash"].hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
me["ALT_error"].show();
|
||||
me["ALT_frame"].setColor(1,0,0);
|
||||
|
@ -1525,6 +1553,8 @@ var canvas_PFD_1 = {
|
|||
me["ALT_group2"].hide();
|
||||
me["ALT_scale"].hide();
|
||||
me["ALT_box_flash"].hide();
|
||||
me["ALT_box_amber"].hide();
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
}
|
||||
|
||||
me.updateCommonFast();
|
||||
|
@ -2116,25 +2146,50 @@ var canvas_PFD_2 = {
|
|||
me["ALT_target"].hide();
|
||||
}
|
||||
|
||||
alt_target_diff = target_altitude.getValue() - altitude.getValue();
|
||||
if ((FMGCphase.getValue() == '2' and alt_target_diff < 750 and alt_target_diff > 200) or (FMGCphase.getValue() == '4' and alt_target_diff > -750 and alt_target_diff < -200)) {
|
||||
if (alt_going2 == 0) {
|
||||
alt_going2 = 1;
|
||||
}
|
||||
if (alt_going2 == 1) {
|
||||
altTimer2.start();
|
||||
if (!getprop("ECAM/alt-alert-flash") and !getprop("ECAM/alt-alert-steady")) {
|
||||
alt_going2 = 0;
|
||||
amber_going2 = 0;
|
||||
me["ALT_box_flash"].hide();
|
||||
me["ALT_box_amber"].hide();
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
} else {
|
||||
if (getprop("ECAM/alt-alert-flash")) {
|
||||
if (alt_going2 == 1) {
|
||||
me["ALT_box_flash"].hide();
|
||||
altTimer2.stop();
|
||||
}
|
||||
if (amber_going2 == 0) {
|
||||
amber_going2 = 1;
|
||||
}
|
||||
if (amber_going2 == 1) {
|
||||
me["ALT_box_amber"].show();
|
||||
amberTimer2.start();
|
||||
}
|
||||
if (amberFlash2.getValue() == 1) {
|
||||
me["ALT_box_amber_flash"].show();
|
||||
} else {
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
}
|
||||
} elsif (getprop("ECAM/alt-alert-steady")) {
|
||||
if (amber_going2 == 1) {
|
||||
me["ALT_box_amber"].hide();
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
amberTimer2.stop();
|
||||
}
|
||||
if (alt_going2 == 0) {
|
||||
alt_going2 = 1;
|
||||
}
|
||||
if (alt_going2 == 1) {
|
||||
me["ALT_box_flash"].show();
|
||||
altTimer2.start();
|
||||
}
|
||||
if (altFlash2.getValue() == 1) {
|
||||
me["ALT_box_flash"].show();
|
||||
} else {
|
||||
me["ALT_box_flash"].hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
altTimer2.stop();
|
||||
alt_going2 = 0;
|
||||
me["ALT_box_flash"].hide();
|
||||
}
|
||||
|
||||
} else {
|
||||
me["ALT_error"].show();
|
||||
me["ALT_frame"].setColor(1,0,0);
|
||||
|
@ -2142,6 +2197,8 @@ var canvas_PFD_2 = {
|
|||
me["ALT_group2"].hide();
|
||||
me["ALT_scale"].hide();
|
||||
me["ALT_box_flash"].hide();
|
||||
me["ALT_box_amber"].hide();
|
||||
me["ALT_box_amber_flash"].hide();
|
||||
}
|
||||
|
||||
me.updateCommonFast();
|
||||
|
@ -2425,3 +2482,21 @@ var altTimer2 = maketimer(0.50, func {
|
|||
}
|
||||
});
|
||||
|
||||
var amber_going1 = 0;
|
||||
var amberTimer1 = maketimer(0.50, func {
|
||||
if (!amberFlash1.getBoolValue()) {
|
||||
amberFlash1.setBoolValue(1);
|
||||
} else {
|
||||
amberFlash1.setBoolValue(0);
|
||||
}
|
||||
});
|
||||
|
||||
var amber_going2 = 0;
|
||||
var amberTimer2 = maketimer(0.50, func {
|
||||
if (!amberFlash2.getBoolValue()) {
|
||||
amberFlash2.setBoolValue(1);
|
||||
} else {
|
||||
amberFlash2.setBoolValue(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 291 KiB After Width: | Height: | Size: 294 KiB |
|
@ -35,6 +35,7 @@ var timer10secIRS = nil;
|
|||
var altAlertInhibit = nil;
|
||||
var alt250 = nil;
|
||||
var alt750 = nil;
|
||||
var bigThree = nil;
|
||||
|
||||
var messages_priority_3 = func {
|
||||
phaseVar = phaseNode.getValue();
|
||||
|
@ -748,13 +749,13 @@ var messages_priority_3 = func {
|
|||
}
|
||||
|
||||
# C-Chord
|
||||
if ((pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-1-capt")) < 250) or !pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt")) < 250) {
|
||||
if ((pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("systems/navigation/adr/output/baro-alt-1-capt")) < 250) or !pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("systems/navigation/adr/output/baro-alt-corrected-1-capt")) < 250) {
|
||||
alt250 = 1;
|
||||
} else {
|
||||
alt250 = 0;
|
||||
}
|
||||
|
||||
if ((pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-1-capt")) < 750) or !pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("/systems/navigation/adr/output/baro-alt-corrected-1-capt")) < 750) {
|
||||
if ((pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("systems/navigation/adr/output/baro-alt-1-capt")) < 750) or !pts.Modes.Altimeter.std.getValue() and abs(fcu.altSet.getValue() - getprop("systems/navigation/adr/output/baro-alt-corrected-1-capt")) < 750) {
|
||||
alt750 = 1;
|
||||
} else {
|
||||
alt750 = 0;
|
||||
|
@ -766,7 +767,13 @@ var messages_priority_3 = func {
|
|||
altAlertInhibit = 0;
|
||||
}
|
||||
|
||||
if ((fcu.ap1.getBoolValue() or fcu.ap2.getBoolValue()) and (alt750 and !alt250 and !altAlertInhibit)) {
|
||||
if (alt750 and !alt250 and !altAlertInhibit) {
|
||||
FWC.Monostable.altAlert2.setValue(1);
|
||||
} else {
|
||||
FWC.Monostable.altAlert2.setValue(0);
|
||||
}
|
||||
|
||||
if ((fcu.ap1.getBoolValue() or fcu.ap2.getBoolValue()) and FWC.Monostable.altAlert2.getValue()) {
|
||||
FWC.Monostable.altAlert1.setValue(1);
|
||||
} else {
|
||||
FWC.Monostable.altAlert1.setValue(0);
|
||||
|
@ -790,12 +797,33 @@ var messages_priority_3 = func {
|
|||
setprop("ECAM/flipflop/alt-alert-3-rs-set", 0);
|
||||
}
|
||||
|
||||
if (!gnd and (FWC.Monostable.altAlert1Output.getValue() or ((!alt750 and !alt250 and !altAlertInhibit and getprop("ECAM/flipflop/alt-alert-rs-output")) or (!alt750 and !alt250 and !altAlertInhibit and getprop("ECAM/flipflop/alt-alert-3-rs-output")) or getprop("ECAM/flipflop/alt-alert-3-rs-set") == 1))) {
|
||||
print(alt750);
|
||||
print(alt250);
|
||||
setprop("/sim/sound/warnings/cchord", 1);
|
||||
if ((!alt750 and !alt250 and !altAlertInhibit and getprop("ECAM/flipflop/alt-alert-rs-output")) or (!alt750 and !alt250 and !altAlertInhibit and getprop("ECAM/flipflop/alt-alert-3-rs-output")) or getprop("ECAM/flipflop/alt-alert-3-rs-set")) {
|
||||
bigThree = 1;
|
||||
} else {
|
||||
setprop("/sim/sound/warnings/cchord", 0);
|
||||
bigThree = 0;
|
||||
}
|
||||
|
||||
if (!gnd and (FWC.Monostable.altAlert1Output.getValue() or bigThree)) {
|
||||
if (!getprop("sim/sound/warnings/cchord-inhibit")) {
|
||||
setprop("sim/sound/warnings/cchord", 1);
|
||||
} else {
|
||||
setprop("sim/sound/warnings/cchord", 0);
|
||||
}
|
||||
} else {
|
||||
setprop("sim/sound/warnings/cchord", 0);
|
||||
setprop("sim/sound/warnings/cchord-inhibit", 0);
|
||||
}
|
||||
|
||||
if (!gnd and getprop("ECAM/flipflop/alt-alert-3-rs-set") != 1 and alt750 and !alt250 and !altAlertInhibit) {
|
||||
setprop("ECAM/alt-alert-steady", 1);
|
||||
} else {
|
||||
setprop("ECAM/alt-alert-steady", 0);
|
||||
}
|
||||
|
||||
if (!gnd and bigThree) {
|
||||
setprop("ECAM/alt-alert-flash", 1);
|
||||
} else {
|
||||
setprop("ECAM/alt-alert-flash", 0);
|
||||
}
|
||||
|
||||
if (!systems.cargoTestBtn.getBoolValue()) {
|
||||
|
|
|
@ -40,6 +40,7 @@ var FWC = {
|
|||
m80kt: props.globals.getNode("ECAM/phases/monostable-80kt"),
|
||||
altAlert1: props.globals.initNode("ECAM/altitude-alert-monostable-set", 0, "BOOL"),
|
||||
altAlert1Output: props.globals.initNode("ECAM/altitude-alert-monostable-output"),
|
||||
altAlert2: props.globals.initNode("ECAM/flipflop/altitude-alert-rs-set", 0, "BOOL"),
|
||||
},
|
||||
Flipflop: {
|
||||
gearSet: props.globals.initNode("ECAM/phases/flipflop/gear-set", 0, "BOOL"),
|
||||
|
|
|
@ -228,17 +228,44 @@
|
|||
<output>ECAM/buttons/recall-status-normal-output</output>
|
||||
</flipflop>
|
||||
|
||||
<flipflop>
|
||||
<type>SR</type>
|
||||
<S>
|
||||
<property>ECAM/altitude-alert-monostable-set</property>
|
||||
</S>
|
||||
<R>
|
||||
<property>ECAM/altitude-alert-monostable-intermediate-output</property>
|
||||
</R>
|
||||
<output>ECAM/altitude-alert-monostable-flipflop-intermediate</output>
|
||||
</flipflop>
|
||||
|
||||
<flipflop>
|
||||
<type>monostable</type>
|
||||
<inverted type="bool">true</inverted>
|
||||
<time>
|
||||
<value>1.5</value>
|
||||
</time>
|
||||
<S>
|
||||
<property>ECAM/altitude-alert-monostable-set</property>
|
||||
<not><property>ECAM/altitude-alert-monostable-flipflop-intermediate</property></not>
|
||||
</S>
|
||||
<output>ECAM/altitude-alert-monostable-output</output>
|
||||
<output>ECAM/altitude-alert-monostable-intermediate-output</output>
|
||||
</flipflop>
|
||||
|
||||
<filter>
|
||||
<type>gain</type>
|
||||
<gain>1.0</gain>
|
||||
<input>
|
||||
<condition>
|
||||
<and>
|
||||
<property>ECAM/altitude-alert-monostable-flipflop-intermediate</property>
|
||||
<not><property>ECAM/altitude-alert-monostable-intermediate-output</property></not>
|
||||
</and>
|
||||
</condition>
|
||||
<value>1</value>
|
||||
</input>
|
||||
<output>ECAM/altitude-alert-monostable-output</output>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<type>derivative</type>
|
||||
<input>it-autoflight/input/alt</input>
|
||||
|
@ -292,11 +319,13 @@
|
|||
|
||||
|
||||
<filter>
|
||||
<type>gain</type>
|
||||
<gain>1.0</gain>
|
||||
<input>
|
||||
<condition>
|
||||
<or>
|
||||
<property>ECAM/gear-downlocked-set</property>
|
||||
<property>ECAM/alt-is-changing</property>
|
||||
<equals><property>ECAM/gear-downlocked-output</property><value>1</value></equals>
|
||||
<equals><property>ECAM/alt-is-changing</property><value>1</value></equals>
|
||||
</or>
|
||||
</condition>
|
||||
<value>1</value>
|
||||
|
@ -304,8 +333,8 @@
|
|||
<input>
|
||||
<condition>
|
||||
<and>
|
||||
<not><property>ECAM/gear-downlocked-set</property></not>
|
||||
<not><property>ECAM/alt-is-changing</property></not>
|
||||
<equals><property>ECAM/gear-downlocked-output</property><value>0</value></equals>
|
||||
<equals><property>ECAM/alt-is-changing</property><value>0</value></equals>
|
||||
</and>
|
||||
</condition>
|
||||
<value>0</value>
|
||||
|
@ -316,7 +345,7 @@
|
|||
<flipflop>
|
||||
<type>RS</type>
|
||||
<S>
|
||||
<property>ECAM/altitude-alert-monostable-set</property>
|
||||
<property>ECAM/flipflop/altitude-alert-rs-set</property>
|
||||
</S>
|
||||
<R>
|
||||
<property>ECAM/flipflop/alt-alert-rs-reset</property>
|
||||
|
|
Loading…
Reference in a new issue