mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
Finally, this should fix CMS50 import freezing the oximeter
This commit is contained in:
parent
6d40ffcaf9
commit
310c40f8a4
37
oximetry.cpp
37
oximetry.cpp
@ -77,6 +77,7 @@ bool SerialOximeter::Open(QextSerialPort::QueryMode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_portmode=mode;
|
m_portmode=mode;
|
||||||
|
m_callbacks=0;
|
||||||
|
|
||||||
m_port=new QextSerialPort(m_portname,m_portmode);
|
m_port=new QextSerialPort(m_portname,m_portmode);
|
||||||
m_port->setBaudRate(m_baud);
|
m_port->setBaudRate(m_baud);
|
||||||
@ -469,6 +470,8 @@ void CMS50Serial::ReadyRead()
|
|||||||
m_port->read(bytes.data(), bytes.size());
|
m_port->read(bytes.data(), bytes.size());
|
||||||
m_callbacks++;
|
m_callbacks++;
|
||||||
|
|
||||||
|
if (m_mode==SO_WAIT) return;
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
// Was going out of sync previously.. To fix this unfortunately requires 4.7
|
// Was going out of sync previously.. To fix this unfortunately requires 4.7
|
||||||
@ -646,22 +649,35 @@ void CMS50Serial::requestData()
|
|||||||
|
|
||||||
bool CMS50Serial::startImport()
|
bool CMS50Serial::startImport()
|
||||||
{
|
{
|
||||||
|
m_mode=SO_WAIT;
|
||||||
|
|
||||||
|
if (!Open(QextSerialPort::EventDriven)) return false;
|
||||||
|
|
||||||
|
QTimer::singleShot(200,this,SLOT(startImportTimeout()));
|
||||||
|
//make sure there is a data stream first..
|
||||||
|
createSession();
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMS50Serial::startImportTimeout()
|
||||||
|
{
|
||||||
|
if (m_callbacks>0) {
|
||||||
|
connect(this,SIGNAL(importProcess()),this,SLOT(import_process()));
|
||||||
m_mode=SO_IMPORT;
|
m_mode=SO_IMPORT;
|
||||||
import_mode=true;
|
import_mode=true;
|
||||||
waitf6=true;
|
waitf6=true;
|
||||||
done_import=false;
|
done_import=false;
|
||||||
cntf6=0;
|
cntf6=0;
|
||||||
failcnt=0;
|
failcnt=0;
|
||||||
//QMessageBox::information(0,"Get Ready","Please make sure your oximeter is switched on and in the correct mode for data transfer.",QMessageBox::Ok);
|
|
||||||
if (!Open(QextSerialPort::EventDriven)) return false;
|
|
||||||
|
|
||||||
createSession();
|
|
||||||
|
|
||||||
connect(this,SIGNAL(importProcess()),this,SLOT(import_process()));
|
|
||||||
|
|
||||||
requestData();
|
requestData();
|
||||||
|
} else {
|
||||||
return true;
|
resetDevice();
|
||||||
|
delete session;
|
||||||
|
qDebug() << "No oximeter signal!!!!!!!!!!!!!!!!";
|
||||||
|
emit(importAborted());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1058,10 +1074,11 @@ void Oximetry::import_finished()
|
|||||||
|
|
||||||
void Oximetry::import_aborted()
|
void Oximetry::import_aborted()
|
||||||
{
|
{
|
||||||
|
oximeter->disconnect(oximeter,SIGNAL(importProcess()),0,0);
|
||||||
|
day->getSessions().clear();
|
||||||
//QMessageBox::warning(mainwin,"Oximeter Error","Please make sure your oximeter is switched on, and able to transmit data.\n(You may need to enter the oximeters Settings screen for it to be able to transmit.)",QMessageBox::Ok);
|
//QMessageBox::warning(mainwin,"Oximeter Error","Please make sure your oximeter is switched on, and able to transmit data.\n(You may need to enter the oximeters Settings screen for it to be able to transmit.)",QMessageBox::Ok);
|
||||||
mainwin->Notify("Oximeter Error!\n\nPlease make sure your oximeter is switched on, and in the right mode to transmit data.");
|
mainwin->Notify("Oximeter Error!\n\nPlease make sure your oximeter is switched on, and in the right mode to transmit data.");
|
||||||
//qDebug() << "Oximetry import failed";
|
//qDebug() << "Oximetry import failed";
|
||||||
oximeter->disconnect(oximeter,SIGNAL(importProcess()),0,0);
|
|
||||||
import_finished();
|
import_finished();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
#include "Graphs/gFooBar.h"
|
#include "Graphs/gFooBar.h"
|
||||||
|
|
||||||
enum SerialOxMode { SO_OFF, SO_IMPORT, SO_LIVE };
|
enum SerialOxMode { SO_OFF, SO_IMPORT, SO_LIVE, SO_WAIT };
|
||||||
class SerialOximeter:public QObject
|
class SerialOximeter:public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -90,6 +90,7 @@ protected slots:
|
|||||||
virtual void ReadyRead()=0;
|
virtual void ReadyRead()=0;
|
||||||
virtual void import_process()=0;
|
virtual void import_process()=0;
|
||||||
virtual void Timeout();
|
virtual void Timeout();
|
||||||
|
virtual void startImportTimeout()=0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//virtual void addEvents(EventDataType pr, EventDataType o2, EventDataType pleth=-1000000);
|
//virtual void addEvents(EventDataType pr, EventDataType o2, EventDataType pleth=-1000000);
|
||||||
@ -135,6 +136,7 @@ public:
|
|||||||
virtual void requestData();
|
virtual void requestData();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void startImportTimeout();
|
||||||
virtual void import_process();
|
virtual void import_process();
|
||||||
|
|
||||||
virtual void ReadyRead();
|
virtual void ReadyRead();
|
||||||
|
Loading…
Reference in New Issue
Block a user