From 0dbcbcb9db8b3972972f7475cd78fa1dc81c403a Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Fri, 22 Aug 2014 02:40:08 +1000 Subject: [PATCH] CMS50i PI test4 --- .../SleepLib/loader_plugins/cms50f37_loader.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp index 680230c2..d5ef9783 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp @@ -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) {