diff --git a/Graphs/gFlagsLine.cpp b/Graphs/gFlagsLine.cpp index f8a20fe6..153badf8 100644 --- a/Graphs/gFlagsLine.cpp +++ b/Graphs/gFlagsLine.cpp @@ -35,8 +35,10 @@ void gFlagsGroup::Plot(gGraphWindow &w, float scrx, float scry) vector visible; for (unsigned i=0;iisEmpty()) { - gFlagsLine *f=dynamic_cast(layers[i]); + gFlagsLine *f=dynamic_cast(layers[i]); + if (!f) continue; + + if (!f->isEmpty() || f->isAlwaysVisible()) { visible.push_back(f); } } @@ -49,8 +51,8 @@ void gFlagsGroup::Plot(gGraphWindow &w, float scrx, float scry) } -gFlagsLine::gFlagsLine(gPointData *d,QColor col,QString _label,int _line_num,int _total_lines) -:gLayer(d),label(_label),line_num(_line_num),total_lines(_total_lines) +gFlagsLine::gFlagsLine(gPointData *d,QColor col,QString _label,bool always_visible, int _line_num,int _total_lines) +:gLayer(d),label(_label),m_always_visible(always_visible),line_num(_line_num),total_lines(_total_lines) { color.clear(); color.push_back(col); diff --git a/Graphs/gFlagsLine.h b/Graphs/gFlagsLine.h index aa488671..456416e7 100644 --- a/Graphs/gFlagsLine.h +++ b/Graphs/gFlagsLine.h @@ -15,13 +15,17 @@ class gFlagsLine:public gLayer { friend class gFlagsGroup; public: - gFlagsLine(gPointData *d=NULL,QColor col=QColor("black"),QString _label="",int _line_num=0,int _total_lines=0); + gFlagsLine(gPointData *d=NULL,QColor col=Qt::black,QString _label="",bool always_visible=false, int _line_num=0,int _total_lines=0); virtual ~gFlagsLine(); virtual void Plot(gGraphWindow & w,float scrx,float scry); - + bool isAlwaysVisible() { return m_always_visible; } + void setAlwaysVisible(bool b) { m_always_visible=b; } + QString Label() { return label; } + void Label(QString s) { label=s; } protected: QString label; + bool m_always_visible; int line_num,total_lines; }; diff --git a/SleepLib/loader_plugins/prs1_loader.cpp b/SleepLib/loader_plugins/prs1_loader.cpp index 8cf265ea..93a04c1b 100644 --- a/SleepLib/loader_plugins/prs1_loader.cpp +++ b/SleepLib/loader_plugins/prs1_loader.cpp @@ -547,14 +547,16 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,qint64 qDebug() << "Illegal PRS1 code " << hex << int(code) << " appeared at " << hex << pos+16; return false; } - //assert(codeAddEvent(new Event(t,cpapcode, data,1)); + //qDebug() << hex << data[0]; break; case 0x05: // RERA case 0x06: // Obstructive Apoanea @@ -615,11 +618,12 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,qint64 } break; case 0x0e: // Unknown - data[0]=buffer[pos++]; + data[0]=((char *)buffer)[pos++]; data[1]=buffer[pos++]; //(buffer[pos+1] << 8) | buffer[pos]; //data[0]/=10.0; //pos+=2; data[2]=buffer[pos++]; + //qDebug() << hex << data[0] << data[1] << data[2]; session->AddEvent(new Event(t,cpapcode, data, 3)); //tt-=data[1]*1000; //session->AddEvent(new Event(t,CPAP_CSR, data, 2)); @@ -889,6 +893,7 @@ bool PRS1Loader::OpenWaveforms(Session *session,QString filename) { int size,sequence,seconds,br,htype,version,numsignals; unsigned cnt=0; + qint32 lastts,ts1; qint64 timestamp; qint64 start=0; @@ -911,6 +916,7 @@ bool PRS1Loader::OpenWaveforms(Session *session,QString filename) long fpos=0; //int bsize=0; int lasthl=0; + qint32 expected_timestamp=0; while (true) { lasthl=hl; hl=20; @@ -925,12 +931,12 @@ bool PRS1Loader::OpenWaveforms(Session *session,QString filename) if (header[0]!=PRS1_MAGIC_NUMBER) { if (cnt==0) return false; - qDebug() << "Corrupt waveform, trying to recover"; + qWarning() << "Corrupt waveform, trying to recover"; // read the damn bytes anyway.. br=f.read((char *)header,lasthl-hl+1); // last bit of the header if (br0) { + qDebug() << "Fixing up Waveform sync" << sequence; + for (int i=0;iAddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR",0,sfc)); - fg->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",1,sfc)); - fg->AddLayer(new gFlagsLine(flags[2],QColor("#40c0ff"),"OA",2,sfc)); - fg->AddLayer(new gFlagsLine(flags[3],QColor("blue"),"H",3,sfc)); - fg->AddLayer(new gFlagsLine(flags[4],QColor("black"),"FL",4,sfc)); - fg->AddLayer(new gFlagsLine(flags[6],QColor("gold"),"RE",6,sfc)); - fg->AddLayer(new gFlagsLine(flags[5],QColor("red"),"VS",5,sfc)); + fg->AddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR",false,0,sfc)); + fg->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",true,1,sfc)); + fg->AddLayer(new gFlagsLine(flags[2],QColor("#40c0ff"),"OA",true,2,sfc)); + fg->AddLayer(new gFlagsLine(flags[3],QColor("blue"),"H",true,3,sfc)); + fg->AddLayer(new gFlagsLine(flags[4],QColor("black"),"FL",false,4,sfc)); + fg->AddLayer(new gFlagsLine(flags[6],QColor("gold"),"RE",false,6,sfc)); + fg->AddLayer(new gFlagsLine(flags[5],QColor("red"),"VS",false,5,sfc)); if (extras) { fg->AddLayer(new gFlagsLine(flags[8],QColor("dark green"),"U0E",7,sfc)); fg->AddLayer(new gFlagsLine(flags[9],QColor("red"),"VS2",8,sfc)); @@ -690,7 +690,7 @@ void Daily::Load(QDate date) for (vector::iterator s=cpap->begin();s!=cpap->end();s++) { fd=QDateTime::fromMSecsSinceEpoch((*s)->first()); ld=QDateTime::fromMSecsSinceEpoch((*s)->last()); - tmp.sprintf(("%08x"+fd.date().toString(Qt::SystemLocaleShortDate)+""+fd.toString("HH:mm ")+""+ld.toString("HH:mm")+"").toLatin1(),(*s)->session()); + tmp.sprintf(("%08i"+fd.date().toString(Qt::SystemLocaleShortDate)+""+fd.toString("HH:mm ")+""+ld.toString("HH:mm")+"").toLatin1(),(*s)->session()); html+=tmp; } html+=""; diff --git a/main.cpp b/main.cpp index 0e72f9dd..c1f85ed4 100644 --- a/main.cpp +++ b/main.cpp @@ -62,6 +62,5 @@ int main(int argc, char *argv[]) mainwin=&w; w.show(); - return a.exec(); }