diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp
index 4fe74694..4f1cf5a6 100644
--- a/Graphs/gGraphView.cpp
+++ b/Graphs/gGraphView.cpp
@@ -1230,7 +1230,9 @@ void gGraph::mouseMoveEvent(QMouseEvent * event)
double w2=m_lastbounds.width()-right-left; //-(right+m_marginright)-(m_marginleft+left);
if (m_blockzoom) {
xmult=(rmax_x-rmin_x)/w2;
- } else xmult=(max_x-min_x)/w2;
+ } else {
+ xmult=(max_x-min_x)/w2;
+ }
qint64 a=double(a2-a1)*xmult;
float d=double(a)/86400000.0;
int h=a/3600000;
@@ -2050,7 +2052,11 @@ void gGraphView::ResetBounds(bool refresh) //short group)
int ms(xx % 1000);
QString str;
if (d>1) {
- str.sprintf("%1.0f days",ceil(double(xx)/86400000.0));
+ /*QDate d1=QDateTime::fromTime_t(m_minx/1000).toUTC().date();
+ QDate d2=QDateTime::fromTime_t(m_maxx/1000).toUTC().date();
+ d=PROFILE.countDays(MT_CPAP,d1,d2); */
+
+ str.sprintf("%1.0f days",ceil(d));
} else {
str.sprintf("%02i:%02i:%02i:%03i",h,m,s,ms);
}
diff --git a/Graphs/gSummaryChart.cpp b/Graphs/gSummaryChart.cpp
index 67843ca7..2448725b 100644
--- a/Graphs/gSummaryChart.cpp
+++ b/Graphs/gSummaryChart.cpp
@@ -169,6 +169,10 @@ void SummaryChart::SetDay(Day * nullday)
m_goodcodes[j]=true;
fnd=true;
break;
+ } else {
+ if (code==CPAP_PressureMin) {
+ int i=5;
+ }
}
}
}
diff --git a/SleepLib/day.cpp b/SleepLib/day.cpp
index 6a494f55..de5049d9 100644
--- a/SleepLib/day.cpp
+++ b/SleepLib/day.cpp
@@ -113,20 +113,21 @@ EventDataType Day::settings_avg(ChannelID code)
}
EventDataType Day::settings_wavg(ChannelID code)
{
- double s0=0,s1=0,s2=0;
+ double s0=0,s1=0,s2=0,tmp;
for (QVector::iterator s=sessions.begin();s!=sessions.end();s++) {
Session & sess=*(*s);
QHash::iterator i=sess.settings.find(code);
if (i!=sess.settings.end()) {
s0=sess.hours();
- s1+=i.value().toDouble()*s0;
+ tmp=i.value().toDouble();
+ s1+=tmp*s0;
s2+=s0;
}
}
if (s2==0) return 0;
- return (s1/s2);
-
+ tmp=(s1/s2);
+ return tmp;
}
EventDataType Day::percentile(ChannelID code,EventDataType percentile)
{
diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp
index 7dd39ce4..8e92b725 100644
--- a/SleepLib/loader_plugins/resmed_loader.cpp
+++ b/SleepLib/loader_plugins/resmed_loader.cpp
@@ -25,6 +25,7 @@ extern QProgressBar *qprogress;
QHash RMS9ModelMap;
QHash > resmed_codes;
+// Looks up foreign language Signal names that match this channelID
EDFSignal * EDFParser::lookupSignal(ChannelID ch)
{
QHash >::iterator ci;
@@ -177,7 +178,7 @@ bool EDFParser::Parse()
memcpy((char *)&sig.data[sig.pos],(char *)&buffer[pos],sig.nr*2);
sig.pos+=sig.nr;
pos+=sig.nr*2;
- // big endian will screw up without this..
+ // big endian will probably screw up without this..
/*for (int j=0;jproperties[STR_PROP_Model]=""; //i.value();
- } else if (i.key()=="PCD") {
+ } else if (i.key()=="PCD") { // Product Code..
bool ok;
int j=i.value().toInt(&ok);
if (RMS9ModelMap.find(j)!=RMS9ModelMap.end()) {
@@ -405,7 +409,7 @@ int ResmedLoader::Open(QString & path,Profile *profile)
//}
}
}
- if (qprogress) qprogress->setValue(33.0+(float(++cnt)/float(size)*33.0));
+ if (qprogress) qprogress->setValue(33.0+(float(++cnt)/float(size)*66.0));
QApplication::processEvents();
EDFSignal *sig;
@@ -441,11 +445,6 @@ int ResmedLoader::Open(QString & path,Profile *profile)
if (sig) {
EventDataType pressure=sig->data[dn]*sig->gain;
sess->settings[CPAP_PressureMin]=pressure;
- //sess->setWavg(CPAP_Pressure,pressure);
- //sess->setAvg(CPAP_Pressure,pressure);
- //sess->set90p(CPAP_Pressure,pressure);
- //sess->setMax(CPAP_Pressure,pressure);
- //sess->setMin(CPAP_Pressure,pressure);
}
} else {
if (mode>5) {
@@ -469,6 +468,32 @@ int ResmedLoader::Open(QString & path,Profile *profile)
}
}
+
+
+ // The following only happens when the STR.edf file is not up to date..
+ // This will only happen when the user fails to back up their SDcard properly.
+ // Basically takes a guess.
+ if (!sess->settings.contains(CPAP_Mode)) {
+ //The following is a lame assumption if 50th percentile == max, then it's CPAP
+ EventDataType p50=sess->percentile(CPAP_Pressure,0.50);
+ EventDataType max=sess->Max(CPAP_Pressure);
+ if (max==p50) {
+ sess->settings[CPAP_Mode]=MODE_CPAP;
+ sess->settings[CPAP_PressureMin]=p50;
+ } else {
+ // It's not cpap, so just take the highest setting for this machines history.
+ // This may fail if the missing str data is at the beginning of a fresh import.
+ CPAPMode mode=(CPAPMode)(int)PROFILE.calcSettingsMax(CPAP_Mode,MT_CPAP,sess->machine()->FirstDay(),sess->machine()->LastDay());
+ if (modesettings[CPAP_Mode]=mode;
+ // Assuming 10th percentile should cover for ramp/warmup
+ sess->settings[CPAP_PressureMin]=sess->percentile(CPAP_Pressure,0.10);
+ sess->settings[CPAP_PressureMax]=sess->Max(CPAP_Pressure);
+ }
+ }
+ //Rather than take a dodgy guess, EPR settings can take a hit, and this data can simply be missed..
+
+ // Add the session to the machine & profile objects
m->AddSession(sess,profile); // Adding earlier than I really like here..
}
}
diff --git a/daily.cpp b/daily.cpp
index d63ee840..bf45bb06 100644
--- a/daily.cpp
+++ b/daily.cpp
@@ -533,6 +533,9 @@ void Daily::UpdateCalendarDay(QDate date)
void Daily::LoadDate(QDate date)
{
ui->calendar->blockSignals(true);
+ if (date.month()!=previous_date.month()) {
+ on_calendar_currentPageChanged(date.year(),date.month());
+ }
ui->calendar->setSelectedDate(date);
ui->calendar->blockSignals(false);
on_calendar_selectionChanged();
@@ -900,8 +903,9 @@ void Daily::Load(QDate date)
html+=QString("%1 | %2 |
").arg(tr("Flex"))
.arg(flexstr);
+ int humid=cpap->settings_max(PRS1_HumidSetting);
html+=QString("%1 | %2 |
").arg(tr("Humidifier"))
- .arg(cpap->settings_max(PRS1_HumidSetting)==0 ? STR_GEN_Off : "x"+QString::number(i));
+ .arg(humid==0 ? STR_GEN_Off : "x"+QString::number(humid));
} else if (cpap->machine->GetClass()==STR_MACH_ResMed) {
int epr=cpap->settings_max(RMS9_EPR);
int epr2=cpap->settings_max(RMS9_EPRSet);
diff --git a/docs/release_notes.html b/docs/release_notes.html
index 10873764..3e983822 100644
--- a/docs/release_notes.html
+++ b/docs/release_notes.html
@@ -12,13 +12,13 @@
Auto-Updater for Windows & Mac Platforms
SleepLib database improvements, and lots of other underneath stuff and code cleanups you don't see.
-New Summary page showing some useful text statistics.
+New Statistics page showing some more useful data.
Welcome page has become a Help Browser.
New Navigation Panel on the right side, now accessible from all tabs. It can be hidden to reclaim screen space.
New Favourites tab in this right panel for bookmarking days and quickly finding them again.
New Records tab to show some best/worst entries, which have links going directly to the related day or overview range.
Daily reports bookmarked areas show oximetry data when available.
-Can print from both the Summary & Help Browser pages.
+Can print from both the Statistics & Help Browser pages.
New Context cube can be switched on to make empty pages more attractive.
Plenty of other bug fixes, including more oximetry fixes.
diff --git a/mainwindow.cpp b/mainwindow.cpp
index b0d80f80..74c67e7e 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -742,14 +742,14 @@ void MainWindow::on_summaryButton_clicked()
EventDataType cmin=0,cmax=0,min,max;
QDate date=lastcpap;
Day * day;
- bool lastchanged;
+ bool lastchanged=false;
int cnt=0;
QVector rxchange;
do {
day=PROFILE.GetDay(date,MT_CPAP);
- lastchanged=false;
if (day) {
+ lastchanged=false;
EventDataType hours=day->hours();
@@ -766,6 +766,7 @@ void MainWindow::on_summaryButton_clicked()
bestAHIdate=date;
}
}
+
mode=(CPAPMode)round(day->settings_wavg(CPAP_Mode));
min=day->settings_min(CPAP_PressureMin);
if (mode==MODE_CPAP) {
@@ -836,11 +837,6 @@ void MainWindow::on_summaryButton_clicked()
if (rx.days>rxthresh)
tmpRX.push_back(&rx);
}
- RXsort=RX_ahi;
- qSort(tmpRX.begin(),tmpRX.end(),RXSort);
- tmpRX[0]->highlight=4; // worst
- int ls=tmpRX.size()-1;
- tmpRX[ls]->highlight=1; //best
QString recbox="