mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 12:10:43 +00:00
Merge master and clean up Open code
This commit is contained in:
commit
1148d1b69e
@ -6647,10 +6647,12 @@ bool PRS1DataChunk::ParseSettingsF0V6(const unsigned char* data, int size)
|
|||||||
CHECK_VALUE(data[pos], 0x80); // EZ-Start enabled
|
CHECK_VALUE(data[pos], 0x80); // EZ-Start enabled
|
||||||
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_EZ_START, data[pos] != 0));
|
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_EZ_START, data[pos] != 0));
|
||||||
break;
|
break;
|
||||||
case 0x42: // EZ-Start for Auto-CPAP?
|
case 0x42: // EZ-Start enabled for Auto-CPAP?
|
||||||
// Seen on 500X110 before 0x2b when EZ-Start is enabled on Auto-CPAP
|
// Seen on 500X110 before 0x2b when EZ-Start is enabled on Auto-CPAP
|
||||||
CHECK_VALUE(len, 1);
|
CHECK_VALUE(len, 1);
|
||||||
CHECK_VALUE(data[pos], 0x80); // EZ-Start enabled
|
CHECK_VALUES(data[pos], 0x00, 0x80); // both seem to mean enabled, 0x00 appears when Opti-Start is used instead
|
||||||
|
// TODO: How to represent which one is active in practice? Should this always be "true" since
|
||||||
|
// either value means that the setting is enabled?
|
||||||
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_EZ_START, data[pos] != 0));
|
this->AddEvent(new PRS1ParsedSettingEvent(PRS1_SETTING_EZ_START, data[pos] != 0));
|
||||||
break;
|
break;
|
||||||
case 0x2b: // Ramp Type
|
case 0x2b: // Ramp Type
|
||||||
|
@ -360,10 +360,11 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
// firstImportDay = lastDate.addDays(-1);
|
// firstImportDay = lastDate.addDays(-1);
|
||||||
} else { // Starting from new beginnings - new or purged
|
} else { // Starting from new beginnings - new or purged
|
||||||
qDebug() << "New machine or just purged";
|
qDebug() << "New machine or just purged";
|
||||||
|
p_profile->forceResmedPrefs();
|
||||||
|
mach = p_profile->CreateMachine( info );
|
||||||
}
|
}
|
||||||
QDateTime ignoreBefore = p_profile->session->ignoreOlderSessionsDate();
|
QDateTime ignoreBefore = p_profile->session->ignoreOlderSessionsDate();
|
||||||
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
||||||
mach = p_profile->CreateMachine( info );
|
|
||||||
|
|
||||||
if (ignoreOldSessions)
|
if (ignoreOldSessions)
|
||||||
firstImportDay = ignoreBefore.date();
|
firstImportDay = ignoreBefore.date();
|
||||||
@ -469,11 +470,9 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
// We are done with the Parsed STR EDF objects, so delete them
|
// We are done with the Parsed STR EDF objects, so delete them
|
||||||
for (auto it=STRmap.begin(), end=STRmap.end(); it != end; ++it) {
|
for (auto it=STRmap.begin(), end=STRmap.end(); it != end; ++it) {
|
||||||
qDebug() << "Deleting edf of" << it.value().filename;
|
qDebug() << "Deleting edf of" << it.value().filename;
|
||||||
// sleep(1);
|
|
||||||
delete it.value().edf;
|
delete it.value().edf;
|
||||||
}
|
}
|
||||||
qDebug() << "Finished STRmap cleanup";
|
qDebug() << "Finished STRmap cleanup";
|
||||||
// sleep(1);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Create the backup folder for storing a copy of everything in..
|
// Create the backup folder for storing a copy of everything in..
|
||||||
|
@ -297,10 +297,12 @@ bool ViatomFile::ParseHeader()
|
|||||||
//int spo2_avg = header[17];
|
//int spo2_avg = header[17];
|
||||||
//int spo2_min = header[18];
|
//int spo2_min = header[18];
|
||||||
//int spo2_3pct = header[19]; // number of events
|
//int spo2_3pct = header[19]; // number of events
|
||||||
//int spo2_4pct = header[20]; // number of events
|
int spo2_4pct = header[20]; // number of events
|
||||||
CHECK_VALUE(header[21], 0);
|
if (header[21] > spo2_4pct) {
|
||||||
//int time_under_90pct = header[22]; // in seconds
|
//CHECK_VALUE(header[21], 0); // sometimes nonzero; maybe spo2_5pct or something like that?
|
||||||
CHECK_VALUE(header[23], 0);
|
UNEXPECTED_VALUE(header[21], "< drops over 4%");
|
||||||
|
}
|
||||||
|
//int time_under_90pct = header[22] | (header[23] << 8); // in seconds
|
||||||
//int events_under_90pct = header[24]; // number of distinct events
|
//int events_under_90pct = header[24]; // number of distinct events
|
||||||
//float o2_score = header[25] * 0.1;
|
//float o2_score = header[25] * 0.1;
|
||||||
CHECK_VALUE(header[26], 0);
|
CHECK_VALUE(header[26], 0);
|
||||||
@ -352,9 +354,9 @@ QList<ViatomFile::Record> ViatomFile::ReadData()
|
|||||||
// Read all Pulse, SPO2 and Motion data
|
// Read all Pulse, SPO2 and Motion data
|
||||||
do {
|
do {
|
||||||
ViatomFile::Record rec;
|
ViatomFile::Record rec;
|
||||||
in >> rec.spo2 >> rec.hr >> rec.oximetry_invalid >> rec.motion >> rec._unk;
|
in >> rec.spo2 >> rec.hr >> rec.oximetry_invalid >> rec.motion >> rec.vibration;
|
||||||
CHECK_VALUES(rec.oximetry_invalid, 0, 0xFF);
|
CHECK_VALUES(rec.oximetry_invalid, 0, 0xFF);
|
||||||
CHECK_VALUE(rec._unk, 0); // maybe vibration, given column label in CSV
|
CHECK_VALUES(rec.vibration, 0, 0x80); // 0x80 when vibration is triggered
|
||||||
if (rec.oximetry_invalid == 0xFF) {
|
if (rec.oximetry_invalid == 0xFF) {
|
||||||
CHECK_VALUE(rec.spo2, 0xFF);
|
CHECK_VALUE(rec.spo2, 0xFF);
|
||||||
CHECK_VALUE(rec.hr, 0xFF);
|
CHECK_VALUE(rec.hr, 0xFF);
|
||||||
@ -375,7 +377,7 @@ QList<ViatomFile::Record> ViatomFile::ReadData()
|
|||||||
|| a.hr != b.hr
|
|| a.hr != b.hr
|
||||||
|| a.oximetry_invalid != b.oximetry_invalid
|
|| a.oximetry_invalid != b.oximetry_invalid
|
||||||
|| a.motion != b.motion
|
|| a.motion != b.motion
|
||||||
|| a._unk != b._unk) {
|
|| a.vibration != b.vibration) {
|
||||||
all_are_duplicated = false;
|
all_are_duplicated = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
unsigned char hr;
|
unsigned char hr;
|
||||||
unsigned char oximetry_invalid;
|
unsigned char oximetry_invalid;
|
||||||
unsigned char motion;
|
unsigned char motion;
|
||||||
unsigned char _unk;
|
unsigned char vibration;
|
||||||
};
|
};
|
||||||
ViatomFile(QFile & file);
|
ViatomFile(QFile & file);
|
||||||
~ViatomFile() = default;
|
~ViatomFile() = default;
|
||||||
|
@ -94,14 +94,6 @@ Profile::~Profile()
|
|||||||
removeLock();
|
removeLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete user;
|
|
||||||
delete doctor;
|
|
||||||
delete cpap;
|
|
||||||
delete oxi;
|
|
||||||
delete appearance;
|
|
||||||
delete session;
|
|
||||||
delete general;
|
|
||||||
|
|
||||||
// delete machine objects...
|
// delete machine objects...
|
||||||
for (auto & mach : m_machlist) {
|
for (auto & mach : m_machlist) {
|
||||||
delete mach;
|
delete mach;
|
||||||
@ -111,6 +103,13 @@ Profile::~Profile()
|
|||||||
delete day;
|
delete day;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete user;
|
||||||
|
delete doctor;
|
||||||
|
delete cpap;
|
||||||
|
delete oxi;
|
||||||
|
delete appearance;
|
||||||
|
delete session;
|
||||||
|
delete general;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Profile::Save(QString filename)
|
bool Profile::Save(QString filename)
|
||||||
@ -354,7 +353,17 @@ qint64 Profile::diskSpace()
|
|||||||
return (diskSpaceSummaries()+diskSpaceEvents()+diskSpaceBackups());
|
return (diskSpaceSummaries()+diskSpaceEvents()+diskSpaceBackups());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Profile::forceResmedPrefs()
|
||||||
|
{
|
||||||
|
session->setBackupCardData(true);
|
||||||
|
session->setDaySplitTime(QTime(12,0,0));
|
||||||
|
session->setIgnoreShortSessions(0);
|
||||||
|
session->setCombineCloseSessions(0);
|
||||||
|
session->setLockSummarySessions(true);
|
||||||
|
general->setPrefCalcPercentile(95.0); // 95%
|
||||||
|
general->setPrefCalcMiddle(0); // Median (50%)
|
||||||
|
general->setPrefCalcMax(1); // 99.9th percentile max
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
class Environment
|
class Environment
|
||||||
|
@ -57,6 +57,9 @@ class Profile : public Preferences
|
|||||||
qint64 diskSpaceBackups();
|
qint64 diskSpaceBackups();
|
||||||
qint64 diskSpace();
|
qint64 diskSpace();
|
||||||
|
|
||||||
|
//! \brief Force some preferences for ResMed machines
|
||||||
|
virtual void forceResmedPrefs();
|
||||||
|
|
||||||
//! \brief Returns hostname that locked profile, or empty string if unlocked
|
//! \brief Returns hostname that locked profile, or empty string if unlocked
|
||||||
QString checkLock();
|
QString checkLock();
|
||||||
|
|
||||||
|
@ -488,7 +488,10 @@ QMAKE_CXXFLAGS += -Werror
|
|||||||
# Make deprecation warnings just warnings
|
# Make deprecation warnings just warnings
|
||||||
QMAKE_CFLAGS += -Wno-error=deprecated-declarations
|
QMAKE_CFLAGS += -Wno-error=deprecated-declarations
|
||||||
QMAKE_CXXFLAGS += -Wno-error=deprecated-declarations
|
QMAKE_CXXFLAGS += -Wno-error=deprecated-declarations
|
||||||
|
lessThan(QT_MAJOR_VERSION,5)|lessThan(QT_MINOR_VERSION,9) {
|
||||||
|
QMAKE_CFLAGS += -Wno-error=strict-aliasing
|
||||||
|
QMAKE_CXXFLAGS += -Wno-error=strict-aliasing
|
||||||
|
}
|
||||||
|
|
||||||
# Create a debug GUI build by adding "CONFIG+=memdebug" to your qmake command
|
# Create a debug GUI build by adding "CONFIG+=memdebug" to your qmake command
|
||||||
memdebug {
|
memdebug {
|
||||||
|
@ -52,6 +52,8 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
channeltype[schema::UNKNOWN] = tr("Always Minor");
|
channeltype[schema::UNKNOWN] = tr("Always Minor");
|
||||||
bool haveResMed = false;
|
bool haveResMed = false;
|
||||||
QList<Machine *> machines = profile->GetMachines(MT_CPAP);
|
QList<Machine *> machines = profile->GetMachines(MT_CPAP);
|
||||||
|
// qDebug() << "Machile list size is" << machines.size();
|
||||||
|
if ( machines.size() > 0 ) {
|
||||||
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
||||||
const QString & mclass=(*it)->loaderName();
|
const QString & mclass=(*it)->loaderName();
|
||||||
if (mclass == STR_MACH_ResMed) {
|
if (mclass == STR_MACH_ResMed) {
|
||||||
@ -59,6 +61,12 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (QMessageBox::question(this, tr("No CPAP machines detected"),
|
||||||
|
tr("Will you be using a ResMed brand machine?"),
|
||||||
|
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes )
|
||||||
|
haveResMed = true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LOCK_RESMED_SESSIONS
|
#ifdef LOCK_RESMED_SESSIONS
|
||||||
// Remove access to session splitting options and show ResMed users a notice instead
|
// Remove access to session splitting options and show ResMed users a notice instead
|
||||||
@ -66,21 +74,13 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
ui->ResMedWarning->setVisible(haveResMed);
|
ui->ResMedWarning->setVisible(haveResMed);
|
||||||
|
|
||||||
if (haveResMed) {
|
if (haveResMed) {
|
||||||
|
profile->forceResmedPrefs();
|
||||||
ui->sessionSplitWidget->setVisible(!haveResMed);
|
ui->sessionSplitWidget->setVisible(!haveResMed);
|
||||||
profile->session->setDaySplitTime(QTime(12,0,0));
|
|
||||||
profile->session->setIgnoreShortSessions(0);
|
|
||||||
profile->session->setCombineCloseSessions(0);
|
|
||||||
profile->session->setLockSummarySessions(true);
|
|
||||||
p_profile->general->setPrefCalcPercentile(95.0); // 95%
|
|
||||||
p_profile->general->setPrefCalcMiddle(0); // Median (50%)
|
|
||||||
p_profile->general->setPrefCalcMax(1); // 99.9th percentile max
|
|
||||||
ui->prefCalcMax->setEnabled(false);
|
ui->prefCalcMax->setEnabled(false);
|
||||||
ui->prefCalcMiddle->setEnabled(false);
|
ui->prefCalcMiddle->setEnabled(false);
|
||||||
ui->prefCalcPercentile->setEnabled(false);
|
ui->prefCalcPercentile->setEnabled(false);
|
||||||
ui->showUnknownFlags->setEnabled(false);
|
ui->showUnknownFlags->setEnabled(false);
|
||||||
ui->calculateUnintentionalLeaks->setEnabled(false);
|
ui->calculateUnintentionalLeaks->setEnabled(false);
|
||||||
|
|
||||||
p_profile->session->setBackupCardData(true);
|
|
||||||
ui->createSDBackups->setChecked(true);
|
ui->createSDBackups->setChecked(true);
|
||||||
ui->createSDBackups->setEnabled(false);
|
ui->createSDBackups->setEnabled(false);
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ void ResmedTests::initTestCase(void)
|
|||||||
void ResmedTests::cleanupTestCase(void)
|
void ResmedTests::cleanupTestCase(void)
|
||||||
{
|
{
|
||||||
delete AppSetting;
|
delete AppSetting;
|
||||||
delete p_pref;
|
|
||||||
delete p_profile;
|
delete p_profile;
|
||||||
p_profile = nullptr;
|
p_profile = nullptr;
|
||||||
|
delete p_pref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,26 +1,34 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
set DIR=%~dp0
|
set DIR=%~dp0
|
||||||
|
:::set DIR=\oscar\oscar-code\oscar\
|
||||||
cd %DIR%
|
cd %DIR%
|
||||||
|
|
||||||
for /f %%i in ('git rev-parse --git-dir') do set GIT_DIR=%%i
|
:: Check git in path and git directory can be found
|
||||||
if "%GIT_DIR%"=="" goto GitDone
|
where /Q git.exe
|
||||||
|
if errorlevel 1 goto GitFail
|
||||||
|
|
||||||
for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%i
|
git rev-parse --git-dir >nul 2>&1
|
||||||
if "%GIT_BRANCH%"=="HEAD" set GIT_BRANCH=""
|
if errorlevel 1 goto GitFail
|
||||||
for /f %%i in ('git rev-parse --short HEAD') do set GIT_REVISION=%%i
|
|
||||||
for /f %%i in ('git diff-index --quiet HEAD --') do set GIT_INDEX=%%i
|
for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%i
|
||||||
if "%GIT_INDEX%"!=="" (
|
if "%GIT_BRANCH%"=="HEAD" set GIT_BRANCH=""
|
||||||
|
for /f %%i in ('git rev-parse --short HEAD') do set GIT_REVISION=%%i
|
||||||
|
|
||||||
|
git diff-index --quiet HEAD --
|
||||||
|
if %errorlevel%==0 goto GitTag
|
||||||
set GIT_REVISION=%GIT_REVISION%-plus
|
set GIT_REVISION=%GIT_REVISION%-plus
|
||||||
set GIT_TAG=
|
set GIT_TAG=
|
||||||
goto GitDone
|
goto GitDone
|
||||||
)
|
:GitTag
|
||||||
|
for /f %%i in ('git describe --exact-match --tags') do set GIT_TAG=%%i
|
||||||
for /f %%i in ('git describe --exact-match --tags') do set GIT_TAG=%%i
|
goto GitDone
|
||||||
|
|
||||||
|
:GitFail
|
||||||
|
set GIT_REVISION="private"
|
||||||
:GitDone
|
:GitDone
|
||||||
|
|
||||||
@echo Update_gtinfo.bat: GIT_DIR=%GIT_DIR%, GIT_BRANCH=%GIT_BRANCH%, GIT_REVISION=%GIT_REVISION%, GIT_TAG=%GIT_TAG%
|
@echo Update_gtinfo.bat: GIT_BRANCH=%GIT_BRANCH%, GIT_REVISION=%GIT_REVISION%, GIT_TAG=%GIT_TAG%
|
||||||
|
|
||||||
echo // This is an auto generated file > %DIR%git_info.new
|
echo // This is an auto generated file > %DIR%git_info.new
|
||||||
|
|
||||||
@ -34,9 +42,6 @@ if "%GIT_TAG%"=="" goto DefinesDone
|
|||||||
echo #define GIT_TAG "%GIT_TAG%" >> %DIR%git_info.new
|
echo #define GIT_TAG "%GIT_TAG%" >> %DIR%git_info.new
|
||||||
:DefinesDone
|
:DefinesDone
|
||||||
|
|
||||||
:::type %DIR%git_info.new
|
|
||||||
:::set
|
|
||||||
|
|
||||||
fc %DIR%git_info.h %DIR%git_info.new 1>nul 2>nul && del /q %DIR%git_info.new || goto NewFile
|
fc %DIR%git_info.h %DIR%git_info.new 1>nul 2>nul && del /q %DIR%git_info.new || goto NewFile
|
||||||
goto AllDone
|
goto AllDone
|
||||||
|
|
||||||
@ -45,3 +50,4 @@ echo Updating %DIR%git_info.h
|
|||||||
move /y %DIR%git_info.new %DIR%git_info.h
|
move /y %DIR%git_info.new %DIR%git_info.h
|
||||||
|
|
||||||
:AllDone
|
:AllDone
|
||||||
|
endlocal
|
Loading…
Reference in New Issue
Block a user