1
0
Fork 0

Merge branch 'dev' into pneumatics

This commit is contained in:
legoboyvdlp R 2020-07-03 15:28:27 +01:00
commit 6951c78e77
21 changed files with 2490 additions and 2445 deletions

View file

@ -23,9 +23,9 @@ A clear and concise description of what you expected to happen.
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
** System (please complete the following information):** **System (please complete the following information):**
- OS: - OS:
- FlightGear version: - FlightGear version:
**Additional context** **Additional context**

View file

@ -972,9 +972,7 @@
<services n="0"> <services n="0">
<chocks n="0"> <chocks n="0">
<nose type="bool">0</nose> <enable type="bool">0</enable>
<left type="bool">0</left>
<right type="bool">0</right>
</chocks> </chocks>
<fuel-truck> <fuel-truck>
<connect type="bool">0</connect> <connect type="bool">0</connect>

View file

@ -485,7 +485,7 @@ var taxi_b = func {
if (pts.Instrumentation.Altimeter.std.getBoolValue()) { if (pts.Instrumentation.Altimeter.std.getBoolValue()) {
libraries.toggleSTD(); libraries.toggleSTD();
} }
setprop("/instrumentation/altimeter[0]/setting-inhg", getprop("/environment/pressure-sea-level-inhg")); setprop("/instrumentation/altimeter[0]/setting-inhg", getprop("/environment/metar[0]/pressure-inhg") or 29.92);
settimer(taxi_c, 2); settimer(taxi_c, 2);
} }
var taxi_c = func { var taxi_c = func {

View file

@ -5,7 +5,7 @@
<pitch-deg type="float">0.0</pitch-deg> <pitch-deg type="float">0.0</pitch-deg>
<min-turn-radius-m type="float">15</min-turn-radius-m> <min-turn-radius-m type="float">15</min-turn-radius-m>
<stopping-distance-m type="float">5.0</stopping-distance-m> <stopping-distance-m type="float">5.0</stopping-distance-m>
<chocks alias="/services/chocks/nose"/> <chocks alias="/services/chocks/enable"/>
<available type="int">1</available> <available type="int">1</available>
<enabled type="int"/> <enabled type="int"/>
<connected type="bool">false</connected> <connected type="bool">false</connected>

View file

@ -57,18 +57,9 @@
<property>/gear/gear[2]/wow</property> <property>/gear/gear[2]/wow</property>
</and> </and>
</enable> </enable>
<property>/services/chocks/nose</property> <property>/services/chocks/enable</property>
<binding> <binding>
<command>property-toggle</command> <command>dialog-apply</command>
<property>/services/chocks/left</property>
</binding>
<binding>
<command>property-toggle</command>
<property>/services/chocks/right</property>
</binding>
<binding>
<command>property-toggle</command>
<property>/services/chocks/nose</property>
</binding> </binding>
<live>true</live> <live>true</live>
</checkbox> </checkbox>
@ -136,9 +127,7 @@
<and> <and>
<or> <or>
<property>/controls/gear/brake-parking</property> <property>/controls/gear/brake-parking</property>
<property>/services/chocks/nose</property> <property>/services/chocks/enable</property>
<property>/services/chocks/left</property>
<property>/services/chocks/right</property>
</or> </or>
<less-than> <less-than>
<property>/velocities/groundspeed-kt</property> <property>/velocities/groundspeed-kt</property>
@ -164,9 +153,7 @@
<and> <and>
<or> <or>
<property>/controls/gear/brake-parking</property> <property>/controls/gear/brake-parking</property>
<property>/services/chocks/nose</property> <property>/services/chocks/enable</property>
<property>/services/chocks/left</property>
<property>/services/chocks/right</property>
</or> </or>
<less-than> <less-than>
<property>/velocities/groundspeed-kt</property> <property>/velocities/groundspeed-kt</property>
@ -192,9 +179,7 @@
<and> <and>
<or> <or>
<property>/controls/gear/brake-parking</property> <property>/controls/gear/brake-parking</property>
<property>/services/chocks/nose</property> <property>/services/chocks/enable</property>
<property>/services/chocks/left</property>
<property>/services/chocks/right</property>
</or> </or>
<less-than> <less-than>
<property>/velocities/groundspeed-kt</property> <property>/velocities/groundspeed-kt</property>

View file

@ -132,7 +132,7 @@
<path>Aircraft/A320-family/Models/Services/Chocks/chock_nose.ac</path> <path>Aircraft/A320-family/Models/Services/Chocks/chock_nose.ac</path>
<condition> <condition>
<equals> <equals>
<property>services/chocks/nose</property> <property>services/chocks/enable</property>
<value>1</value> <value>1</value>
</equals> </equals>
</condition> </condition>
@ -147,7 +147,7 @@
<path>Aircraft/A320-family/Models/Services/Chocks/chock_left.ac</path> <path>Aircraft/A320-family/Models/Services/Chocks/chock_left.ac</path>
<condition> <condition>
<equals> <equals>
<property>services/chocks/left</property> <property>services/chocks/enable</property>
<value>1</value> <value>1</value>
</equals> </equals>
</condition> </condition>
@ -163,7 +163,7 @@
<path>Aircraft/A320-family/Models/Services/Chocks/chock_right.ac</path> <path>Aircraft/A320-family/Models/Services/Chocks/chock_right.ac</path>
<condition> <condition>
<equals> <equals>
<property>services/chocks/right</property> <property>services/chocks/enable</property>
<value>1</value> <value>1</value>
</equals> </equals>
</condition> </condition>

View file

@ -294,8 +294,8 @@ var canvas_MCDU_base = {
"Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow", "Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow",
"Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C3B","Simple_C4","Simple_C4B","Simple_C5","Simple_C6","Simple_C1S", "Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C3B","Simple_C4","Simple_C4B","Simple_C5","Simple_C6","Simple_C1S",
"Simple_C2S","Simple_C3S","Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp", "Simple_C2S","Simple_C3S","Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp",
"INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","FUELPRED","FUELPRED_ZFW", "INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFWCG_S","INITB_Block","FUELPRED","FUELPRED_ZFW",
"FUELPRED_ZFWCG","FUELPRED_ZFW_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR", "FUELPRED_ZFWCG","FUELPRED_ZFWCG_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR",
"PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From",
"FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R",
"arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star"]; "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star"];
@ -1483,7 +1483,7 @@ var canvas_MCDU_base = {
me.fontRightS(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default);
me.fontSizeLeft(small, small, small, small, small, small); me.fontSizeLeft(small, small, small, small, small, small);
me.fontSizeCenter(small, small, small, small, small, small); me.fontSizeCenter(normal, small, small, small, small, small);
me.fontSizeRight(normal, normal, normal, small, small, small); me.fontSizeRight(normal, normal, normal, small, small, small);
me["Simple_C4B"].setFontSize(small); me["Simple_C4B"].setFontSize(small);
@ -1754,28 +1754,30 @@ var canvas_MCDU_base = {
} }
} }
me["Simple_R1S"].setText("ZFWCG/ ZFW"); me["Simple_R1S"].setText("ZFW/ZFWCG");
me["Simple_R1"].setText(sprintf("%3.1f", zfw.getValue())); me["Simple_R1"].setText(sprintf("%3.1f", zfwcg.getValue()));
me["INITB_ZFWCG"].hide();
me["INITB_ZFWCG_S"].show();
me["Simple_R1"].show();
if (zfwcgSet.getValue() == 1) { if (zfwcgSet.getValue() == 1) {
me["Simple_C1"].setFontSize(normal); me["Simple_R1"].setFontSize(normal);
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["INITB_ZFWCG"].hide();
} else { } else {
me["Simple_C1"].setFontSize(small); me["Simple_R1"].setFontSize(small);
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["INITB_ZFWCG"].hide();
} }
if (zfwSet.getValue() == 1) { if (zfwSet.getValue() == 1) {
if (zfw.getValue() < 100) {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
} else {
me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
}
me["Simple_C1"].show();
me["INITB_ZFW"].hide(); me["INITB_ZFW"].hide();
me["INITB_ZFW_S"].show();
me["Simple_R1"].show();
} else { } else {
me["Simple_C1"].hide();
me["INITB_ZFW"].show(); me["INITB_ZFW"].show();
me["INITB_ZFW_S"].hide();
me["Simple_R1"].hide();
} }
if (taxi_fuel_set.getValue() == 1) { if (taxi_fuel_set.getValue() == 1) {
me["Simple_L1"].setFontSize(normal); me["Simple_L1"].setFontSize(normal);
} else { } else {
@ -1860,7 +1862,7 @@ var canvas_MCDU_base = {
me.fontRightS(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default);
me.fontSizeLeft(normal, normal, small, small, small, small); me.fontSizeLeft(normal, normal, small, small, small, small);
me.fontSizeCenter(small, small, small, small, small, small); me.fontSizeCenter(small, small, normal, small, small, small);
me.fontSizeRight(normal, normal, normal, small, small, small); me.fontSizeRight(normal, normal, normal, small, small, small);
me["Simple_C3B"].setFontSize(small); me["Simple_C3B"].setFontSize(small);
@ -2026,26 +2028,28 @@ var canvas_MCDU_base = {
me.colorRight("ack", "ack", "blu", "grn", "grn", "grn"); me.colorRight("ack", "ack", "blu", "grn", "grn", "grn");
} }
me["Simple_R3S"].setText("ZFWCG/ZFW"); me["Simple_R3S"].setText("ZFW/ZFWCG");
me["Simple_R3"].setText(sprintf("%3.1f", zfw.getValue())); me["Simple_R3"].setText(sprintf("%3.1f", zfwcg.getValue()));
me["Simple_R3"].show();
me["FUELPRED_ZFWCG"].hide();
me["FUELPRED_ZFWCG_S"].show();
if (zfwcgSet.getValue() == 1) { if (zfwcgSet.getValue() == 1) {
me["Simple_C3"].setFontSize(normal); me["Simple_R3"].setFontSize(normal);
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["FUELPRED_ZFWCG"].hide();
} else { } else {
me["Simple_C3"].setFontSize(small); me["Simple_R3"].setFontSize(small);
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue()));
me["FUELPRED_ZFWCG"].hide();
} }
if (zfwSet.getValue() == 1) { if (zfwSet.getValue() == 1) {
if (zfw.getValue() < 100) {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
} else {
me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue()));
}
me["Simple_C3"].show();
me["FUELPRED_ZFW"].hide(); me["FUELPRED_ZFW"].hide();
me["FUELPRED_ZFW_S"].show();
me["Simple_R3"].show();
} else { } else {
me["Simple_C3"].hide();
me["FUELPRED_ZFW"].show(); me["FUELPRED_ZFW"].show();
me["FUELPRED_ZFW_S"].hide();
me["Simple_R3"].hide();
} }
if (rte_rsv_set.getValue() == 1) { if (rte_rsv_set.getValue() == 1) {
@ -3768,6 +3772,7 @@ var canvas_MCDU_base = {
me["ArrowRight"].show(); me["ArrowRight"].show();
me["arrowsDepArr"].show(); me["arrowsDepArr"].show();
me["Simple_L1_Arrow"].hide(); me["Simple_L1_Arrow"].hide();
me["Simple_L2_Arrow"].hide();
me["Simple_L3_Arrow"].hide(); me["Simple_L3_Arrow"].hide();
me["Simple_L4_Arrow"].hide(); me["Simple_L4_Arrow"].hide();
me["Simple_L5_Arrow"].hide(); me["Simple_L5_Arrow"].hide();
@ -3778,7 +3783,8 @@ var canvas_MCDU_base = {
me["Simple_R4_Arrow"].hide(); me["Simple_R4_Arrow"].hide();
me["Simple_R5_Arrow"].hide(); me["Simple_R5_Arrow"].hide();
me["Simple_R6_Arrow"].hide(); me["Simple_R6_Arrow"].hide();
me["arrow2L"].hide();
me["arrow2R"].hide();
me["Simple_L0S"].hide(); me["Simple_L0S"].hide();
me["Simple_C3B"].hide(); me["Simple_C3B"].hide();
me["Simple_C4B"].hide(); me["Simple_C4B"].hide();

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View file

@ -106,8 +106,6 @@ var flightPlanController = {
print(err[0]); print(err[0]);
print("Load failed."); print("Load failed.");
} }
# try to fix fgfp
me.flightplans[3].destination = airportinfo(getprop("/FMGC/internal/arr-arpt"));
me.destroyTemporaryFlightPlan(3, 1); me.destroyTemporaryFlightPlan(3, 1);
}, },
@ -117,34 +115,36 @@ var flightPlanController = {
me.resetFlightplan(2); me.resetFlightplan(2);
me.flightplans[2] = me.flightplans[n].clone(); me.flightplans[2] = me.flightplans[n].clone();
if (mcdu.isNoSid[n] == 1) { if (n != 3) {
mcdu.isNoSid[2] = 1; if (mcdu.isNoSid[n] == 1) {
} else { mcdu.isNoSid[2] = 1;
mcdu.isNoSid[2] = 0; } else {
} mcdu.isNoSid[2] = 0;
}
if (mcdu.isNoStar[n] == 1) {
mcdu.isNoStar[2] = 1; if (mcdu.isNoStar[n] == 1) {
} else { mcdu.isNoStar[2] = 1;
mcdu.isNoStar[2] = 0; } else {
} mcdu.isNoStar[2] = 0;
}
if (mcdu.isNoVia[n] == 1) {
mcdu.isNoVia[2] = 1; if (mcdu.isNoVia[n] == 1) {
} else { mcdu.isNoVia[2] = 1;
mcdu.isNoVia[2] = 0; } else {
} mcdu.isNoVia[2] = 0;
}
if (mcdu.isNoTransDep[n] == 1) {
mcdu.isNoTransDep[2] = 1; if (mcdu.isNoTransDep[n] == 1) {
} else { mcdu.isNoTransDep[2] = 1;
mcdu.isNoTransDep[2] = 0; } else {
} mcdu.isNoTransDep[2] = 0;
}
if (mcdu.isNoTransArr[n] == 1) {
mcdu.isNoTransArr[2] = 1; if (mcdu.isNoTransArr[n] == 1) {
} else { mcdu.isNoTransArr[2] = 1;
mcdu.isNoTransArr[2] = 0; } else {
mcdu.isNoTransArr[2] = 0;
}
} }
me.flightPlanChanged(2); me.flightPlanChanged(2);
@ -168,10 +168,10 @@ var flightPlanController = {
me.destroyTemporaryFlightPlan(0, 0); me.destroyTemporaryFlightPlan(0, 0);
me.destroyTemporaryFlightPlan(1, 0); me.destroyTemporaryFlightPlan(1, 0);
me.currentToWptIndex.setValue(0); me.currentToWptIndex.setValue(0);
me.arrivalIndex = [0, 0, 0]; # reset arrival index calculations
} }
me.addDiscontinuity(1, plan); me.addDiscontinuity(1, plan);
#debug.dump(me.flightplans[2]);
# reset mcdu if it exists # reset mcdu if it exists
if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].scroll = 0; } if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].scroll = 0; }
if (canvas_mcdu.myFpln[1] != nil) { canvas_mcdu.myFpln[1].scroll = 0; } if (canvas_mcdu.myFpln[1] != nil) { canvas_mcdu.myFpln[1].scroll = 0; }
@ -368,8 +368,8 @@ var flightPlanController = {
# use createWP here as createWPFrom doesn't accept waypoints # use createWP here as createWPFrom doesn't accept waypoints
# createWPFrom worked before... but be sure! # createWPFrom worked before... but be sure!
me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.wp_name), 2); me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.id), 2);
fmgc.windController.insertWind(plan, 2, 0, waypointGhost.wp_name); fmgc.windController.insertWind(plan, 2, 0, waypointGhost.id);
me.addDiscontinuity(3, plan); me.addDiscontinuity(3, plan);
} else { } else {
# we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later. # we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later.
@ -824,6 +824,12 @@ var flightPlanController = {
} }
} }
} }
if (me.flightplans[2].getWP(me.arrivalIndex[2]) == nil or me.flightplans[2].getWP(1) == nil) {
me.arrivalDist = 9999;
print(me.arrivalIndex[2]);
}
me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist; me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist;
me.updateMCDUDriver(n); me.updateMCDUDriver(n);
}, },

