Refine support for DS2 settings.

This commit is contained in:
sawinglogz 2021-11-05 09:30:44 -04:00
parent 7a47c7c7e3
commit da6047d32d
3 changed files with 24 additions and 2 deletions

View File

@ -2969,6 +2969,7 @@ void PRS1Loader::initChannels()
"", LOOKUP, Qt::black));
chan->addOption(0, QObject::tr("Linear"));
chan->addOption(1, QObject::tr("SmartRamp"));
chan->addOption(2, QObject::tr("Ramp+"));
channel.add(GRP_CPAP, chan = new Channel(PRS1_BackupBreathMode = 0xe114, SETTING, MT_CPAP, SESSION,
"PRS1BackupBreathMode",

View File

@ -1756,6 +1756,7 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
int imax_ps = 0;
int min_pressure = 0;
int max_pressure = 0;
bool ramp_type_set = false;
// Parse the nested data structure which contains settings
int pos = 0;
@ -1902,16 +1903,24 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
CHECK_VALUE(len, 1);
CHECK_VALUES(data[pos], 0, 0x80); // 0 == "Linear", 0x80 = "SmartRamp"
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_RAMP_TYPE, data[pos] != 0));
ramp_type_set = true;
break;
case 0x2c: // Ramp Time
CHECK_VALUE(len, 1);
if (data[pos] != 0) { // 0 == ramp off, and ramp pressure setting doesn't appear
if (data[pos] < 5 || data[pos] > 45) UNEXPECTED_VALUE(data[pos], "5-45");
}
if (!ramp_type_set) {
// If there's a ramp time that's neither linear nor SmartRamp, then it's Ramp+.
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_RAMP_TYPE, 2));
ramp_type_set = true;
}
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_RAMP_TIME, data[pos]));
break;
case 0x2d: // Ramp Pressure
CHECK_VALUE(len, 1);
// 0 = Off for Ramp+ (since time is always set)
// Turning it on during therapy creates a new session.
this->AddEvent(new PRS1PressureSettingEvent(PRS1_SETTING_RAMP_PRESSURE, data[pos]));
break;
case 0x2e: // Flex mode
@ -1984,6 +1993,7 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
case 0x2f: // Flex lock
CHECK_VALUE(len, 1);
CHECK_VALUES(data[pos], 0, 0x80);
// DS2 doesn't have a specific flex lock. See patient controls access below.
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_FLEX_LOCK, data[pos] != 0));
break;
case 0x30: // Flex level
@ -2003,6 +2013,7 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
case 0x36: // Mask Resistance Lock
CHECK_VALUE(len, 1);
CHECK_VALUES(data[pos], 0, 0x80);
// DS2 doesn't have a mask resistance lock, as the resistance setting is only in the provider menu.
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_MASK_RESIST_LOCK, data[pos] != 0));
break;
case 0x38: // Mask Resistance
@ -2015,6 +2026,7 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
case 0x39: // Tubing Type Lock
CHECK_VALUE(len, 1);
CHECK_VALUES(data[pos], 0, 0x80);
// DS2 doesn't have a tubing type lock, it is always available (unless a heated tube is auto-detected).
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_TUBING_LOCK, data[pos] != 0));
break;
case 0x3b: // Tubing Type
@ -2070,10 +2082,18 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
case 0x4a: // Patient controls access, specific to DreamStation 2.
CHECK_VALUE(len, 1);
CHECK_VALUES(data[pos], 0, 0x80);
// Turning off patient controls access essentially locks only flex and ramp time.
// Humidification, heated tube temperature, and ramp level are still adjustable during therapy.
// (DS2 doesn't have a separate flex lock setting.)
if (data[pos] == 0) {
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_FLEX_LOCK, true));
}
break;
case 0x4b: // Patient data access, specific to DreamStation 2.
CHECK_VALUE(len, 1);
CHECK_VALUES(data[pos], 0, 0x80);
// Turning off patient data access hides both AHI and on-device reports.
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_SHOW_AHI, data[pos] != 0));
break;
default:
UNEXPECTED_VALUE(code, "known setting");

