Pack oximetry waveforms

This commit is contained in:
Mark Watkins 2011-11-25 07:19:45 +10:00
parent 4dcf19f284
commit 0e4fff4662
5 changed files with 79 additions and 31 deletions

View File

@ -37,6 +37,7 @@ public:
inline qint64 duration() { return m_last-m_first; } inline qint64 duration() { return m_last-m_first; }
void setFirst(qint64 val) { m_first=val; } void setFirst(qint64 val) { m_first=val; }
void setLast(qint64 val) { m_last=val; } void setLast(qint64 val) { m_last=val; }
void setType(EventListType type) { m_type=type; }
void setGain(EventDataType v) { m_gain=v; } void setGain(EventDataType v) { m_gain=v; }
void setOffset(EventDataType v) { m_offset=v; } void setOffset(EventDataType v) { m_offset=v; }

View File

@ -1,33 +1,30 @@
<html> <html>
<body> <body>
<h1><image src='qrc:/docs/sheep.png' width=64 height=64>SleepyHead v0.8.7</h1> <h1><image src='qrc:/docs/sheep.png' width=64 height=64>SleepyHead v0.8.8</h1>
<p><b>Please Note:</b> <i>This is still pre-Beta software. Expect bugs.</i></p> <p><b>Please Note:</b> <i>This is still pre-Beta software. Expect bugs.</i></p>
<p><h2><b>Release Notes</b></h2></p> <p><h2><b>Release Notes</b></h2></p>
<p>I've been a little less functional that usual since last time (fog, headaches, appendicitus, etc.. bleh), <p>Getting closer..</p>
however, I have still managed to cook up a few nice improvements...</p>
<p><b>What's New?</b><br/> <p><b>What's New?</b><br/>
<li>You can now Shift+Left Click on a day in an overview graph, and it will jump to that day in Daily tab.</li> <li>Intellipap Support</li>
<li>New calendar navigation bar allows easy hiding the calendar to get more room.</li> <li>Complete rewrite of Oximetery Tab, it's now (hopefully) working much better</li>
<li>Event count, duration and (relative) AHI is displayed above the flow rate waveform for selected area.</li> <li>Sync problems with Live serial CMS50 recording fixed.</li>
<li>Improved support for ResMed S9 ASV/VPAP Machines.</li> <li>Preference option to Skip Login Window</li>
<li>Added some basic CSV export capabilities (File Menu->Export).</li> <li>Can change how much data is shown around events selected in the Event List.</li>
<li>A new preference option to switch some daily graphs between square plots and normal line plots.</li> <li>Import now remembers your locations.. There is a preferences tab to edit common locations</li>
<li>Some graphing optimizations to improve performance.</li>
<li>Quite a few other little bugfixes I've forgotten about.</li> <li>Quite a few other little bugfixes I've forgotten about.</li>
<br/> <br/>
<b>What's still missing/broken?</b><br/> <b>What's still missing/broken?</b><br/>
<li>Oximetry.. still mostly broken. I will eventually get around to it...</li>
<li>Daily report printing still needs doing.</li> <li>Daily report printing still needs doing.</li>
<li>Plenty more I'm sure of it..</li> <li>Plenty more I'm sure of it..</li>
</p> </p>
<p><b>Problems & Stuff?</b><br/> <p><b>Problems & Stuff?</b><br/>
If I've still missed your bug, my appologies, I'm not deliberately ignoring you, I'm just rather darn forgetful and need reminding.</p>
<p>SourceForge is still the best place to report bugs, especially to do with these binary builds. If your following GIT source, they mailing list is (usually) much quicker in getting my attention.</p> <p>SourceForge is still the best place to report bugs, especially to do with these binary builds. If your following GIT source, they mailing list is (usually) much quicker in getting my attention.</p>
<p><b>Note:</b> If you experience a crash right after starting, you may need to manually remove the "SleepApp" folder, which resides under your documents directory.</p> <p><b>Note:</b> If you experience a crash right after starting this new version, you may need to manually remove the old "SleepApp" folder, which resides under your documents directory.</p>
<p><b>Thanks</b><br/> <p><b>Thanks</b><br/>
Thanks to all the wonderful people who have given their support to this project, be it via donations, Thanks to all the wonderful people who have given their support to this project, be it via donations,
sharing CPAP data, following GIT source tree, testing binary builds, submitting bug reports, giving ideas for improvement, and general feedback on the CPAP forums.</p> sharing CPAP data, following GIT source tree, testing binary builds, submitting bug reports, giving ideas for improvement, and general feedback on the CPAP forums.</p>

