diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html index a55885f4..affaa8de 100644 --- a/Htmldocs/release_notes.html +++ b/Htmldocs/release_notes.html @@ -17,8 +17,13 @@

Changes and fixes in OSCAR v1.2.0 diff --git a/oscar/SleepLib/loader_plugins/resmed_loader.cpp b/oscar/SleepLib/loader_plugins/resmed_loader.cpp index 4a2700f4..33fd4798 100644 --- a/oscar/SleepLib/loader_plugins/resmed_loader.cpp +++ b/oscar/SleepLib/loader_plugins/resmed_loader.cpp @@ -1203,8 +1203,9 @@ bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap & STRmap, qint32 on = maskon->dataArray[recstart + s]; qint32 off = maskoff->dataArray[recstart + s]; - if (((on >= 0) && (off >= 0)) && (on != off)) // ignore very short on-off times - validday=true; + if (((on >= 0) && (off >= 0)) && (on != off)) {// ignore very short on-off times + validday=true; + } } if ( ! validday) { // There are no mask on/off events, so this STR day is useless. @@ -1239,6 +1240,10 @@ bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap & STRmap, for (int s = 0; s < maskon->sampleCnt; ++s) { qint32 on = maskon->dataArray[recstart + s]; // these on/off times are minutes since noon qint32 off = maskoff->dataArray[recstart + s]; + if ( (on > 24*60) || (off > 24*60) ) { + qWarning().noquote() << "Mask times are out of range. Possible SDcard corruption" << "date" << date << "on" << on << "off" < 0 ) { // convert them to seconds since midnight lastOn = s; R.maskon[s] = (noonstamp + (on * 60)); @@ -1620,6 +1625,7 @@ bool ResmedLoader::ProcessSTRfiles(Machine *mach, QMap & STRmap, // Parse Identification.tgt file (containing serial number and machine information) /////////////////////////////////////////////////////////////////////////////////// QHash parseIdentLine( const QString line, MachineInfo * info); //forward + bool parseIdentTGT( QString path, MachineInfo * info, QHash & idmap ) { QString filename = path + RMS9_STR_idfile + STR_ext_TGT; QFile f(filename); @@ -2140,11 +2146,16 @@ void ResDayTask::run() for (int i=0;istr.maskon.size();++i) { quint32 maskon = resday->str.maskon[i]; quint32 maskoff = resday->str.maskoff[i]; - if ( (maskon > QDateTime::currentDateTime().toTime_t()) || - (maskoff > QDateTime::currentDateTime().toTime_t()) ) { - qWarning() << "mask time in future" << resday->date << "now" << QDateTime::currentDateTime().toTime_t() << "maskon" << maskon << "maskoff" << maskoff; +/** + QTime noon(12,00,00); + QDateTime daybegin(resday->date,noon); // Beginning of ResMed day + quint32 dayend = daybegin.addDays(1).addMSecs(-1).toTime_t(); // End of ResMed day + if ( (maskon > dayend) || + (maskoff > dayend) ) { + qWarning() << "mask time in future" << resday->date << daybegin << dayend << "maskon" << maskon << "maskoff" << maskoff; continue; } +**/ if (((maskon>0) && (maskoff>0)) && (maskon != maskoff)) { //ignore very short sessions Session * sess = new Session(mach, maskon); sess->set_first(quint64(maskon) * 1000L); @@ -2182,12 +2193,22 @@ void ResDayTask::run() if (resday->str.date.isValid()) { //First populate Overlaps with Mask ON/OFF events for (int i=0; i < maskOnSize; ++i) { - if ( (resday->str.maskon[i] > QDateTime::currentDateTime().toTime_t()) || - (resday->str.maskoff[i] > QDateTime::currentDateTime().toTime_t()) ) { - qWarning() << "mask time in future" << resday->date << "now" << QDateTime::currentDateTime().toTime_t() << "maskon" << resday->str.maskon[i] << "maskoff" << resday->str.maskoff[i]; +// if ( (resday->str.maskon[i] > QDateTime::currentDateTime().toTime_t()) || +// (resday->str.maskoff[i] > QDateTime::currentDateTime().toTime_t()) ) { +// qWarning() << "mask time in future" << resday->date << "now" << QDateTime::currentDateTime().toTime_t() << "maskon" << resday->str.maskon[i] << "maskoff" << resday->str.maskoff[i]; +// continue; +// } +/* + QTime noon(12,00,00); + QDateTime daybegin(resday->date,noon); // Beginning of ResMed day + quint32 dayend = daybegin.addDays(1).addMSecs(-1).toTime_t(); // End of ResMed day + if ( (resday->str.maskon[i] > dayend) || + (resday->str.maskoff[i] > dayend) ) { + qWarning() << "mask time in future" << resday->date << "daybegin:" << daybegin << "dayend:" << dayend << "maskon" << resday->str.maskon[i] << "maskoff" << resday->str.maskoff[i]; continue; } - if (((resday->str.maskon[i]>0) || (resday->str.maskoff[i]>0)) +*/ + if (((resday->str.maskon[i]>0) || (resday->str.maskoff[i]>0)) && (resday->str.maskon[i] != resday->str.maskoff[i]) ) { OverlappingEDF ov; ov.start = resday->str.maskon[i]; @@ -2233,11 +2254,16 @@ void ResDayTask::run() } if ( ! added) { // Didn't get a hit, look at the EDF files duration and check for an overlap EDFduration dur = getEDFDuration(fullpath); - if ((dur.start > (QDateTime::currentDateTime().toMSecsSinceEpoch()/1000L)) || - (dur.end > (QDateTime::currentDateTime().toMSecsSinceEpoch()/1000L)) ) { - qWarning() << "Future Date in" << fullpath << "now" << QDateTime::currentDateTime().toSecsSinceEpoch() << "maskon" << dur.start << "maskoff" << dur.end; - continue; // skip this file +/** + QTime noon(12,00,00); + QDateTime daybegin(resday->date,noon); // Beginning of ResMed day + quint32 dayend = daybegin.addDays(1).addMSecs(-1).toTime_t(); // End of ResMed day + if ((dur.start > (dayend)) || + (dur.end > (dayend)) ) { + qWarning() << "Future Date in" << fullpath << "dayend" << dayend << "dur.start" << dur.start << "dur.end" << dur.end; + continue; // skip this file } +**/ for (int i=overlaps.size()-1; i>=0; --i) { OverlappingEDF & ovr = overlaps[i]; if ((ovr.start < dur.end) && (dur.start < ovr.end)) { @@ -2438,8 +2464,8 @@ void ResDayTask::run() // loader->saveMutex.lock(); // loader->saveMutex.unlock(); - if ( (QDateTime::fromTime_t(sess->session()) > QDateTime::currentDateTime()) || - (sess->realFirst() == 0) || (sess->realLast() == 0) ) +// if ( (QDateTime::fromTime_t(sess->session()) > QDateTime::currentDateTime()) || + if ( (sess->realFirst() == 0) || (sess->realLast() == 0) ) qWarning().noquote() << "Skipping future or absent date session:" << sess->session() << "["+QDateTime::fromTime_t(sess->session()).toString("MMM dd, yyyy hh:mm:ss")+"]" << "\noriginal date is" << resday->date.toString() diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp index e07d06cc..0393f405 100644 --- a/oscar/mainwindow.cpp +++ b/oscar/mainwindow.cpp @@ -748,6 +748,9 @@ int MainWindow::importCPAP(ImportPath import, const QString &message) void MainWindow::finishCPAPImport() { + if (daily) + daily->Unload(daily->getDate()); + p_profile->StoreMachines(); QList machines = p_profile->GetMachines(MT_CPAP); for (Machine * mach : machines) { @@ -1818,10 +1821,13 @@ void MainWindow::on_actionPurge_Current_Day_triggered() QList list; for (s = day->begin(); s != day->end(); ++s) { - list.append(*s); - qDebug() << "Purging session ID:" << (*s)->session() << "["+QDateTime::fromTime_t((*s)->session()).toString()+"]"; - qDebug() << "First Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realFirst()).toString(); - qDebug() << "Last Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realLast()).toString(); + Session *sess = *s; + if (sess->type() == MT_CPAP) { + list.append(*s); + qDebug() << "Purging session ID:" << (*s)->session() << "["+QDateTime::fromTime_t((*s)->session()).toString()+"]"; + qDebug() << "First Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realFirst()).toString(); + qDebug() << "Last Time:" << QDateTime::fromMSecsSinceEpoch((*s)->realLast()).toString(); + } } QFile rxcache(p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" )); @@ -2562,6 +2568,7 @@ void MainWindow::on_actionPurgeCurrentDaysOximetry_triggered() if (daily) { + daily->Unload(date); daily->clearLastDay(); // otherwise Daily will crash daily->ReloadGraphs(); }