CMS50i PI test4

This commit is contained in:
Mark Watkins 2014-08-22 02:40:08 +10:00
parent 809779af27
commit 0dbcbcb9db

View File

@ -457,14 +457,16 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
// 9,80,e1,c4,ce,82 // cms50i data
quint8 * buf = &((quint8 *)buffer.data())[idx];
for (int i = 3, msb = buf[1]; i < len-2; i++, msb>>= 1) {
buf[i] = (buf[i] & 0x7f) | (msb & 0x01 ? 0x80 : 0);
quint8 msb = buf[1];
for (int i = 2; 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];
quint8 spo2 = buf[2] & 0x7f;
qDebug() << "Pulse=" << pulse << "SPO2=" << spo2 << "Pi=" << pi;
oxirec->append(((spo2 == 0) || (pulse == 0)) ? OxiRecord(0,0,0) : OxiRecord(pulse, spo2, pi));
} else if (res == 0x0f) {