View file

@ -170,7 +170,7 @@ var MessageController = {
TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),TypeIMessage.new("NOT ALLOWED"), TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),TypeIMessage.new("NOT ALLOWED"),
TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"), TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"),
TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"),
TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"), TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"),
]), ]),
typeIIMessages: std.Vector.new([ typeIIMessages: std.Vector.new([
TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"),

View file

@ -268,7 +268,7 @@ var systemsLoop = maketimer(0.1, func {
systems.APUController.loop(); systems.APUController.loop();
systems.HFLoop(); systems.HFLoop();
if ((getprop("/controls/pneumatics/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/nose") == 0 and getprop("/services/chocks/left") == 0 and getprop("/services/chocks/right") == 0))) { if ((getprop("/controls/pneumatics/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/enable") == 0))) {
setprop("/controls/electrical/ground-cart", 0); setprop("/controls/electrical/ground-cart", 0);
setprop("/controls/pneumatics/switches/groundair", 0); setprop("/controls/pneumatics/switches/groundair", 0);
} }

View file

@ -74,7 +74,7 @@ var arrivalPage = {
if (fmgc.flightPlanController.flightplans[2].approach != nil) { if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0") { if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
} elsif (isNoVia[2] == 1) { } elsif (isNoVia[2] == 1) {
@ -98,7 +98,7 @@ var arrivalPage = {
} else { } else {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0") { if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") {
if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans; me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans;
} elsif (isNoVia[me.computer] == 1) { } elsif (isNoVia[me.computer] == 1) {
@ -107,7 +107,7 @@ var arrivalPage = {
} }
} elsif (fmgc.flightPlanController.flightplans[2].approach != nil) { } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0") { if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
} }
@ -232,7 +232,7 @@ var arrivalPage = {
}, },
updateActiveVIAs: func() { updateActiveVIAs: func() {
if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; }
if (me.selectedVIA == "NO VIA") { if (me.selectedVIA == "NO VIA") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
@ -503,7 +503,7 @@ var arrivalPage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateVIAs: func() { updateVIAs: func() {
if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; }
if (me.selectedApproach == nil or me.activePage != 2) { if (me.selectedApproach == nil or me.activePage != 2) {
me.clearVias(); me.clearVias();
return; return;
@ -746,7 +746,7 @@ var arrivalPage = {
}, },
arrPushbuttonLeft: func(index) { arrPushbuttonLeft: func(index) {
if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) { if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) {
if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; }
me.oldPage = me.activePage; me.oldPage = me.activePage;
me.activePage = 2; me.activePage = 2;
me.updatePage(); me.updatePage();

View file

@ -167,7 +167,7 @@ var dirTo = {
# fix # fix
var fix = findFixesByID(text); var fix = findFixesByID(text);
if (size(fix) == 0) { if (size(fix) == 0) {
notInDataBase(me.computer); mcdu_message(me.computer, "NOT IN DATA BASE");
} }
if (size(fix) == 1 or override) { if (size(fix) == 1 or override) {
@ -189,7 +189,7 @@ var dirTo = {
# airport # airport
var airport = findAirportsByICAO(text); var airport = findAirportsByICAO(text);
if (size(airport) == 0) { if (size(airport) == 0) {
notInDataBase(me.computer); mcdu_message(me.computer, "NOT IN DATA BASE");
} }
if (size(airport) == 1 or override) { if (size(airport) == 1 or override) {
@ -211,7 +211,7 @@ var dirTo = {
# navaid # navaid
var navaid = findNavaidsByID(text); var navaid = findNavaidsByID(text);
if (size(navaid) == 0) { if (size(navaid) == 0) {
notInDataBase(me.computer); mcdu_message(me.computer, "NOT IN DATA BASE");
} }
if (size(navaid) == 1 or override) { if (size(navaid) == 1 or override) {
@ -254,6 +254,7 @@ var dirTo = {
dirToFlag = 0; dirToFlag = 0;
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
me.L1 = [" [ ]", " WAYPOINT", "blu"]; me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
me.R1 = ["---- --- ", "UTC DIST ", "wht"]; me.R1 = ["---- --- ", "UTC DIST ", "wht"];
} else { } else {
mcdu_message(me.computer, "NOT ALLOWED"); mcdu_message(me.computer, "NOT ALLOWED");
@ -264,6 +265,7 @@ var dirTo = {
dirToFlag = 0; dirToFlag = 0;
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
me.L1 = [" [ ]", " WAYPOINT", "blu"]; me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
me.R1 = ["---- --- ", "UTC DIST ", "wht"]; me.R1 = ["---- --- ", "UTC DIST ", "wht"];
setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna? setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna?
} else { } else {

View file

@ -156,33 +156,73 @@ var fplnItem = {
setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV"); setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV");
}, },
pushButtonRight: func() { pushButtonRight: func() {
if (canvas_mcdu.myVertRev[me.computer] != nil) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 0) {
canvas_mcdu.myVertRev[me.computer].del(); if (canvas_mcdu.myVertRev[me.computer] != nil) {
} canvas_mcdu.myVertRev[me.computer].del();
canvas_mcdu.myVertRev[me.computer] = nil; }
canvas_mcdu.myVertRev[me.computer] = nil;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) {
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); } if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) {
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
}
} else { } else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); if (me.index == fmgc.flightPlanController.arrivalIndex[2]) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
}
}
setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
} elsif (me.index != 0) { # todo - only apply to climb, descent, or missed waypoints
var scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad;
if (scratchpadStore == "CLR") {
me.wp.setSpeed("delete");
me.wp.setAltitude("delete");
mcdu_scratchpad.scratchpads[me.computer].empty();
} elsif (find("/", scratchpadStore) != -1) {
var scratchpadSplit = split("/", scratchpadStore);
if (size(scratchpadSplit[0]) == 0) {
if (num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) {
me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
} else {
if (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and
num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) {
me.wp.setSpeed(scratchpadSplit[0], "at");
me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} elsif (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and size(scratchpadSplit[1]) == 0) {
me.wp.setSpeed(scratchpadSplit[0], "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} else {
mcdu_message(me.computer, "FORMAT ERROR");
}
}
} elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3 and scratchpadStore >= 100 and scratchpadStore <= 350) {
me.wp.setSpeed(scratchpadStore, "at");
mcdu_scratchpad.scratchpads[me.computer].empty();
} else {
mcdu_message(me.computer, "FORMAT ERROR");
} }
} else { } else {
if (me.index == fmgc.flightPlanController.arrivalIndex[2]) { mcdu_message(me.computer, "NOT ALLOWED");
canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan);
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
} else {
canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan);
}
} }
setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV");
}, },
}; };
@ -446,11 +486,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th
} }
} else { } else {
if (size(me.outputList) >= index) { if (size(me.outputList) >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) { me.outputList[index - 1].pushButtonRight();
mcdu_message(me.computer, "NOT ALLOWED");
} else {
me.outputList[index - 1].pushButtonRight();
}
} else { } else {
mcdu_message(me.computer, "NOT ALLOWED"); mcdu_message(me.computer, "NOT ALLOWED");
} }

