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 committed by legoboyvdlp R
parent d20ce066fa
commit f99479d842
2 changed files with 10 additions and 2 deletions

View file

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

View file

@ -42,8 +42,9 @@ var formatSecToHHMM = func(sec) {
var FlightLogDatabase = {
database: std.Vector.new(),
pages: std.Vector.new(),
currpageindex: 0,
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);
var pg = me.pages.vector[me.pages.size()-1];
pg.fltnum = report.fltnum;
@ -65,6 +66,9 @@ var FlightLogDatabase = {
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() {
return me.database.size();
},
@ -82,6 +86,10 @@ var FlightLogDatabase = {
}
return lst;
},
addPage: func() {
me.currpageindex = me.getSize();
me.pages.append( OOOIReportPage.new(me.getSize()) );
},
getPage: func(pg) {
return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0);
},