CMS50i PI test

This commit is contained in:
Mark Watkins 2014-08-22 01:59:09 +10:00
parent 3e84ef817b
commit b10365a7d2
3 changed files with 25 additions and 20 deletions

View File

@ -562,10 +562,12 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
QVector<EventList *> &evec = ci.value();
num_points = 0;
int evecsize=evec.size();
for (int i = 0; i < evecsize; i++) {
num_points += evec[i]->count();
QVector<EventList *>::iterator evec_end = evec.end();
QVector<EventList *>::iterator ni;
for (ni = evec.begin(); ni != evec_end; ++ni) {
num_points += (*ni)->count();
}
total_points += num_points;
@ -574,8 +576,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
// Max number of samples taken from samples per pixel for better min/max values
const int num_averages = 20;
for (int n = 0; n < evecsize; ++n) { // for each segment
EventList &el = *evec[n];
int n=0;
for (ni = evec.begin(); ni != evec_end; ++ni, ++n) {
EventList & el = *(EventList*) (*ni);
accel = (el.type() == EVL_Waveform); // Turn on acceleration if this is a waveform.
@ -597,7 +600,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
square_plot = false;
}
int siz = evec[n]->count();
int siz = el.count();
if (siz <= 1) { continue; } // Don't bother drawing 1 point or less.
@ -702,7 +705,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
time = el.time(idx) + drift;
double rate = double(sr) * double(sam);
EventStoreType *ptr = el.rawData() + idx;
if (siz > el.count())
if ((unsigned) siz > el.count())
siz = el.count();
if (accel) {
@ -784,13 +787,15 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
//////////////////////////////////////////////////////////////////
// Normal Waveform Plot
//////////////////////////////////////////////////////////////////
if (code == CPAP_Ti) {
int i=5; Q_UNUSED(i);
}
// Prime first point
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;

View File

@ -105,28 +105,28 @@ class EventList
//void setCode(ChannelID id) { m_code=id; }
//! \brief Return the Minimum data value
inline const EventDataType &Min() { return m_min; }
inline EventDataType Min() { return m_min; }
//! \brief Return the Maximum data value
inline const EventDataType &Max() { return m_max; }
inline EventDataType Max() { return m_max; }
//! \brief Return the Minimum data2 value
inline const EventDataType &min2() { return m_min2; }
inline EventDataType min2() { return m_min2; }
//! \brief Return the Maximum data value
inline const EventDataType &max2() { return m_max2; }
inline EventDataType max2() { return m_max2; }
//! \brief Return the gain value
inline const EventDataType &gain() { return m_gain; }
inline EventDataType gain() { return m_gain; }
//! \brief Return the gain offset
inline const EventDataType &offset() { return m_offset; }
inline EventDataType offset() { return m_offset; }
//! \brief Return the sample rate
inline const EventDataType &rate() { return m_rate; }
inline EventDataType rate() { return m_rate; }
//! \brief Return the EventList type, either EVL_Waveform or EVL_Event
inline const EventListType &type() { return m_type; }
inline EventListType type() { return m_type; }
//inline const ChannelID & code() { return m_code; }
//! \brief Returns whether or not min/max values are updated while adding events

View File

@ -454,13 +454,13 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
}
if (res == 0x09) {
quint8 * buf = (unsigned char *)&buffer.data()[idx];
quint8 * buf = &((quint8 *)buffer.data())[idx];
// 9,80,e1,c4,ce,82 // cms50i data
for (int i = 3, msb = buf[1]; i < len; i++, msb>>= 1) {
for (int i = 3, msb = buf[1]; i < len-1; i++, msb>>= 1) {
buf[i] = (buf[i] & 0x7f) | (msb & 0x01 ? 0x80 : 0);
}
quint16 pi = buffer.at(idx + 4) | (buffer.at(idx + 5) << 8);
quint16 pi = buf[idx + 4] | buf[idx + 5] << 8;
pulse = buf[3];
quint8 spo2 = buf[2];