Some oximetry fixes

This commit is contained in:
Mark Watkins 2011-07-30 03:40:22 -07:00
parent db0eb31b8f
commit e9bf107c22
2 changed files with 33 additions and 10 deletions

View File

@ -82,7 +82,8 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
TV=new gGraphWindow(gSplitter,tr("Tidal Volume"),SF);
RR=new gGraphWindow(gSplitter,tr("Respiratory Rate"),SF);
PTB=new gGraphWindow(gSplitter,tr("Patient Trig Breaths"),SF);
PULSE=new gGraphWindow(gSplitter,tr("Pulse & SpO2"),SF);
PULSE=new gGraphWindow(gSplitter,tr("Pulse"),SF);
SPO2=new gGraphWindow(gSplitter,tr("SPO2"),SF);
TAP=new gGraphWindow(NULL,"",(QGLWidget* )NULL);
TAP_EAP=new gGraphWindow(NULL,"",(QGLWidget* )NULL);
@ -206,16 +207,17 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
PULSE->setMinimumHeight(min_height);
// SPO2=new gGraphWindow(gSplitter,tr("SpO2"),SF);
// SPO2->AddLayer(new gXAxis());
// SPO2->AddLayer(new gYAxis());
// SPO2->AddLayer(new gFooBar());
PULSE->AddLayer(AddOXI(new gLineChart(OXI_SPO2,Qt::blue,true)));
SPO2->AddLayer(new gXAxis());
SPO2->AddLayer(new gYAxis());
SPO2->AddLayer(AddOXI(new gLineChart(OXI_SPO2,Qt::blue,true)));
SPO2->setMinimumHeight(min_height);
// SPO2->AddLayer(new gFooBar());
// SPO2->setMinimumHeight(min_height);
// SPO2->LinkZoom(PULSE);
// PULSE->LinkZoom(SPO2);
// SPO2->hide();
PULSE->hide();
// PULSE->hide();
gSegmentChart *seg;
@ -264,7 +266,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
for (int i=0;i<ss;i++) {
AddGraph(graphs[i]);
int j=gSplitter->indexOf(graphs[i]);
gSplitter->setStretchFactor(j,10);
//gSplitter->setStretchFactor(j,1);
for (int j=0;j<ss;j++) {
if (graphs[i]!=graphs[j])
graphs[i]->LinkZoom(graphs[j]);
@ -272,6 +274,10 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
}
AddGraph(PULSE);
AddGraph(SPO2);
SPO2->LinkZoom(PULSE);
PULSE->LinkZoom(SPO2);
// AddGraph(SPO2);
// spacer=new QWidget(gSplitter);
@ -532,6 +538,7 @@ void Daily::Load(QDate date)
} else {
NoData->hide();
int vis=0;
for (unsigned i=0;i<Graphs.size();i++) {
if (Graphs[i]->isEmpty()) {
GraphAction[i]->setVisible(false);
@ -547,6 +554,9 @@ void Daily::Load(QDate date)
}
}
}
if (!cpap) {
SF->hide();
}
//gSplitter->setMinimumHeight(0);
gSplitter->setMinimumHeight(vis*default_height);
//if (vis>4) {

View File

@ -350,9 +350,10 @@ void DumpBytes(int blocks, unsigned char * b,int len)
// Move this code to CMS50 Importer??
void Oximetry::on_ImportButton_clicked()
{
ui->ImportButton->setDisabled(true);
QMessageBox msgbox(QMessageBox::Information,"Importing","Please Wait",QMessageBox::NoButton,this);
msgbox.show();
QApplication::processEvents();
const int rb_size=0x200;
static unsigned char b1[2]={0xf5,0xf5};
static unsigned char b2[3]={0xf6,0xf6,0xf6};
@ -468,8 +469,10 @@ void Oximetry::on_ImportButton_clicked()
//qDebug() << length << startpos;
bytes+=res-startpos;
memcpy((char *)buffer,(char *)&rb[startpos],bytes);
qprogress->setValue((75.0/length)*bytes);
QApplication::processEvents();
} else {
qprogress->setValue((100.0/length)*bytes);
qprogress->setValue((75.0/length)*bytes);
QApplication::processEvents();
memcpy((char *)&buffer[bytes],(char *)rb,res);
@ -499,6 +502,11 @@ void Oximetry::on_ImportButton_clicked()
qint64 tt=sid-(bytes/3);
tt*=1000;
session->set_first(tt);
ev_pulse->setMin(999999);
ev_pulse->setMax(-999999);
ev_spo2->setMin(999999);
ev_spo2->setMax(-999999);
ev_pulse->setFirst(tt);
ev_spo2->setFirst(tt);
EventDataType data;
@ -524,9 +532,12 @@ void Oximetry::on_ImportButton_clicked()
lastpulse=pulse;
lastspo2=spo2;
tt+=1000;
qprogress->setValue(75+(25.0/bytes)*i);
QApplication::processEvents();
}
ev_pulse->AddEvent(tt,pulse);
ev_spo2->AddEvent(tt,spo2);
session->set_last(tt);
session->summary[OXI_PulseMin]=ev_pulse->min();
session->summary[OXI_PulseMax]=ev_pulse->max();
@ -564,5 +575,7 @@ void Oximetry::on_ImportButton_clicked()
qprogress->hide();
ui->SerialPortsCombo->setEnabled(true);
qstatus->setText("Ready");
ui->ImportButton->setDisabled(false);
}