1
0
Fork 0

cleaning the code

This commit is contained in:
Inuyaksa 2021-01-20 21:25:37 +01:00 committed by legoboyvdlp R
parent 2dbd7d5c7a
commit e1a0be5401
4 changed files with 38 additions and 62 deletions

View file

@ -2797,60 +2797,49 @@ var canvas_MCDU_base = {
me.showRight(-1, 1, 1, 1, 1, 1);
me.showRightS(-1, 1, 1, 1, 1, -1);
me.showRightArrow(-1, -1, -1, -1, -1, -1);
#me.showCenter(-1, -1, 1, -1, -1, -1);
#me.showCenterS(-1, -1, 1, -1, -1, -1);
#me["Simple_C3B"].hide();
#me["Simple_C4B"].hide();
#me.fontLeft(default, default, default, default, default, default);
#me.fontLeftS(default, default, default, default, default, default);
#me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
me.fontSizeLeftS(normal, normal, normal, normal, normal, normal);
#me.fontRight(default, default, default, default, default, default);
#me.fontRightS(default, default, default, default, default, default);
me.fontSizeRight(0, small, small, small, small, normal);
me.fontSizeRightS(0, small, small, small, small, normal);
me.colorLeft("grn", "grn", "grn", "grn", "grn", "wht");
me.colorLeftS("grn", "grn", "grn", "grn", "grn", "wht");
#me.colorCenter("grn", "ack", "amb", "ack", "ack", "wht");
me.colorRight("ack", "wht", "wht", "wht", "wht", "amb");
me.colorRightS("ack", "wht", "wht", "wht", "wht", "wht");
pageSwitch[i].setBoolValue(1);
me["Simple_L1"].setText("NONE");
me["Simple_L6"].setText(" RETURN");
me["Simple_R6"].setText("INSERT ");
me["PRINTPAGE"].show();
me["PRINTPAGE"].setColor(AMBER);
var rows = ["2S","2","3S","3","4S","4","5S","5"];
me["Simple_L1"].setText("DUBLHR1");
var r = 0;
#for ( ; r < 8; r += 1) { # Example how formats rows with 4 cols
# me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA"));
# me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975"));
#}
while (r<8) {
me["Simple_L" ~ rows[r]].setText("");
me["Simple_R" ~ rows[r]].setText("");
r+=1;
}
if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) {
me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt));
} else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) {
me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport));
} else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) {
me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport));
} else {
me["Simple_Title"].setText("ROUTE SELECTION");
}
pageSwitch[i].setBoolValue(1); # update on request only (left/right arrows)
}
me["Simple_L1"].setText("NONE");
me["Simple_L6"].setText(" RETURN");
me["Simple_R6"].setText("INSERT ");
me["PRINTPAGE"].show();
me["PRINTPAGE"].setColor(AMBER);
var rows = ["2S","2","3S","3","4S","4","5S","5"];
me["Simple_L1"].setText("DUBLHR1");
var r = 0;
for ( ; r < 8; r += 1) {
me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA"));
me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975"));
}
while (r<8) {
me["Simple_L" ~ rows[r]].setText("");
me["Simple_R" ~ rows[r]].setText("");
r+=1;
}
if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) {
me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt));
} else if (!fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) {
me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.altAirport));
} else if (fmgc.FMGCInternal.toFromSet and fmgc.FMGCInternal.altAirport != "" and fmgc.FMGCInternal.altSelected) {
me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.arrApt ~ "/" ~ fmgc.FMGCInternal.altAirport));
} else {
me["Simple_Title"].setText("ROUTE SELECTION");
}
} else if (page == "INITB") {
if (!pageSwitch[i].getBoolValue()) {
me["Simple"].show();

View file

@ -49,7 +49,7 @@ var SimbriefParser = {
me.failure(i);
}
},
checkValid: func(xml) {
validateFile: func(xml) {
var data = io.readxml(xml);
if (data != nil) {
return (data.getChild("OFP") != nil);
@ -188,6 +188,7 @@ var SimbriefParser = {
#setprop("/autopilot/route-manager/vnav/tc/latitude-deg",ofpFix.getNode("pos_lat").getValue());
#setprop("/autopilot/route-manager/vnav/tc/longitude-deg",ofpFix.getNode("pos_long").getValue());
#ident = "(T/C)";
continue; # restore skip TOC/TOD
}
if (ident == "TOD") {
@ -195,6 +196,7 @@ var SimbriefParser = {
#setprop("/autopilot/route-manager/vnav/td/latitude-deg",ofpFix.getNode("pos_lat").getValue());
#setprop("/autopilot/route-manager/vnav/td/longitude-deg",ofpFix.getNode("pos_long").getValue());
#ident = "(T/D)";
continue; # restore skip TOC/TOD
}
coords = geo.Coord.new();

View file

@ -176,13 +176,13 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision
expectedOOOIState = 0;
}
}
else if (!gear0) { # OFF without IN -> To without stop and opening doors
else if (!gear0) { # OFF without IN -> TO without stop and opening doors
if (lastgear0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgear0)); # IN (estimated)
FlightLogDatabase.addPage();
if (lastgsrestart) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated)
expectedOOOIState = 1; # watch for OFF state
expectedOOOIState = 1; # go on to OFF state
}
else if (gs > 9 and lastgsrestart == 0) { # try to decect OFF without IN
else if (gs > 9 and lastgsrestart == 0) { # try to detect OFF without IN
lastgsrestart = int(getprop("/sim/time/elapsed-sec"));
}
}

View file

@ -1,22 +1,7 @@
# Copyright (c) 2020 Matthew Maring (mattmaring)
# enhanced inuyaksa*2021
var initInputROUTESEL = func(key, i) {
if (key == "L6") {
setprop("MCDU[" ~ i ~ "]/page", "INITA");
}
}
var RouteSelManager = {
leglist: nil,
loadFlightplan: func(path) {
if (right(path,4) == ".xml") { # plan from SimBrief?
if (SimBrief.isValid(path)) {
leglist = SimBrief.readLegs(path);
}
}
}
}