This commit is contained in:
Mark Watkins 2014-08-20 01:22:22 +10:00
parent 1ec687a9c6
commit 351680a5df

View File

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