Clean up ParseSummaryF5V3 to align more closely with all other summary parsers.

This commit is contained in:
sawinglogz 2019-05-26 19:02:08 -04:00
parent 44558e4c06
commit 739ba7d5d5

View File

@ -3604,8 +3604,6 @@ bool PRS1Import::ParseSummaryF5V3()
bool ok; bool ok;
ok = summary->ParseSummaryF5V3(); ok = summary->ParseSummaryF5V3();
EventDataType epapHi, epapLo, minps, maxps;
for (int i=0; i < summary->m_parsedData.count(); i++) { for (int i=0; i < summary->m_parsedData.count(); i++) {
PRS1ParsedEvent* e = summary->m_parsedData.at(i); PRS1ParsedEvent* e = summary->m_parsedData.at(i);
if (e->m_type != EV_PRS1_SETTING) { if (e->m_type != EV_PRS1_SETTING) {
@ -3618,20 +3616,22 @@ bool PRS1Import::ParseSummaryF5V3()
session->settings[CPAP_Mode] = e->m_value; session->settings[CPAP_Mode] = e->m_value;
break; break;
case PRS1_SETTING_EPAP_MIN: case PRS1_SETTING_EPAP_MIN:
epapLo = e->value(); session->settings[CPAP_EPAPLo] = e->value();
session->settings[CPAP_EPAPLo] = epapLo;
break; break;
case PRS1_SETTING_EPAP_MAX: case PRS1_SETTING_EPAP_MAX:
epapHi = e->value(); session->settings[CPAP_EPAPHi] = e->value();
session->settings[CPAP_EPAPHi] = epapHi; break;
case PRS1_SETTING_IPAP_MIN:
session->settings[CPAP_IPAPLo] = e->value();
break;
case PRS1_SETTING_IPAP_MAX:
session->settings[CPAP_IPAPHi] = e->value();
break; break;
case PRS1_SETTING_PS_MIN: case PRS1_SETTING_PS_MIN:
minps = e->value(); session->settings[CPAP_PSMin] = e->value();
session->settings[CPAP_PSMin] = minps;
break; break;
case PRS1_SETTING_PS_MAX: case PRS1_SETTING_PS_MAX:
maxps = e->value(); session->settings[CPAP_PSMax] = e->value();
session->settings[CPAP_PSMax] = maxps;
break; break;
default: default:
qWarning() << "Unknown PRS1 setting type" << (int) s->m_setting; qWarning() << "Unknown PRS1 setting type" << (int) s->m_setting;
@ -3639,9 +3639,6 @@ bool PRS1Import::ParseSummaryF5V3()
} }
} }
session->settings[CPAP_IPAPLo] = epapLo + minps;
session->settings[CPAP_IPAPHi] = qMin(25.0f, epapHi + maxps);
if (!ok) { if (!ok) {
return false; return false;
} }
@ -3657,17 +3654,20 @@ bool PRS1DataChunk::ParseSummaryF5V3(void)
unsigned char * pressureBlock = (unsigned char *)mainblock[0x0a].data(); unsigned char * pressureBlock = (unsigned char *)mainblock[0x0a].data();
EventDataType epapHi = pressureBlock[0]; int epapHi = pressureBlock[0];
EventDataType epapRange = pressureBlock[2]; int epapRange = pressureBlock[2];
EventDataType epapLo = epapHi - epapRange; int epapLo = epapHi - epapRange;
EventDataType minps = pressureBlock[3] ; int minps = pressureBlock[3] ;
EventDataType maxps = pressureBlock[4]+epapLo; int maxps = pressureBlock[4]+epapLo;
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_EPAP_MAX, epapHi)); this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_EPAP_MAX, epapHi));
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_EPAP_MIN, epapLo)); this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_EPAP_MIN, epapLo));
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS_MIN, minps)); this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS_MIN, minps));
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS_MAX, maxps)); this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_PS_MAX, maxps));
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_IPAP_MIN, epapLo + minps));
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_IPAP_MAX, qMin(250, epapHi + maxps))); // 25.0 cmH2O max
if (hbdata[4].size() < 2) { if (hbdata[4].size() < 2) {
qDebug() << "summary missing duration section:" << this->sessionid; qDebug() << "summary missing duration section:" << this->sessionid;