Fixed some RespRate calculation problems

This commit is contained in:
Mark Watkins 2012-01-13 05:12:00 +10:00
parent d3a9ebff46
commit 24581ea38d
3 changed files with 24 additions and 22 deletions

View File

@ -330,6 +330,7 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
if (calcResp) { if (calcResp) {
RR=m_session->AddEventList(CPAP_RespRate,EVL_Event); RR=m_session->AddEventList(CPAP_RespRate,EVL_Event);
minrr=RR->Min(), maxrr=RR->Max(); minrr=RR->Min(), maxrr=RR->Max();
RR->setGain(0.2);
RR->setFirst(time+minute); RR->setFirst(time+minute);
RR->getData().resize(nm); RR->getData().resize(nm);
RR->getTime().resize(nm); RR->getTime().resize(nm);
@ -340,6 +341,7 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
int rr_count=0; int rr_count=0;
double len, st2,et2,adj, stmin, b, rr=0; double len, st2,et2,adj, stmin, b, rr=0;
double len2;
int idx; int idx;
@ -371,6 +373,7 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
if (calcTv) { if (calcTv) {
TV=m_session->AddEventList(CPAP_TidalVolume,EVL_Event); TV=m_session->AddEventList(CPAP_TidalVolume,EVL_Event);
mintv=TV->Min(), maxtv=TV->Max(); mintv=TV->Min(), maxtv=TV->Max();
TV->setGain(20);
TV->setFirst(start); TV->setFirst(start);
TV->getData().resize(nm); TV->getData().resize(nm);
TV->getTime().resize(nm); TV->getTime().resize(nm);
@ -465,7 +468,8 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
stmin=start; stmin=start;
len=et-stmin; len=et-stmin;
rr=0; rr=0;
if (len >= minute) { len2=0;
//if ( len >= minute) {
//et2=et; //et2=et;
// Step back through last minute and count breaths // Step back through last minute and count breaths
@ -481,10 +485,17 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
st2=stmin; st2=stmin;
adj=et2 - st2; adj=et2 - st2;
b=(1.0 / len) * adj; b=(1.0 / len) * adj;
} else b=1; len2+=adj;
} else {
b=1;
len2+=len;
}
rr+=b; rr+=b;
} }
if (len2 < minute) {
rr*=minute/len2;
}
// Calculate min & max // Calculate min & max
if (rr < minrr) if (rr < minrr)
minrr=rr; minrr=rr;
@ -500,7 +511,7 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
rr_count++; rr_count++;
//rr->AddEvent(et,br * 50.0); //rr->AddEvent(et,br * 50.0);
} //}
} }
if (calcMv && calcResp && calcTv) { if (calcMv && calcResp && calcTv) {
mv=(tv/1000.0) * rr; mv=(tv/1000.0) * rr;
@ -513,7 +524,6 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
if (calcResp) { if (calcResp) {
RR->setGain(0.2);
RR->setMin(minrr); RR->setMin(minrr);
RR->setMax(maxrr); RR->setMax(maxrr);
RR->setFirst(start); RR->setFirst(start);
@ -525,7 +535,6 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
if (calcTv) { if (calcTv) {
TV->setGain(20);
TV->setMin(mintv); TV->setMin(mintv);
TV->setMax(maxtv); TV->setMax(maxtv);
TV->setFirst(start); TV->setFirst(start);

View File

@ -226,6 +226,12 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
} }
} }
} }
if (!upq && !upd) {
mainwin->Notify(tr("No new updates were found for your platform."),tr("SleepyHead Updates"),5000);
PREF[STR_GEN_UpdatesLastChecked]=QDateTime::currentDateTime();
close();
return;
}
if (upq && (upq->version > QT_VERSION_STR)) { if (upq && (upq->version > QT_VERSION_STR)) {
updates.push_back(upq); updates.push_back(upq);

View File

@ -7,19 +7,9 @@
hash="ed0312c0f9a51e8774e6556f83b13df8d4195d2b"/> hash="ed0312c0f9a51e8774e6556f83b13df8d4195d2b"/>
</update> </update>
<update type="application" version="0.9.2-1" platform="win32" release_date="2012-01-12" status="testing"> <update type="application" version="0.9.2-1" platform="win32" release_date="2012-01-12" status="testing">
<file name="SleepyHead-0.9.2-beta-win32-binary_only.zip" <file name="SleepyHead-0.9.2-beta-win32-update.zip"
url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/Win32/SleepyHead-0.9.1-beta-win32-binary_only.zip/download" url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/Win32/SleepyHead-0.9.2-beta-win32-update.zip/download"
hash="89cf16fbbc5dc5018946916dc8c95c01578635f8"/> hash="294cbb319a62b547d88f6879295878975d6b5e56"/>
<notes>
Some bug fixes to the beta, and a test of the auto-updater.
Adds some new functionality to the updater, so test updates can be delivered with out affecting other users.
Please proceed with caution. If unsure, wait for feedback in the forums..
</notes>
</update>
<update type="application" version="0.9.2-1" platform="macosx" release_date="2012-01-12" status="testing">
<file name="SleepyHead-0.9.2-beta-macosx-binary_only.zip"
url="http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/MacOSX/SleepyHead-0.9.1-beta-macosx-binary_only.zip/download"
hash="2f0983dfec2e9968b36ff8ccd7c24a1af5bb8818"/>
<notes> <notes>
Some bug fixes to the beta, and a test of the auto-updater. Some bug fixes to the beta, and a test of the auto-updater.
Adds some new functionality to the updater, so test updates can be delivered with out affecting other users. Adds some new functionality to the updater, so test updates can be delivered with out affecting other users.
@ -28,10 +18,7 @@
</update> </update>
<notes> <notes>
This is an updater test, though it does deliver some important bug fixes to the beta.. This is an updater test, though it does deliver some important bug fixes to the beta..
This message will change when it's ready to grab.. (it might work now)
</notes> </notes>
<notes platform="linux">Linux Rules. But you already knew that!</notes>
<notes platform="macosx">Always remember to write-protect your SD card, as MacOSX occasionally likes to eat them.</notes>
<notes platform="win32">Nothing particularly platform relevant to this Windows build</notes> <notes platform="win32">Nothing particularly platform relevant to this Windows build</notes>
<info url="http://sourceforge.net/apps/mediawiki/sleepyhead/index.php?title=ReleaseNotes-0.9.1"/> <info url="http://sourceforge.net/apps/mediawiki/sleepyhead/index.php?title=ReleaseNotes-0.9.1"/>
</Release> </Release>