Fix duplicate ResMed Ti/Te signals from importing

This commit is contained in:
Mark Watkins 2014-08-22 21:54:17 +10:00
parent 81127bf6e9
commit 0b31d0ea3f
6 changed files with 23 additions and 18 deletions

View File

@ -434,7 +434,7 @@ void RecalcMAP::run()
const QVector<EventList *> & evec = ei.value();
int esize = evec.size();
for (int ei = 0; ei < esize; ++ei) {
EventList *EL = evec[ei];
const EventList *EL = evec.at(ei);
EventDataType gain = EL->gain();
quint32 ELsize = EL->count();
if (ELsize < 1) return;

View File

@ -570,11 +570,6 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
num_points += (*ni)->count();
}
if (code == CPAP_FlowRate) {
int i=5; Q_UNUSED(i);
}
total_points += num_points;
codepoints += num_points;
@ -796,12 +791,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
data = (*ptr + el.offset()) * gain;
lastpx = xst + ((time - minx) * xmult);
lastpy = yst - ((data - miny) * ymult);
EventStoreType *eptr = el.rawData() + el.count()-1;
lines.clear();
siz--;
for (int i = idx; i < siz; i += sam) {
ptr += sam;
if (ptr >= eptr) break;
time += rate;
data = (*ptr + el.offset()) * gain;

View File

@ -44,7 +44,7 @@ void EventList::clear()
}
qint64 EventList::time(quint32 i)
qint64 EventList::time(quint32 i) const
{
if (m_type == EVL_Event) {
return m_first + qint64(m_time[i]);

View File

@ -41,16 +41,16 @@ class EventList
void AddWaveform(qint64 start, char *data, int recs, qint64 duration);
//! \brief Returns a count of records contained in this EventList
inline const quint32 &count() { return m_count; }
inline quint32 count() const { return m_count; }
//! \brief Manually sets a count of records contained in this EventList
void setCount(quint32 count) { m_count = count; }
//! \brief Returns a raw ("ungained") data value from index position i
inline EventStoreType raw(int i) { return m_data[i]; }
inline EventStoreType raw(int i) const { return m_data[i]; }
//! \brief Returns a raw ("ungained") data2 value from index position i
inline EventStoreType raw2(int i) { return m_data2[i]; }
inline EventStoreType raw2(int i) const { return m_data2[i]; }
//! \brief Returns a data value multiplied by gain from index position i
EventDataType data(quint32 i);
@ -59,16 +59,16 @@ class EventList
EventDataType data2(quint32 i);
//! \brief Returns either the timestamp for the i'th event, or calculates the waveform time position i
qint64 time(quint32 i);
qint64 time(quint32 i) const;
//! \brief Returns true if this EventList uses the second data field
bool hasSecondField() { return m_second_field; }
//! \brief Returns the first events/waveforms starting time in milliseconds since epoch
inline const qint64 &first() { return m_first; }
inline qint64 first() const { return m_first; }
//! \brief Returns the last events/waveforms ending time in milliseconds since epoch
inline const qint64 &last() { return m_last; }
inline qint64 last() const { return m_last; }
//! \brief Returns the timespan covered by this EventList, in milliseconds since epoch
inline qint64 duration() { return m_last - m_first; }
@ -117,7 +117,7 @@ class EventList
inline EventDataType max2() { return m_max2; }
//! \brief Return the gain value
inline EventDataType gain() { return m_gain; }
inline EventDataType gain() const { return m_gain; }
//! \brief Return the gain offset
inline EventDataType offset() { return m_offset; }

View File

@ -645,6 +645,11 @@ void ResmedImport::run()
}
loader->saveMutex.unlock();
if (sessionid == 1408571701) {
int i=5; Q_UNUSED(i);
}
if (!group.EVE.isEmpty()) {
loader->LoadEVE(sess, group.EVE);
}
@ -2273,11 +2278,20 @@ bool ResmedLoader::LoadPLD(Session *sess, const QString & path)
//a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0);
} else if (matchSignal(CPAP_Ti, es.label)) {
code = CPAP_Ti;
// There are TWO of these with the same label on my VPAP Adapt 36037
if (sess->eventlist.contains(code)) {
continue;
}
a = sess->AddEventList(code, EVL_Waveform, es.gain, es.offset, 0, 0, rate);
a->AddWaveform(edf.startdate, es.data, recs, duration);
//a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0);
} else if (matchSignal(CPAP_Te, es.label)) {
code = CPAP_Te;
// There are TWO of these with the same label on my VPAP Adapt 36037
if (sess->eventlist.contains(code)) {
continue;
}
a = sess->AddEventList(code, EVL_Waveform, es.gain, es.offset, 0, 0, rate);
a->AddWaveform(edf.startdate, es.data, recs, duration);
//a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0);

View File

@ -656,7 +656,6 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day)
QHash<ChannelID,QTreeWidgetItem *> mcroot;
QHash<ChannelID,int> mccnt;
int total_events=0;
bool userflags=p_profile->cpap->userEventFlagging();
qint64 drift=0, clockdrift=p_profile->cpap->clockDrift()*1000L;