diff --git a/sleepyhead/Graphs/gGraphView.cpp b/sleepyhead/Graphs/gGraphView.cpp index ed5731e9..3ced9311 100644 --- a/sleepyhead/Graphs/gGraphView.cpp +++ b/sleepyhead/Graphs/gGraphView.cpp @@ -359,8 +359,13 @@ gGraphView::gGraphView(QWidget *parent, gGraphView *shared) plots_menu = context_menu->addMenu(tr("Plots")); connect(plots_menu, SIGNAL(triggered(QAction*)), this, SLOT(onPlotsClicked(QAction*))); - overlay_menu = context_menu->addMenu(tr("Overlays")); - connect(overlay_menu, SIGNAL(triggered(QAction*)), this, SLOT(onOverlaysClicked(QAction*))); + overlay_menu = context_menu->addMenu("Overlays"); + + cpap_menu = overlay_menu->addMenu(tr("CPAP")); + connect(cpap_menu, SIGNAL(triggered(QAction*)), this, SLOT(onOverlaysClicked(QAction*))); + + oximeter_menu = overlay_menu->addMenu(tr("Oximeter")); + connect(oximeter_menu, SIGNAL(triggered(QAction*)), this, SLOT(onOverlaysClicked(QAction*))); lines_menu = context_menu->addMenu(tr("Dotted Lines")); connect(lines_menu, SIGNAL(triggered(QAction*)), this, SLOT(onLinesClicked(QAction*))); @@ -1663,33 +1668,53 @@ void gGraphView::populateMenu(gGraph * graph) plots_menu->menuAction()->setVisible(true); } - - overlay_menu->clear(); + oximeter_menu->clear(); using namespace schema; ChanType flags = ChanType (SPAN | MINOR_FLAG | FLAG); - QList chans = lc->m_day->getSortedMachineChannels(flags); + QList chans = lc->m_day->getSortedMachineChannels(MT_OXIMETER, flags); for (int i=0; i < chans.size() ; ++i) { ChannelID code = chans.at(i); - QAction * action = overlay_menu->addAction(schema::channel[code].fullname()); + QAction * action = oximeter_menu->addAction(schema::channel[code].fullname()); action->setToolTip(schema::channel[code].description()); action->setData(QString("%1|%2").arg(graph->name()).arg(code)); action->setCheckable(true); action->setChecked(schema::channel[code].enabled()); } - if (overlay_menu->actions().size() > 0) { + if (oximeter_menu->actions().size() > 0) { + oximeter_menu->menuAction()->setVisible(true); overlay_menu->menuAction()->setVisible(true); } + cpap_menu->clear(); + + chans = lc->m_day->getSortedMachineChannels(MT_CPAP, flags); + + for (int i=0; i < chans.size() ; ++i) { + ChannelID code = chans.at(i); + QAction * action = cpap_menu->addAction(schema::channel[code].fullname()); + action->setToolTip(schema::channel[code].description()); + action->setData(QString("%1|%2").arg(graph->name()).arg(code)); + action->setCheckable(true); + action->setChecked(schema::channel[code].enabled()); + } + + if (cpap_menu->actions().size() > 0) { + cpap_menu->menuAction()->setVisible(true); + overlay_menu->menuAction()->setVisible(true); + } } else { lines_menu->clear(); lines_menu->menuAction()->setVisible(false); plots_menu->clear(); plots_menu->menuAction()->setVisible(false); - overlay_menu->clear(); + oximeter_menu->clear(); + oximeter_menu->menuAction()->setVisible(false); + cpap_menu->clear(); + cpap_menu->menuAction()->setVisible(false); overlay_menu->menuAction()->setVisible(false); } } diff --git a/sleepyhead/Graphs/gGraphView.h b/sleepyhead/Graphs/gGraphView.h index e100d6c5..69ae7db2 100644 --- a/sleepyhead/Graphs/gGraphView.h +++ b/sleepyhead/Graphs/gGraphView.h @@ -434,7 +434,10 @@ class gGraphView void populateMenu(gGraph *); QMenu * lines_menu; QMenu * plots_menu; + QMenu * overlay_menu; + QMenu * oximeter_menu; + QMenu * cpap_menu; inline void setCurrentTime(double time) { diff --git a/sleepyhead/SleepLib/day.cpp b/sleepyhead/SleepLib/day.cpp index fbabc993..0a0686e4 100644 --- a/sleepyhead/SleepLib/day.cpp +++ b/sleepyhead/SleepLib/day.cpp @@ -1068,6 +1068,33 @@ void Day::CloseEvents() } } +QList Day::getSortedMachineChannels(MachineType type, quint32 chantype) +{ + QList available; + QHash::iterator mi_end = machines.end(); + for (QHash::iterator mi = machines.begin(); mi != mi_end; mi++) { + if (mi.key() != type) continue; + available.append(mi.value()->availableChannels(chantype)); + } + + QMultiMap order; + + for (int i=0; i < available.size(); ++i) { + ChannelID code = available.at(i); + order.insert(schema::channel[code].order(), code); + } + + QMultiMap::iterator it; + + QList channels; + for (it = order.begin(); it != order.end(); ++it) { + ChannelID code = it.value(); + channels.append(code); + } + return channels; +} + + QList Day::getSortedMachineChannels(quint32 chantype) { QList available; diff --git a/sleepyhead/SleepLib/day.h b/sleepyhead/SleepLib/day.h index a444403a..d723d98d 100644 --- a/sleepyhead/SleepLib/day.h +++ b/sleepyhead/SleepLib/day.h @@ -197,6 +197,9 @@ class Day //! \brief Returns a list of channels of supplied types, according to channel orders QList getSortedMachineChannels(quint32 chantype); + //! \brief Returns a list of machine specific channels of supplied types, according to channel orders + QList getSortedMachineChannels(MachineType type, quint32 chantype); + // Some ugly CPAP specific stuff QString getCPAPMode(); QString getPressureRelief(); diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index 0ea35521..b7761774 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -2306,6 +2306,109 @@ void PRS1Loader::Register() initialized = true; } - - +/* Thanks SleepyCPAP :) +CODE ERROR DESCRIPTION ERROR TYPE ERROR CATEGORY +1 SOFTWARE STOP STOP General Errors +2 Not Used General Errors +3 INT RAM REBOOT General Errors +4 NULL PTR REBOOT General Errors +5 DATA REBOOT General Errors +6 STATE MACHINE REBOOT General Errors +7 SOFTWARE REBOOT General Errors +8-9 Not Used General Errors +10 WDOG TEST RAM REBOOT Watchdog & Timer Errors +11 WDOG TEST REBOOT Watchdog & Timer Errors +12 BACKGROUND WDOG NO CARD REBOOT Watchdog & Timer Errors +13 BACKGROUND WDOG SD CARD REBOOT Watchdog & Timer Errors +14 WDOG LOWRES TIMER REBOOT Watchdog & Timer Errors +15 CYCLE HANDLER OVERRUN REBOOT Watchdog & Timer Errors +16 RASP RESTORE TIMEOUT CONTINUE Watchdog & Timer Errors +17 ONEMS HANDLER OVERRUN REBOOT Watchdog & Timer Errors +18 Not Used Watchdog & Timer Errors +19 WDOG TIMEOUT REBOOT Watchdog & Timer Errors +20 MOTOR SPINUP FLUX LOW REBOOT Motor/Blower Errors +21 MOTOR VBUS HIGH STOP Motor/Blower Errors +22 MOTOR FLUX MAGNITUDE REBOOT Motor/Blower Errors +23 MOTOR OVERSPEED REBOOT Motor/Blower Errors +24 MOTOR SPEED REVERSE REBOOT Motor/Blower Errors +25 MOTOR THERMISTOR OPEN CONTINUE Motor/Blower Errors +26 MOTOR THERMISTOR SHORTED CONTINUE Motor/Blower Errors +27 MOTOR RL NOCONVERGE STOP Motor/Blower Errors +28 NEGATIVE QUADRATURE VOLTAGE VECTOR REBOOT Motor/Blower Errors +29 VBUS GAIN ZERO: REBOOT Motor/Blower Errors +30 MOTOR SPINUP FLUX HIGH REBOOT Motor/Blower Errors +31 (incorrect power supply - 60series) Motor/Blower Errors +32-39 Not Used Motor/Blower Errors +40 NVRAM REBOOT NVRAM Low Level Errors +41 STORAGE UNIT RAM REBOOT NVRAM Low Level Errors +42 UNABLE TO OBTAIN BUS REBOOT NVRAM Low Level Errors +43 NVRAM NO CALLBACK OCCURRED REBOOT NVRAM Low Level Errors +44 NV BUFFER NULL REBOOT NVRAM Low Level Errors +45 NV CALLBACK NULL REBOOT NVRAM Low Level Errors +46 NV ZERO LENGTH REBOOT NVRAM Low Level Errors +47 NVRAM INVALID BYTES XFRRED REBOOT NVRAM Low Level Errors +48-49 Not Used NVRAM Low Level Errors +50 DAILY VALUES CORRUPT LOG ONLY NVRAM Unit Related Errors +51 CORRUPT COMPLIANCE LOG CONTINUE NVRAM Unit Related Errors +52 CORRUPT COMPLIANCE CB CONTINUE NVRAM Unit Related Errors +53 COMP LOG SEM TIMEOUT CONTINUE NVRAM Unit Related Errors +54 COMPLOG REQS OVERFLOW REBOOT NVRAM Unit Related Errors +55 THERAPY QUEUE FULL CONTINUE NVRAM Unit Related Errors +56 COMPLOG PACKET STATUS REBOOT NVRAM Unit Related Errors +57 SESS OBS QUEUE OVF REBOOT NVRAM Unit Related Errors +58 SESS OBS NO CALLBACK REBOOT NVRAM Unit Related Errors +59 Not Used NVRAM Unit Related Errors +60 UNSUPPORTED HARDWARE REBOOT General Hardware Errors +61 PLL UNLOCKED REBOOT General Hardware Errors +62 STUCK RAMP KEY CONTINUE General Hardware Errors +63 STUCK KNOB KEY CONTINUE General Hardware Errors +64 DSP OVERTIME PWM REBOOT General Hardware Errors +65 STUCK ENCODER A CONTINUE General Hardware Errors +66 STUCK ENCODER B CONTINUE General Hardware Errors +67-69 Not Used General Hardware Errors +70 PRESSURE SENSOR ABSENT STOP Pressure Sensor Errors +71 Not Used Pressure Sensor Errors +72 PSENS UNABLE TO OBTAIN BUS REBOOT Pressure Sensor Errors +73 SENSOR PRESS OFFSET STOP STOP Pressure Sensor Errors +74-79 Not Used Pressure Sensor Errors +80 UNABLE TO INIT FLOW SENSOR REBOOT Flow Sensor Errors +81 FLOW SENSOR TABLE CONTINUE Flow Sensor Errors +82 FLOW SENSOR OFFSET CONTINUE Flow Sensor Errors +83 FSENS UNABLE TO OBTAIN BUS REBOOT / 2nd failure=STOP Flow Sensor Errors +84 FLOW SENSOR STOP STOP Flow Sensor Errors +85 FLOW SENSOR OCCLUDED CONTINUE Flow Sensor Errors +86 FLOW SENSOR ABSENT CONTINUE Flow Sensor Errors +87 FLOW SENSOR BUS CONTINUE Flow Sensor Errors +88-89 Not Used Flow Sensor Errors +90 OTP NOT CONFIGURED STOP OTP & RTC Errors +91 OTP INCORRECTLY CONFIGURED STOP OTP & RTC Errors +92 Not Used OTP & RTC Errors +93 RTC VALUE CONTINUE OTP & RTC Errors +94 RTC STOPPED CONTINUE OTP & RTC Errors +95-99 Not Used OTP & RTC Errors +100 HUMID NO HEAT CONTINUE Humidifier Errors +101 HUMID TEMP MAX STOP Humidifier Errors +102 THERMISTOR HIGH CONTINUE Humidifier Errors +103 THERMISTOR LOW CONTINUE Humidifier Errors +104 HUMID AMBIENT OFF CONTINUE Humidifier Errors +105 HUMID AMBIENT COMM CONTINUE Humidifier Errors +106-109 Not Used Humidifier Errors +110 STACK REBOOT Stack & Exception Handler Errors +111 EXCEPTION STACK OVERFLOW REBOOT Stack & Exception Handler Errors +112 EXCEPTION STACK RESERVE LOG ONLY Stack & Exception Handler Errors +113 EXCEPTION STACK UNDERFLOW REBOOT Stack & Exception Handler Errors +114 FIQ STACK OVERFLOW REBOOT Stack & Exception Handler Errors +115 FIQ STACK RESERVE LOG ONLY Stack & Exception Handler Errors +116 FIQ STACK UNDERFLOW REBOOT Stack & Exception Handler Errors +117 IRQ STACK OVERFLOW REBOOT Stack & Exception Handler Errors +118 IRQ STACK RESERVE LOG ONLY Stack & Exception Handler Errors +119 IRQ STACK UNDERFLOW REBOOT Stack & Exception Handler Errors +120 SVC STACK OVERFLOW REBOOT Stack & Exception Handler Errors +121 SVC STACK RESERVE LOG ONLY Stack & Exception Handler Errors +122 SVC STACK UNDERFLOW REBOOT Stack & Exception Handler Errors +123 DATA ABORT EXCEPTION REBOOT Stack & Exception Handler Errors +124 PREFETCH EXCEPTION REBOOT Stack & Exception Handler Errors +125 ILLEGAL INSTRUCTION EXCEPTION REBOOT Stack & Exception Handler Errors +126 SWI ABORT EXCEPTION REBOOT Stack & Exception Handler Errors +*/ diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index e7ebd20d..4f38558b 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -657,35 +657,22 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day) bool userflags=p_profile->cpap->userEventFlagging(); qint64 drift=0, clockdrift=p_profile->cpap->clockDrift()*1000L; + + quint32 chantype = schema::FLAG | schema::SPAN | schema::MINOR_FLAG; + if (p_profile->general->showUnknownFlags()) chantype |= schema::UNKNOWN; + QList chans = day->getSortedMachineChannels(chantype); + for (QList::iterator s=day->begin();s!=day->end();++s) { - if (!(*s)->enabled()) continue; + Session * sess = *s; + if (!sess->enabled()) continue; QHash >::iterator m; + for (int c=0; c < chans.size(); ++c) { + ChannelID code = chans.at(c); + m = sess->eventlist.find(code); + if (m == sess->eventlist.end()) continue; - for (m=(*s)->eventlist.begin();m!=(*s)->eventlist.end();m++) { - ChannelID code=m.key(); - if ((code!=CPAP_Obstructive) - && (code!=CPAP_Hypopnea) - && (code!=CPAP_Apnea) - && (code!=PRS1_0B) - && (code!=CPAP_ClearAirway) - && (code!=CPAP_CSR) - && (code!=CPAP_RERA) - && (code!=CPAP_UserFlag1) - && (code!=CPAP_UserFlag2) - && (code!=CPAP_UserFlag3) - && (code!=CPAP_NRI) - && (code!=CPAP_LeakFlag) - && (code!=CPAP_LargeLeak) - && (code!=CPAP_ExP) - && (code!=CPAP_FlowLimit) - && (code!=CPAP_SensAwake) - && (code!=CPAP_PressurePulse) - && (code!=CPAP_VSnore2) - && (code!=CPAP_VSnore)) continue; - - if (!userflags && ((code==CPAP_UserFlag1) || (code==CPAP_UserFlag2) || (code==CPAP_UserFlag3))) continue; - drift=((*s)->machine()->type() == MT_CPAP) ? clockdrift : 0; + drift=(sess->machine()->type() == MT_CPAP) ? clockdrift : 0; QTreeWidgetItem *mcr; if (mcroot.find(code)==mcroot.end()) { diff --git a/sleepyhead/daily.ui b/sleepyhead/daily.ui index ff39e822..ae313a73 100644 --- a/sleepyhead/daily.ui +++ b/sleepyhead/daily.ui @@ -842,7 +842,7 @@ QToolButton:pressed { true - 2 + 0 true @@ -875,9 +875,12 @@ QToolButton:pressed { true - + true + + false + false