save Oximetry Preferences that are not saved

This commit is contained in:
LoudSnorer 2023-01-22 13:13:26 -05:00
parent 30db244ac5
commit e512a2b3b4
4 changed files with 23 additions and 3240 deletions

View File

@ -299,7 +299,11 @@ const QString STR_OS_SPO2DropDuration = "SPO2DropDuration";
const QString STR_OS_SPO2DropPercentage = "SPO2DropPercentage"; const QString STR_OS_SPO2DropPercentage = "SPO2DropPercentage";
const QString STR_OS_PulseChangeDuration = "PulseChangeDuration"; const QString STR_OS_PulseChangeDuration = "PulseChangeDuration";
const QString STR_OS_PulseChangeBPM = "PulseChangeBPM"; const QString STR_OS_PulseChangeBPM = "PulseChangeBPM";
const QString STR_OS_SkipOxiIntroScreen = "SkipOxiIntroScreen"; const QString STR_OS_SkipOxiIntroScreen = "SkipOxiIntroScreen";
const QString STR_OS_oxiDesaturationThreshold = "oxiDesaturationThreshold";
const QString STR_OS_flagPulseAbove = "flagPulseAbove";
const QString STR_OS_flagPulseBelow = "flagPulseBelow";
// CPAPSettings Strings // CPAPSettings Strings
@ -489,6 +493,10 @@ class OxiSettings : public PrefSettings
initPref(STR_OS_PulseChangeDuration, 8.0); initPref(STR_OS_PulseChangeDuration, 8.0);
initPref(STR_OS_PulseChangeBPM, 5.0); initPref(STR_OS_PulseChangeBPM, 5.0);
initPref(STR_OS_SkipOxiIntroScreen, false); initPref(STR_OS_SkipOxiIntroScreen, false);
initPref(STR_OS_oxiDesaturationThreshold, 88);
initPref(STR_OS_flagPulseAbove, 130);
initPref(STR_OS_flagPulseBelow, 40);
} }
bool oximetryEnabled() const { return getPref(STR_OS_EnableOximetry).toBool(); } bool oximetryEnabled() const { return getPref(STR_OS_EnableOximetry).toBool(); }
@ -502,6 +510,10 @@ class OxiSettings : public PrefSettings
double pulseChangeBPM() const { return getPref(STR_OS_PulseChangeBPM).toDouble(); } double pulseChangeBPM() const { return getPref(STR_OS_PulseChangeBPM).toDouble(); }
bool skipOxiIntroScreen() const { return getPref(STR_OS_SkipOxiIntroScreen).toBool(); } bool skipOxiIntroScreen() const { return getPref(STR_OS_SkipOxiIntroScreen).toBool(); }
double oxiDesaturationThreshold() const { return getPref(STR_OS_oxiDesaturationThreshold).toDouble(); }
double flagPulseAbove() const { return getPref(STR_OS_flagPulseAbove).toDouble(); }
double flagPulseBelow() const { return getPref(STR_OS_flagPulseBelow).toDouble(); }
void setOximetryEnabled(bool enabled) { setPref(STR_OS_EnableOximetry, enabled); } void setOximetryEnabled(bool enabled) { setPref(STR_OS_EnableOximetry, enabled); }
void setDefaultDevice(QString name) { setPref(STR_OS_DefaultDevice, name); } void setDefaultDevice(QString name) { setPref(STR_OS_DefaultDevice, name); }
@ -517,6 +529,9 @@ class OxiSettings : public PrefSettings
void setPulseChangeDuration(double duration) { void setPulseChangeDuration(double duration) {
setPref(STR_OS_PulseChangeDuration, duration); setPref(STR_OS_PulseChangeDuration, duration);
} }
void setOxiDesaturationThreshold(double value) { setPref(STR_OS_oxiDesaturationThreshold, value); }
void setFlagPulseAbove(double value) { setPref(STR_OS_flagPulseAbove, value); }
void setFlagPulseBelow(double value) { setPref(STR_OS_flagPulseBelow, value); }
}; };
/*! \class CPAPSettings /*! \class CPAPSettings

View File

@ -203,12 +203,9 @@ void init()
// Oximetry // Oximetry
schema::channel.add(GRP_OXI, new Channel(OXI_Pulse = 0x1800, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Pulse, schema::channel.add(GRP_OXI, new Channel(OXI_Pulse = 0x1800, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Pulse,
QObject::tr("Pulse Rate"), QObject::tr("Heart rate in beats per minute"), QObject::tr("Pulse Rate"), STR_UNIT_BPM, DEFAULT, QColor("red"))); QObject::tr("Pulse Rate"), QObject::tr("Heart rate in beats per minute"), QObject::tr("Pulse Rate"), STR_UNIT_BPM, DEFAULT, QColor("red")));
schema::channel[OXI_Pulse].setLowerThreshold(40);
schema::channel[OXI_Pulse].setUpperThreshold(130);
schema::channel.add(GRP_OXI, new Channel(OXI_SPO2 = 0x1801, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_SPO2, schema::channel.add(GRP_OXI, new Channel(OXI_SPO2 = 0x1801, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_SPO2,
QString("SpO2 %"), QObject::tr("Blood-oxygen saturation percentage"), QString("SpO2"), STR_UNIT_Percentage, DEFAULT, QColor("blue"))); QString("SpO2 %"), QObject::tr("Blood-oxygen saturation percentage"), QString("SpO2"), STR_UNIT_Percentage, DEFAULT, QColor("blue")));
schema::channel[OXI_SPO2].setLowerThreshold(88);
schema::channel.add(GRP_OXI, new Channel(OXI_Plethy = 0x1802, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Plethy, schema::channel.add(GRP_OXI, new Channel(OXI_Plethy = 0x1802, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Plethy,
QObject::tr("Plethysomogram"), QObject::tr("An optical Photo-plethysomogram showing heart rhythm"), QObject::tr("Plethy"), STR_UNIT_Hz, DEFAULT, QColor("#404040"))); QObject::tr("Plethysomogram"), QObject::tr("An optical Photo-plethysomogram showing heart rhythm"), QObject::tr("Plethy"), STR_UNIT_Hz, DEFAULT, QColor("#404040")));

View File

@ -130,9 +130,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
ui->showLeakRedline->setChecked(profile->cpap->showLeakRedline()); ui->showLeakRedline->setChecked(profile->cpap->showLeakRedline());
ui->leakRedlineSpinbox->setValue(profile->cpap->leakRedline()); ui->leakRedlineSpinbox->setValue(profile->cpap->leakRedline());
ui->oxiDesaturationThreshold->setValue(schema::channel[OXI_SPO2].lowerThreshold()); //change initialization from hard coded in schema to profile data.
ui->flagPulseAbove->setValue(schema::channel[OXI_Pulse].upperThreshold()); ui->oxiDesaturationThreshold->setValue(profile->oxi->oxiDesaturationThreshold());
ui->flagPulseBelow->setValue(schema::channel[OXI_Pulse].lowerThreshold()); ui->flagPulseAbove->setValue(profile->oxi->flagPulseAbove());
ui->flagPulseBelow->setValue(profile->oxi->flagPulseBelow());
ui->spo2Drop->setValue(profile->oxi->spO2DropPercentage()); ui->spo2Drop->setValue(profile->oxi->spO2DropPercentage());
ui->spo2DropTime->setValue(profile->oxi->spO2DropDuration()); ui->spo2DropTime->setValue(profile->oxi->spO2DropDuration());
@ -898,6 +899,10 @@ bool PreferencesDialog::Save()
profile->oxi->setPulseChangeDuration(ui->pulseChangeTime->value()); profile->oxi->setPulseChangeDuration(ui->pulseChangeTime->value());
profile->oxi->setOxiDiscardThreshold(ui->oxiDiscardThreshold->value()); profile->oxi->setOxiDiscardThreshold(ui->oxiDiscardThreshold->value());
profile->oxi->setOxiDesaturationThreshold(ui->oxiDesaturationThreshold->value());
profile->oxi->setFlagPulseAbove(ui->flagPulseAbove->value());
profile->oxi->setFlagPulseBelow(ui->flagPulseBelow->value());
profile->cpap->setAHIWindow(ui->ahiGraphWindowSize->value()); profile->cpap->setAHIWindow(ui->ahiGraphWindowSize->value());
profile->cpap->setAHIReset(ui->ahiGraphZeroReset->isChecked()); profile->cpap->setAHIReset(ui->ahiGraphZeroReset->isChecked());

File diff suppressed because it is too large Load Diff