View File

@ -123,6 +123,7 @@ void init()
QApplication::exit(-1);
}
Channel *ch;
// Lookup Code strings are used internally and not meant to be translated
// Lookup Code strings are also used as a key to a graph of this channel
@ -143,7 +144,8 @@ void init()
schema::channel.add(GRP_CPAP, new Channel(CPAP_PressureMin = 0x1020, SETTING, MT_CPAP, SESSION, "PressureMin", QObject::tr("Min Pressure"), QObject::tr("Minimum Therapy Pressure"), QObject::tr("Pressure Min"), STR_UNIT_CMH2O, DEFAULT, QColor("orange")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_PressureMax = 0x1021, SETTING, MT_CPAP, SESSION, "PressureMax", QObject::tr("Max Pressure"), QObject::tr("Maximum Therapy Pressure"), QObject::tr("Pressure Max"), STR_UNIT_CMH2O, DEFAULT, QColor("light blue")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_RampTime = 0x1022, SETTING, MT_CPAP, SESSION, "RampTime", QObject::tr("Ramp Time") , QObject::tr("Ramp Delay Period"), QObject::tr("Ramp Time"), STR_UNIT_Minutes, DEFAULT, QColor("black")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_RampPressure = 0x1023, SETTING, MT_CPAP, SESSION, "RampPressure", QObject::tr("Ramp Pressure"), QObject::tr("Starting Ramp Pressure"), QObject::tr("Ramp Pressure"),STR_UNIT_CMH2O, DEFAULT, QColor("black")));
schema::channel.add(GRP_CPAP, ch = new Channel(CPAP_RampPressure = 0x1023, SETTING, MT_CPAP, SESSION, "RampPressure", QObject::tr("Ramp Pressure"), QObject::tr("Starting Ramp Pressure"), QObject::tr("Ramp Pressure"),STR_UNIT_CMH2O, LOOKUP, QColor("black")));
ch->addOption(0, STR_TR_Off);
schema::channel.add(GRP_CPAP, new Channel(CPAP_Ramp = 0x1027, SPAN, MT_CPAP, SESSION, "Ramp", QObject::tr("Ramp Event") , QObject::tr("Ramp Event"), QObject::tr("Ramp"), STR_UNIT_EventsPerHour,DEFAULT, QColor("light blue")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_PressureSet = 0x11A4, WAVEFORM, MT_CPAP, SESSION, "PressureSet", QObject::tr("Pressure Set"), QObject::tr("Pressure Setting"), QObject::tr("Pressure Set"), STR_UNIT_CMH2O, DEFAULT, QColor("dark red")));
schema::channel.add(GRP_CPAP, new Channel(CPAP_IPAPSet = 0x11A5, WAVEFORM, MT_CPAP, SESSION, "IPAPSet", QObject::tr("IPAP Set"), QObject::tr("IPAP Setting"), QObject::tr("IPAP Set"), STR_UNIT_CMH2O, DEFAULT, QColor("dark red")));
@ -297,7 +299,6 @@ void init()
schema::channel.add(GRP_CPAP, new Channel(CPAP_SummaryOnly = 0x1026, DATA, MT_CPAP, SESSION, "SummaryOnly",
QObject::tr("Summary Only"), QObject::tr("CPAP Session contains summary data only"), QObject::tr("Summary Only"), STR_UNIT_Unknown, DEFAULT, Qt::black));
Channel *ch;
schema::channel.add(GRP_CPAP, ch = new Channel(CPAP_Mode = 0x1200, SETTING, MT_CPAP, SESSION, "PAPMode",
QObject::tr("PAP Mode"), QObject::tr("PAP Device Mode"), QObject::tr("PAP Mode"), QString(), LOOKUP, Qt::black));