From 1ec687a9c6957a63f66f11ea3b98b1951b46567d Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 20 Aug 2014 01:11:37 +1000 Subject: [PATCH] Oximetry fix #372348 --- .../SleepLib/loader_plugins/cms50f37_loader.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp index b47671f8..fc19388e 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp @@ -383,7 +383,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes) // duration duration = ((buffer.at(idx+1) & 0x4) << 5); duration |= buffer.at(idx+4); - duration |= buffer.at(idx+5) << 8; + duration |= (buffer.at(idx+5) | ((buffer.at(idx+1) & 0x8) << 4)) << 8; break; // COMMAND_GET_SESSION_COUNT @@ -450,15 +450,15 @@ void CMS50F37Loader::processBytes(QByteArray bytes) } if (res == 0x09) { - msb = buffer.at(idx+1); + msb = quint8(buffer.at(idx+1)); // 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 = buffer.at(idx+1); i < len; i++, msb>>= 1) { +// buffer[idx+i] = (buffer[idx+i] & 0x7f) | (msb & 0x01 ? 0x80 : 0); +// } - quint16 pi = quint8(buffer.at(idx + 4)) | (quint16(buffer.at(idx + 5)) << 8); + quint16 pi = quint8(buffer.at(idx + 4)) | ((msb & 4) << 5) | (quint16(buffer.at(idx + 5)) << 8); - pulse = buffer.at(idx+3); + pulse = quint8(buffer.at(idx+3)) | ((msb & 2 ) << 6); quint8 spo2 = buffer.at(idx+2); oxirec->append(((spo2 == 0) || (pulse == 0) || (pi == 0xfff6)) ? OxiRecord(0,0,0) : OxiRecord(pulse, spo2, pi));