From 5ef1d90414ddc762ce3e23e7c1c709727d6fdf89 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Tue, 5 Aug 2014 02:12:49 +1000 Subject: [PATCH] PRS1 F0 Humidification level fix --- sleepyhead/SleepLib/common.cpp | 4 +++ sleepyhead/SleepLib/common.h | 2 ++ .../SleepLib/loader_plugins/prs1_loader.cpp | 25 ++++++++++++++++++- .../SleepLib/loader_plugins/prs1_loader.h | 4 +++ sleepyhead/SleepLib/machine_common.cpp | 2 +- sleepyhead/SleepLib/machine_common.h | 2 +- sleepyhead/SleepLib/machine_loader.h | 2 ++ sleepyhead/SleepLib/schema.cpp | 1 - sleepyhead/daily.cpp | 16 +++++++----- sleepyhead/docs/channels.xml | 12 --------- 10 files changed, 48 insertions(+), 22 deletions(-) diff --git a/sleepyhead/SleepLib/common.cpp b/sleepyhead/SleepLib/common.cpp index 865468f2..2281c341 100644 --- a/sleepyhead/SleepLib/common.cpp +++ b/sleepyhead/SleepLib/common.cpp @@ -302,6 +302,8 @@ QString STR_TR_Start; QString STR_TR_End; QString STR_TR_On; QString STR_TR_Off; +QString STR_TR_Yes; +QString STR_TR_No; QString STR_TR_Min; // Minimum QString STR_TR_Max; // Maximum @@ -485,6 +487,8 @@ void initializeStrings() STR_TR_End = QObject::tr("End"); STR_TR_On = QObject::tr("On"); STR_TR_Off = QObject::tr("Off"); + STR_TR_Yes = QObject::tr("Yes"); + STR_TR_No = QObject::tr("No"); STR_TR_Min = QObject::tr("Min"); // Minimum STR_TR_Max = QObject::tr("Max"); // Maximum diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h index 765a451d..98c1e1a4 100644 --- a/sleepyhead/SleepLib/common.h +++ b/sleepyhead/SleepLib/common.h @@ -284,6 +284,8 @@ extern QString STR_TR_Start; extern QString STR_TR_End; extern QString STR_TR_On; extern QString STR_TR_Off; +extern QString STR_TR_Yes; +extern QString STR_TR_No; extern QString STR_TR_Min; // Minimum diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index 8ea8d7da..d006783c 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -1202,7 +1202,7 @@ bool PRS1Import::ParseSummaryF0() session->settings[PRS1_MaskAlert] = (bool) (data[0x0c] & 0x08); session->settings[PRS1_ShowAHI] = (bool) (data[0x0c] & 0x04); session->settings[PRS1_HumidStatus] = (bool)(data[0x09] & 0x80); // Humidifier Connected - session->settings[PRS1_HumitSetting] = (int)(data[0x09] & 7); // Humidifier Value + session->settings[PRS1_HumidLevel] = (int)(data[0x09] & 7); // Humidifier Value // session-> @@ -2022,6 +2022,29 @@ void PRS1Loader::Register() chan->addOption(2, QObject::tr("x2")); chan->addOption(3, QObject::tr("x3")); + channel.add(GRP_CPAP, chan = new Channel(PRS1_HumidStatus = 0xe101, SETTING, SESSION, + "PRS1HumidStat", + QObject::tr("Humidifier Status"), + QObject::tr("PRS1 humidifier connected?"), + QObject::tr("Humidifier Status"), + "", DEFAULT, Qt::green)); + chan->addOption(0, STR_TR_No); + chan->addOption(1, STR_TR_Yes); + + channel.add(GRP_CPAP, chan = new Channel(PRS1_HumidLevel = 0xe102, SETTING, SESSION, + "PRS1HumidLevel", + QObject::tr("Humidification Level"), + QObject::tr("PRS1 Humidification level"), + QObject::tr("Humid. Lvl."), + "", DEFAULT, Qt::green)); + chan->addOption(0, STR_TR_Off); + chan->addOption(1, QObject::tr("x1")); + chan->addOption(2, QObject::tr("x2")); + chan->addOption(3, QObject::tr("x3")); + chan->addOption(4, QObject::tr("x4")); + chan->addOption(5, QObject::tr("x5")); + + QString unknowndesc=QObject::tr("Unknown PRS1 Code %1"); QString unknownname=QObject::tr("PRS1_%1"); QString unknownshort=QObject::tr("PRS1_%1"); diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h index 3d81f4e0..ffc6a07d 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h @@ -176,6 +176,10 @@ class PRS1Loader : public CPAPLoader virtual ChannelID PresReliefMode() { return PRS1_FlexMode; } virtual ChannelID PresReliefLevel() { return PRS1_FlexLevel; } + virtual ChannelID HumidifierConnected() { return PRS1_HumidStatus; } + virtual ChannelID HumidifierLevel() { return PRS1_HumidLevel; } + + QHash sesstasks; protected: diff --git a/sleepyhead/SleepLib/machine_common.cpp b/sleepyhead/SleepLib/machine_common.cpp index 7cf839c2..5188df0e 100644 --- a/sleepyhead/SleepLib/machine_common.cpp +++ b/sleepyhead/SleepLib/machine_common.cpp @@ -33,7 +33,7 @@ ChannelID RMS9_E01, RMS9_E02, RMS9_SetPressure, RMS9_MaskOnTime; ChannelID INTELLIPAP_Unknown1, INTELLIPAP_Unknown2; ChannelID PRS1_00, PRS1_01, PRS1_08, PRS1_0A, PRS1_0B, PRS1_0C, PRS1_0E, PRS1_0F, CPAP_LargeLeak, PRS1_12, - PRS1_FlexMode, PRS1_FlexLevel, PRS1_HumidStatus, PRS1_HumitSetting, PRS1_SysLock, + PRS1_FlexMode, PRS1_FlexLevel, PRS1_HumidStatus, PRS1_HumidLevel, PRS1_SysLock, PRS1_SysOneResistStat, PRS1_SysOneResistSet, PRS1_HoseDiam, PRS1_AutoOn, PRS1_AutoOff, PRS1_MaskAlert, PRS1_ShowAHI; diff --git a/sleepyhead/SleepLib/machine_common.h b/sleepyhead/SleepLib/machine_common.h index ec69f61b..97106d0b 100644 --- a/sleepyhead/SleepLib/machine_common.h +++ b/sleepyhead/SleepLib/machine_common.h @@ -154,7 +154,7 @@ extern ChannelID CPAP_IPAP, CPAP_IPAPLo, CPAP_IPAPHi, CPAP_EPAP, CPAP_EPAPLo, CP extern ChannelID RMS9_E01, RMS9_E02, RMS9_SetPressure, RMS9_MaskOnTime; extern ChannelID PRS1_00, PRS1_01, PRS1_08, PRS1_0A, PRS1_0B, PRS1_0C, PRS1_0E, PRS1_0F, CPAP_LargeLeak, PRS1_12, - PRS1_FlexMode, PRS1_FlexLevel, PRS1_HumidStatus, PRS1_HumitSetting, CPAP_HumidSetting, PRS1_SysLock, + PRS1_FlexMode, PRS1_FlexLevel, PRS1_HumidStatus, PRS1_HumidLevel, CPAP_HumidSetting, PRS1_SysLock, PRS1_SysOneResistStat, PRS1_SysOneResistSet, PRS1_HoseDiam, PRS1_AutoOn, PRS1_AutoOff, PRS1_MaskAlert, PRS1_ShowAHI; diff --git a/sleepyhead/SleepLib/machine_loader.h b/sleepyhead/SleepLib/machine_loader.h index 33724f72..ee96bde8 100644 --- a/sleepyhead/SleepLib/machine_loader.h +++ b/sleepyhead/SleepLib/machine_loader.h @@ -122,6 +122,8 @@ public: virtual QString PresReliefLabel() { return QString(""); } virtual ChannelID PresReliefMode() { return NoChannel; } virtual ChannelID PresReliefLevel() { return NoChannel; } + virtual ChannelID HumidifierConnected() { return NoChannel; } + virtual ChannelID HumidifierLevel() { return CPAP_HumidSetting; } }; diff --git a/sleepyhead/SleepLib/schema.cpp b/sleepyhead/SleepLib/schema.cpp index 367e461a..ae0930f1 100644 --- a/sleepyhead/SleepLib/schema.cpp +++ b/sleepyhead/SleepLib/schema.cpp @@ -477,7 +477,6 @@ void init() RMS9_E01 = schema::channel["RMS9_E01"].id(); RMS9_E02 = schema::channel["RMS9_E02"].id(); RMS9_SetPressure = schema::channel["SetPressure"].id(); // TODO: this isn't needed anymore - PRS1_HumidStatus = schema::channel["HumidStat"].id(); CPAP_HumidSetting = schema::channel["HumidSet"].id(); PRS1_SysLock = schema::channel["SysLock"].id(); PRS1_SysOneResistStat = schema::channel["SysOneResistStat"].id(); diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index 5bda16e4..b45c44e9 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -972,10 +972,14 @@ QString Daily::getMachineSettings(Day * cpap) { ChannelID pr_level_chan = NoChannel; ChannelID pr_mode_chan = NoChannel; + ChannelID hum_stat_chan = NoChannel; + ChannelID hum_level_chan = NoChannel; CPAPLoader * loader = dynamic_cast(cpap->machine->loader()); if (loader) { pr_level_chan = loader->PresReliefLevel(); pr_mode_chan = loader->PresReliefMode(); + hum_stat_chan = loader->HumidifierConnected(); + hum_level_chan = loader->HumidifierLevel(); } if ((pr_level_chan != NoChannel) && (cpap->settingExists(pr_level_chan))) { @@ -987,12 +991,12 @@ QString Daily::getMachineSettings(Day * cpap) { .arg(flexstr); } - QString mclass=cpap->machine->loaderName(); - if (mclass==STR_MACH_PRS1 || mclass==STR_MACH_FPIcon) { - int humid=round(cpap->settings_wavg(CPAP_HumidSetting)); - html+=QString(""+STR_TR_Humidifier+"%1%2") - .arg(schema::channel[CPAP_HumidSetting].description()) - .arg(humid==0 ? STR_GEN_Off : "x"+QString::number(humid)); + + if (cpap->settingExists(hum_level_chan)) { + int humid=round(cpap->settings_wavg(hum_level_chan)); + html+=QString(""+schema::channel[hum_level_chan].label()+"%1%2") + .arg(schema::channel[hum_level_chan].description()) + .arg(humid == 0 ? STR_GEN_Off : "x"+QString::number(humid)); } html+=""; html+="
\n"; diff --git a/sleepyhead/docs/channels.xml b/sleepyhead/docs/channels.xml index f182da52..a1b34a65 100644 --- a/sleepyhead/docs/channels.xml +++ b/sleepyhead/docs/channels.xml @@ -72,18 +72,6 @@ Important: One id code per item, DO NOT CHANGE ID NUMBERS!!! - - - -