View File

@ -21,7 +21,7 @@
const int major_version=0; const int major_version=0;
const int minor_version=8; const int minor_version=8;
const int revision_number=7; const int revision_number=8;
extern Profile * profile; extern Profile * profile;

View File

@ -158,10 +158,24 @@ void SerialOximeter::onReadyRead()
void SerialOximeter::addPulse(qint64 time, EventDataType pr) void SerialOximeter::addPulse(qint64 time, EventDataType pr)
{ {
EventDataType min=0,max=0;
if (pr>0) {
if (pr<pulse->min())
min=pr;
if (pr>pulse->max())
max=pr;
}
pulse->AddEvent(time,pr); pulse->AddEvent(time,pr);
session->setCount(OXI_Pulse,pulse->count()); // update the cache session->setCount(OXI_Pulse,pulse->count()); // update the cache
session->setMin(OXI_Pulse,pulse->min()); if (min>0) {
session->setMax(OXI_Pulse,pulse->max()); pulse->setMin(min);
session->setMin(OXI_Pulse,min);
}
if (max>0) {
pulse->setMax(max);
session->setMax(OXI_Pulse,max);
}
session->setLast(OXI_Pulse,time); session->setLast(OXI_Pulse,time);
pulse->setLast(time); pulse->setLast(time);
session->set_last(lasttime); session->set_last(lasttime);
@ -170,10 +184,23 @@ void SerialOximeter::addPulse(qint64 time, EventDataType pr)
void SerialOximeter::addSpO2(qint64 time, EventDataType o2) void SerialOximeter::addSpO2(qint64 time, EventDataType o2)
{ {
EventDataType min=0,max=0;
if (o2>0) {
if (o2<spo2->min())
min=o2;
if (o2>spo2->max())
max=o2;
}
spo2->AddEvent(time,o2); spo2->AddEvent(time,o2);
session->setCount(OXI_SPO2,spo2->count()); // update the cache session->setCount(OXI_SPO2,spo2->count()); // update the cache
session->setMin(OXI_SPO2,spo2->min()); if (min>0) {
session->setMax(OXI_SPO2,spo2->max()); spo2->setMin(min);
session->setMin(OXI_SPO2,min);
}
if (max>0) {
spo2->setMax(max);
session->setMax(OXI_SPO2,max);
}
session->setLast(OXI_SPO2,time); session->setLast(OXI_SPO2,time);
session->set_last(lasttime); session->set_last(lasttime);
spo2->setLast(time); spo2->setLast(time);
@ -190,6 +217,24 @@ void SerialOximeter::addPlethy(qint64 time, EventDataType pleth)
session->set_last(lasttime); session->set_last(lasttime);
plethy->setLast(time); plethy->setLast(time);
} }
void SerialOximeter::compactEventList(EventList *el)
{
double rate=double(el->duration())/double(el->count());
el->setType(EVL_Waveform);
el->setRate(rate);
el->getTime().clear();
}
void SerialOximeter::compactAll()
{
QHash<ChannelID,QVector<EventList *> >::iterator i;
for (i=session->eventlist.begin();i!=session->eventlist.end();i++) {
for (int j=0;j<i.value().size();j++) {
compactEventList(i.value()[j]);
}
}
}
/*void SerialOximeter::addEvents(EventDataType pr,EventDataType o2, EventDataType pleth) /*void SerialOximeter::addEvents(EventDataType pr,EventDataType o2, EventDataType pleth)
{ {
@ -246,6 +291,7 @@ bool SerialOximeter::startLive()
void SerialOximeter::stopLive() void SerialOximeter::stopLive()
{ {
Close(); Close();
compactAll();
emit(liveStopped(session)); emit(liveStopped(session));
} }
@ -288,21 +334,27 @@ void CMS50Serial::on_import_process()
if (pulse->min()<plmin) plmin=pulse->min(); if (pulse->min()<plmin) plmin=pulse->min();
if (pulse->max()>plmax) plmax=pulse->max(); if (pulse->max()>plmax) plmax=pulse->max();
plcnt+=pulse->count(); plcnt+=pulse->count();
compactEventList(pulse); // converts to waveform..
pulse=new EventList(EVL_Event); pulse=new EventList(EVL_Event);
session->eventlist[OXI_Pulse].push_back(pulse); session->eventlist[OXI_Pulse].push_back(pulse);
} }
} else pulse->AddEvent(lasttime,pl); } else {
pulse->AddEvent(lasttime,pl);
}
if (o2==0) { if (o2==0) {
if (lasto2!=o2) { if (lasto2!=o2) {
spo2->setLast(lasttime); spo2->setLast(lasttime);
if (spo2->min()<o2min) o2min=spo2->min(); if (spo2->min()<o2min) o2min=spo2->min();
if (spo2->max()>o2max) o2max=spo2->max(); if (spo2->max()>o2max) o2max=spo2->max();
o2cnt+=spo2->count(); o2cnt+=spo2->count();
compactEventList(spo2); // convert to waveform
spo2=new EventList(EVL_Event); spo2=new EventList(EVL_Event);
session->eventlist[OXI_SPO2].push_back(spo2); session->eventlist[OXI_SPO2].push_back(spo2);
} }
} else spo2->AddEvent(lasttime,o2); } else {
spo2->AddEvent(lasttime,o2);
}
lasttime+=1000; lasttime+=1000;
emit(updateProgress(float(i)/float(size))); emit(updateProgress(float(i)/float(size)));
@ -345,6 +397,7 @@ void CMS50Serial::onReadyRead()
int size=bytes.size(); int size=bytes.size();
// Process all incoming serial data packets // Process all incoming serial data packets
unsigned char c; unsigned char c;
unsigned char pl,o2;
while (i<bytes.size()) { while (i<bytes.size()) {
if (import_mode) { if (import_mode) {
if (waitf6) { //ack sequence from f6 command. if (waitf6) { //ack sequence from f6 command.
@ -400,11 +453,8 @@ void CMS50Serial::onReadyRead()
data.push_back(bytes.at(z)); data.push_back(bytes.at(z));
received_bytes++; received_bytes++;
} }
//i=z;
//size-=i;
waitf6=false; waitf6=false;
return; return;
//continue;
} }
} }
} else { } else {
@ -426,9 +476,6 @@ void CMS50Serial::onReadyRead()
break; break;
//read data blocks.. //read data blocks..
} }
/*if (size<200) && (received_bytes>=datasize) {
} */
} else { } else {
if (bytes[i]&0x80) { // 0x80 == sync bit if (bytes[i]&0x80) { // 0x80 == sync bit
EventDataType d=bytes[i+1] & 0x7f; EventDataType d=bytes[i+1] & 0x7f;
@ -436,8 +483,10 @@ void CMS50Serial::onReadyRead()
lasttime+=20; lasttime+=20;
i+=3; i+=3;
} else { } else {
addPulse(lasttime,bytes[i]); pl=bytes[i];
addSpO2(lasttime,bytes[i+1]); o2=bytes[i+1];
addPulse(lasttime,pl);
addSpO2(lasttime,o2);
i+=2; i+=2;
} }
} }
@ -873,7 +922,6 @@ void Oximetry::on_saveButton_clicked()
if (QMessageBox::question(this,"Keep This Recording?","A save dialog will go here allowing you to edit parameters for this oximetry session..\nFor now, would you like to save this as is?",QMessageBox::Yes|QMessageBox::No)==QMessageBox::Yes) { if (QMessageBox::question(this,"Keep This Recording?","A save dialog will go here allowing you to edit parameters for this oximetry session..\nFor now, would you like to save this as is?",QMessageBox::Yes|QMessageBox::No)==QMessageBox::Yes) {
Session *session=oximeter->getSession(); Session *session=oximeter->getSession();
// Process??? // Process???
session->UpdateSummaries(); session->UpdateSummaries();
oximeter->getMachine()->AddSession(session,p_profile); oximeter->getMachine()->AddSession(session,p_profile);
oximeter->getMachine()->Save(); oximeter->getMachine()->Save();

View File

@ -41,7 +41,9 @@ public:
Session *createSession(); Session *createSession();
Session * getSession() { return session; } Session * getSession() { return session; }
Session * takeSession() { Session * s=session; session=NULL; return s; }
void compactEventList(EventList *e);
void compactAll();
void setPortName(QString portname); void setPortName(QString portname);
void setBaudRate(BaudRateType baud); void setBaudRate(BaudRateType baud);