View file

@ -148,14 +148,9 @@ var fuelPredInput = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} else { } else {
if (!getprop("/FMGC/internal/cost-index-set")) { var zfw_min = 80.6; #make based on performance
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); var zfw_max = 134.5; #61,000 kg, make based on performance
setprop("/FMGC/internal/cost-index-set", 1); if (size(scratchpad) == 0) {
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index"));
}
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/zfw-set", 1);
@ -167,26 +162,45 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/block-confirmed", 1);
} }
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) { mcdu_scratchpad.scratchpads[i].empty();
} else if (find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad); var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]); var zfw = num(zfwi[0]);
var zfw = num(zfwi[1]); var zfwcg = num(zfwi[1]);
var zfwcgs = size(zfwi[0]); var zfws = size(zfwi[0]);
var zfws = size(zfwi[1]); var zfwcgs = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) { if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
setprop("/FMGC/internal/zfwcg", zfwcg); if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfw", zfw);
if (getprop("/FMGC/internal/block-set") != 1) { setprop("/FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/block-set", 1); setprop("/FMGC/internal/zfwcg-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1); if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
} }
} else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");
} }
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) {
setprop("/FMGC/internal/zfw", zfw); if (scratchpad >= zfw_min and scratchpad <= zfw_max) {
setprop("/FMGC/internal/zfw", scratchpad);
setprop("/FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/zfw-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) { if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
@ -196,35 +210,19 @@ var fuelPredInput = func(key, i) {
setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1); setprop("/FMGC/internal/block-confirmed", 1);
} }
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
if (getprop("/FMGC/internal/block-set") != 1) {
setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000));
setprop("/FMGC/internal/block-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }
if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) {
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0);
}
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {

View file

@ -20,9 +20,12 @@ var initInputB = func(key, i) {
if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) { if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) {
setprop("/FMGC/internal/taxi-fuel", scratchpad); setprop("/FMGC/internal/taxi-fuel", scratchpad);
setprop("/FMGC/internal/taxi-fuel-set", 1); setprop("/FMGC/internal/taxi-fuel-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateFuel();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }
@ -148,14 +151,9 @@ var initInputB = func(key, i) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} else { } else {
if (!getprop("/FMGC/internal/cost-index-set")) { var zfw_min = 80.6; #make based on performance
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); var zfw_max = 134.5; #61,000 kg, make based on performance
setprop("/FMGC/internal/cost-index-set", 1); if (size(scratchpad) == 0) {
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index"));
}
var tfs = size(scratchpad);
if (tfs == 0) {
var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs");
setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1)));
setprop("/FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/zfw-set", 1);
@ -171,18 +169,49 @@ var initInputB = func(key, i) {
} else if (getprop("/FMGC/internal/fuel-request-set")) { } else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1); setprop("/FMGC/internal/block-calculating", 1);
} }
} else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) { mcdu_scratchpad.scratchpads[i].empty();
} else if (find("/", scratchpad) != -1) {
var zfwi = split("/", scratchpad); var zfwi = split("/", scratchpad);
var zfwcg = num(zfwi[0]); var zfw = num(zfwi[0]);
var zfw = num(zfwi[1]); var zfwcg = num(zfwi[1]);
var zfwcgs = size(zfwi[0]); var zfws = size(zfwi[0]);
var zfws = size(zfwi[1]); var zfwcgs = size(zfwi[1]);
if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) { if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
setprop("/FMGC/internal/zfwcg", zfwi[0]); if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg-set", 1); setprop("/FMGC/internal/zfw", zfw);
setprop("/FMGC/internal/zfw-set", 1);
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
setprop("/FMGC/internal/tow-set", 1);
setprop("/FMGC/internal/fuel-request-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1);
setprop("/FMGC/internal/block-calculating", 0);
setprop("/FMGC/internal/block-confirmed", 1);
} else if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 1);
} else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1);
}
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) {
if (zfwcg >= 8.0 and zfwcg <= 45.0) {
setprop("/FMGC/internal/zfwcg", zfwcg);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");
} }
if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) {
setprop("/FMGC/internal/zfw", zfwi[1]); if (scratchpad >= zfw_min and scratchpad <= zfw_max) {
setprop("/FMGC/internal/zfw", scratchpad);
setprop("/FMGC/internal/zfw-set", 1); setprop("/FMGC/internal/zfw-set", 1);
if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) { if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) {
setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel")));
@ -196,24 +225,19 @@ var initInputB = func(key, i) {
} else if (getprop("/FMGC/internal/fuel-request-set")) { } else if (getprop("/FMGC/internal/fuel-request-set")) {
setprop("/FMGC/internal/block-calculating", 1); setprop("/FMGC/internal/block-calculating", 1);
} }
}
if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) {
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else if (tfs >= 1 and tfs <= 5) {
var zfwcg = size(scratchpad);
if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) {
setprop("/FMGC/internal/zfwcg", scratchpad);
setprop("/FMGC/internal/zfwcg-set", 1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
} }
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }
if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) {
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0);
}
} }
} else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) { } else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {

View file

@ -59,7 +59,6 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/alt-set", 0); setprop("/FMGC/internal/alt-set", 0);
setprop("/FMGC/internal/cost-index", "0"); setprop("/FMGC/internal/cost-index", "0");
setprop("/FMGC/internal/cost-index-set", 0); setprop("/FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/last-cost-index", 0);
setprop("/FMGC/internal/cruise-ft", 10000); setprop("/FMGC/internal/cruise-ft", 10000);
setprop("/FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/cruise-fl", 100);
setprop("/FMGC/internal/cruise-lvl-set", 0); setprop("/FMGC/internal/cruise-lvl-set", 0);
@ -88,7 +87,7 @@ var MCDU_reset = func(i) {
# INT-B # INT-B
setprop("/FMGC/internal/zfw", 0); setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfw-set", 0); setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg", 55.1); setprop("/FMGC/internal/zfwcg", 25.0);
setprop("/FMGC/internal/zfwcg-set", 0); setprop("/FMGC/internal/zfwcg-set", 0);
setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/block-set", 0); setprop("/FMGC/internal/block-set", 0);
@ -168,7 +167,7 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/dest-mag", -1); setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1); setprop("/FMGC/internal/dest-wind", -1);
# setprop("/FMGC/internal/dest-mag-grnd", -1); # setprop("/FMGC/internal/dest-mag-grnd", -1);
# setprop("/FMGC/internal/dest-wind-grnd", -1); # setprop("/FMGC/internal/dest-wind-grnd", -1);
setprop("/FMGC/internal/vapp-speed-set", 0); setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/FMGC/internal/final", ""); setprop("/FMGC/internal/final", "");
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);

