aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveplotdatamodel.cpp
diff options
context:
space:
mode:
authorGravatar willem ferguson <willemferguson@zoology.up.ac.za>2015-01-20 20:13:53 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-21 17:00:18 +1200
commita700be32076225e68bfaa4b6c418cff015e2ceec (patch)
tree57c7d8b94e66279d301470b53101d2b5c05deec5 /qt-ui/profile/diveplotdatamodel.cpp
parent2923329e8e47f64667c34b33eb1de64657cb6774 (diff)
downloadsubsurface-a700be32076225e68bfaa4b6c418cff015e2ceec.tar.gz
CCR option: display o2 sensor data
This patch creates the possibility of viewing the individual sensor values when the po2 button on the profile toolbar is activated. This follows exactly the procedure for optionally displaying the setpoint values while viewing po2. A checkbox in the preferences panel determines whether sensor information is shown. By default it is set to OFF. When checked, and the po2 button is activated, sensor1 values are shown in grey, sensor2 in blue and sensor3 in brown. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveplotdatamodel.cpp')
-rw-r--r--qt-ui/profile/diveplotdatamodel.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/qt-ui/profile/diveplotdatamodel.cpp b/qt-ui/profile/diveplotdatamodel.cpp
index 9c0edc079..cdf17fe46 100644
--- a/qt-ui/profile/diveplotdatamodel.cpp
+++ b/qt-ui/profile/diveplotdatamodel.cpp
@@ -52,6 +52,12 @@ QVariant DivePlotDataModel::data(const QModelIndex &index, int role) const
return item.pressures.o2;
case O2SETPOINT:
return item.o2setpoint.mbar / 1000.0;
+ case CCRSENSOR1:
+ return item.o2sensor[0].mbar / 1000.0;
+ case CCRSENSOR2:
+ return item.o2sensor[1].mbar / 1000.0;
+ case CCRSENSOR3:
+ return item.o2sensor[2].mbar / 1000.0;
case HEARTBEAT:
return item.heartbeat;
case AMBPRESSURE:
@@ -129,6 +135,12 @@ QVariant DivePlotDataModel::headerData(int section, Qt::Orientation orientation,
return tr("pO₂");
case O2SETPOINT:
return tr("Setpoint");
+ case CCRSENSOR1:
+ return tr("Sensor1");
+ case CCRSENSOR2:
+ return tr("Sensor2");
+ case CCRSENSOR3:
+ return tr("Sensor3");
case AMBPRESSURE:
return tr("Ambient pressure");
case HEARTBEAT:
@@ -185,9 +197,23 @@ unsigned int DivePlotDataModel::dcShown() const
return ret; \
}
+#define MAX_SENSOR_GAS_FUNC(GASFUNC) \
+ double DivePlotDataModel::GASFUNC() /* CCR: This function finds the largest measured po2 value */ \
+ { /* by scanning the readings from the three individual o2 sensors. */ \
+ double ret = -1; /* This is used for scaling the Y-axis for partial pressures */ \
+ for (int s = 0; s < 3; s++) { /* when displaying the graphs for individual o2 sensors */ \
+ for (int i = 0, count = rowCount(); i < count; i++) { /* POTENTIAL PROBLEM: the '3' (no_sensors) is hard-coded here */\
+ if (pInfo.entry[i].o2sensor[s].mbar > ret) \
+ ret = pInfo.entry[i].o2sensor[s].mbar; \
+ } \
+ } \
+ return (ret / 1000.0); /* mbar -> bar conversion */ \
+ }
+
MAX_PPGAS_FUNC(he, pheMax);
MAX_PPGAS_FUNC(n2, pn2Max);
MAX_PPGAS_FUNC(o2, po2Max);
+MAX_SENSOR_GAS_FUNC(CCRMax);
void DivePlotDataModel::emitDataChanged()
{