1
0
Fork 0

little modifications to fltlog - manage MCDU reset

This commit is contained in:
Inuyaksa 2021-01-16 14:27:55 +01:00
parent a559b17d1c
commit 533682abce
2 changed files with 10 additions and 2 deletions

View file

@ -973,7 +973,7 @@ var reset_FMGC = func {
mcdu.MCDU_reset(0); mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1); mcdu.MCDU_reset(1);
mcdu.ReceivedMessagesDatabase.clearDatabase(); mcdu.ReceivedMessagesDatabase.clearDatabase();
mcdu.FlightLogDatabase.clearDatabase(); mcdu.FlightLogDatabase.reset(); # track reset events without loosing recorded data
Input.fd1.setValue(fd1); Input.fd1.setValue(fd1);
Input.fd2.setValue(fd2); Input.fd2.setValue(fd2);

View file

@ -42,8 +42,9 @@ var formatSecToHHMM = func(sec) {
var FlightLogDatabase = { var FlightLogDatabase = {
database: std.Vector.new(), database: std.Vector.new(),
pages: std.Vector.new(), pages: std.Vector.new(),
currpageindex: 0,
addReport: func(report) { addReport: func(report) {
if (report.state == 0) me.pages.append( OOOIReportPage.new(me.getSize()) ); if (report.state == 0 or me.getPageSize()==0) me.addPage();
me.database.append(report); me.database.append(report);
var pg = me.pages.vector[me.pages.size()-1]; var pg = me.pages.vector[me.pages.size()-1];
pg.fltnum = report.fltnum; pg.fltnum = report.fltnum;
@ -65,6 +66,9 @@ var FlightLogDatabase = {
if (pg.blkstart > 0) pg.blktime = formatSecToHHMM(report.elapsed - pg.blkstart); if (pg.blkstart > 0) pg.blktime = formatSecToHHMM(report.elapsed - pg.blkstart);
} }
}, },
reset: func() {
if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage();
},
getSize: func() { getSize: func() {
return me.database.size(); return me.database.size();
}, },
@ -82,6 +86,10 @@ var FlightLogDatabase = {
} }
return lst; return lst;
}, },
addPage: func() {
me.currpageindex = me.getSize();
me.pages.append( OOOIReportPage.new(me.getSize()) );
},
getPage: func(pg) { getPage: func(pg) {
return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0); return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0);
}, },