diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index 0281b084..669a0685 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -973,7 +973,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); diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index 81af304e..d2127c8a 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -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); },