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,7 +418,10 @@ 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) {
// An odd number of samples inherently can't be all duplicates.
all_are_duplicated = false;
} else {
for (int i = 0; i < records.size(); i += 2) { for (int i = 0; i < records.size(); i += 2) {
auto & a = records.at(i); auto & a = records.at(i);
auto & b = records.at(i+1); auto & b = records.at(i+1);
@ -432,6 +435,7 @@ QList<ViatomFile::Record> ViatomFile::ReadData()
} }
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.
CHECK_VALUE(all_are_duplicated, false); CHECK_VALUE(all_are_duplicated, false);