Fix incorrect Viatom warning when a CheckMe O2 Max recorded an odd number of samples.

This commit is contained in:
sawinglogz 2022-05-09 10:51:17 -04:00
parent 501af3acf7
commit f3273b2045

View File

@ -418,19 +418,23 @@ QList<ViatomFile::Record> ViatomFile::ReadData()
QList<ViatomFile::Record> dedup; QList<ViatomFile::Record> dedup;
bool all_are_duplicated = true; bool all_are_duplicated = true;
CHECK_VALUE(records.size() % 2, 0); if ((records.size() % 2) != 0) {
for (int i = 0; i < records.size(); i += 2) { // An odd number of samples inherently can't be all duplicates.
auto & a = records.at(i); all_are_duplicated = false;
auto & b = records.at(i+1); } else {
if (a.spo2 != b.spo2 for (int i = 0; i < records.size(); i += 2) {
|| a.hr != b.hr auto & a = records.at(i);
|| a.oximetry_invalid != b.oximetry_invalid auto & b = records.at(i+1);
|| a.motion != b.motion if (a.spo2 != b.spo2
|| a.vibration != b.vibration) { || a.hr != b.hr
all_are_duplicated = false; || a.oximetry_invalid != b.oximetry_invalid
break; || a.motion != b.motion
|| a.vibration != b.vibration) {
all_are_duplicated = false;
break;
}
dedup.append(a);
} }
dedup.append(a);
} }
if (m_sig == 5) { if (m_sig == 5) {
// Confirm that CheckMe O2 Max is a true 2s sample rate. // Confirm that CheckMe O2 Max is a true 2s sample rate.