View file

@ -68,7 +68,7 @@ var radnavInput = func(key, i) {
setprop("/FMGC/internal/ils1freq-set", 1); setprop("/FMGC/internal/ils1freq-set", 1);
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) { if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) {
genericMessage(i, "RWY/LS MISMATCH", "amb"); mcdu_message(i, "RWY/LS MISMATCH");
} }
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");

View file

@ -169,7 +169,7 @@ var BrakeSystem =
var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel;
LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2);
if (getprop("services/chocks/left")) { if (getprop("services/chocks/enable")) {
if (!getprop("controls/gear/brake-parking")) { if (!getprop("controls/gear/brake-parking")) {
# cooling effect: reduce thermal energy by (LnCoolFactor) * dt # cooling effect: reduce thermal energy by (LnCoolFactor) * dt
LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt);
@ -202,7 +202,7 @@ var BrakeSystem =
}; };
RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2);
if (getprop("services/chocks/right")) { if (getprop("services/chocks/enable")) {
if (!getprop("controls/gear/brake-parking")) { if (!getprop("controls/gear/brake-parking")) {
# cooling effect: reduce thermal energy by (RnCoolFactor) * dt # cooling effect: reduce thermal energy by (RnCoolFactor) * dt
RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt);

View file

@ -20,9 +20,7 @@ var ground_services = {
# Set them all to 0 if the aircraft is not stationary # Set them all to 0 if the aircraft is not stationary
if (getprop("velocities/groundspeed-kt") >= 2) { if (getprop("velocities/groundspeed-kt") >= 2) {
setprop("services/chocks/nose", 0); setprop("services/chocks/enable", 0);
setprop("services/chocks/left", 0);
setprop("services/chocks/right", 0);
setprop("services/fuel-truck/enable", 0); setprop("services/fuel-truck/enable", 0);
setprop("services/deicing_truck/enable", 0); setprop("services/deicing_truck/enable", 0);
setprop("services/catering/enable", 0); setprop("services/catering/enable", 0);

View file

@ -930,16 +930,10 @@
<c1>20</c1> <c1>20</c1>
</lag_filter> </lag_filter>
<pure_gain name="/services/chocks/nose-half">
<input>/services/chocks/nose</input>
<gain>0.5</gain>
</pure_gain>
<summer name="fcs/left-brake-summer"> <summer name="fcs/left-brake-summer">
<input>/controls/gear/brake-left</input> <input>/controls/gear/brake-left</input>
<input>/controls/gear/brake-parking</input> <input>/controls/gear/brake-parking</input>
<input>/services/chocks/nose-half</input> <input>/services/chocks/enable</input>
<input>/services/chocks/left</input>
<clipto> <clipto>
<min>0</min> <min>0</min>
<max>1</max> <max>1</max>
@ -957,8 +951,7 @@
<summer name="fcs/right-brake-summer"> <summer name="fcs/right-brake-summer">
<input>/controls/gear/brake-right</input> <input>/controls/gear/brake-right</input>
<input>/controls/gear/brake-parking</input> <input>/controls/gear/brake-parking</input>
<input>/services/chocks/nose-half</input> <input>/services/chocks/enable</input>
<input>/services/chocks/right</input>
<clipto> <clipto>
<min>0</min> <min>0</min>
<max>1</max> <max>1</max>