mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Fix PRS1 F0V23 PB parsing bug that triggered unordered data warnings.
A PB event obviously can't start so late that its duration ends in the future! The fix hasn't been applied to F0V4 or F0V6 yet, since those haven't been tested yet. Also fix a sign bug in EventList::AddEvent when there *is* unordered data.
This commit is contained in:
parent
2021e91426
commit
5ac6745eef
@ -1,4 +1,4 @@
|
|||||||
/* SleepLib Event Class Implementation
|
/* SleepLib Event Class Implementation
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
@ -85,12 +85,12 @@ void EventList::AddEvent(qint64 time, EventStoreType data)
|
|||||||
if (m_first > time) {
|
if (m_first > time) {
|
||||||
// Crud.. Update all the previous records
|
// Crud.. Update all the previous records
|
||||||
// This really shouldn't happen.
|
// This really shouldn't happen.
|
||||||
qDebug() << "Unordered time detected in AddEvent().";
|
qDebug() << "Unordered time detected in AddEvent()" << m_count << m_first << time << data;
|
||||||
|
|
||||||
qint32 delta = (m_first - time);
|
qint32 delta = (m_first - time);
|
||||||
|
|
||||||
for (quint32 i = 0; i < m_count; ++i) {
|
for (quint32 i = 0; i < m_count; ++i) {
|
||||||
m_time[i] -= delta;
|
m_time[i] += delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_first = time;
|
m_first = time;
|
||||||
|
@ -3072,7 +3072,7 @@ bool PRS1DataChunk::ParseEventsF0(CPAPMode mode)
|
|||||||
|
|
||||||
pos += 2;
|
pos += 2;
|
||||||
data1 = buffer[pos++];
|
data1 = buffer[pos++];
|
||||||
this->AddEvent(new PRS1UnknownValueEvent(code, t - data1, data0));
|
this->AddEvent(new PRS1UnknownValueEvent(code, t - data1, data0)); // TODO: start time should probably match PB below
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f: // Cheyne Stokes Respiration
|
case 0x0f: // Cheyne Stokes Respiration
|
||||||
@ -3083,7 +3083,11 @@ bool PRS1DataChunk::ParseEventsF0(CPAPMode mode)
|
|||||||
}
|
}
|
||||||
pos += 2;
|
pos += 2;
|
||||||
data1 = buffer[pos++];
|
data1 = buffer[pos++];
|
||||||
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1, data0));
|
if (this->familyVersion == 2 || this->familyVersion == 3) {
|
||||||
|
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1 - data0, data0)); // PB event appears data1 seconds after conclusion
|
||||||
|
} else {
|
||||||
|
this->AddEvent(new PRS1PeriodicBreathingEvent(t - data1, data0)); // TODO: this should probably be the same as F0V23, but it hasn't been tested
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x10: // Large Leak
|
case 0x10: // Large Leak
|
||||||
@ -3094,7 +3098,7 @@ bool PRS1DataChunk::ParseEventsF0(CPAPMode mode)
|
|||||||
}
|
}
|
||||||
pos += 2;
|
pos += 2;
|
||||||
data1 = buffer[pos++];
|
data1 = buffer[pos++];
|
||||||
this->AddEvent(new PRS1LargeLeakEvent(t - data1, data0));
|
this->AddEvent(new PRS1LargeLeakEvent(t - data1, data0)); // TODO: start time should probably match PB above
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x11: // Leak Rate & Snore Graphs
|
case 0x11: // Leak Rate & Snore Graphs
|
||||||
|
Loading…
Reference in New Issue
Block a user