Display CCR setpoint values on the po2 graph

When a CCR dive is viewed and the toolbar button for PO2 is activated,
both the PO2 (green line) and the O2 setpoint (red line) are shown.
This allows evaluation of the PO2 in the CCR loop with respect to the
pre-configured O2 setpoint.

The setpoint graph can be disabled from the Preferences/Graphs tab
by checking the appropriate checkbox.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Willem Ferguson 2015-01-05 09:20:26 +02:00 committed by Dirk Hohndel
parent 27bfbee4e8
commit 0de3bc8452
12 changed files with 33 additions and 2 deletions

View file

@ -93,6 +93,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
pn2GasItem(new PartialPressureGasItem()),
pheGasItem(new PartialPressureGasItem()),
po2GasItem(new PartialPressureGasItem()),
o2SetpointGasItem(new PartialPressureGasItem()),
heartBeatAxis(new DiveCartesianAxis()),
heartBeatItem(new DiveHeartrateItem()),
percentageAxis(new DiveCartesianAxis()),
@ -162,6 +163,7 @@ ProfileWidget2::~ProfileWidget2()
delete pn2GasItem;
delete pheGasItem;
delete po2GasItem;
delete o2SetpointGasItem;
delete heartBeatAxis;
delete heartBeatItem;
delete percentageAxis;
@ -201,6 +203,7 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(pn2GasItem);
scene()->addItem(pheGasItem);
scene()->addItem(po2GasItem);
scene()->addItem(o2SetpointGasItem);
scene()->addItem(percentageAxis);
scene()->addItem(heartBeatAxis);
scene()->addItem(heartBeatItem);
@ -313,6 +316,7 @@ void ProfileWidget2::setupItemOnScene()
CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, &prefs.pp_graphs.pn2_threshold, "pn2graph");
CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, &prefs.pp_graphs.phe_threshold, "phegraph");
CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "po2graph");
CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "po2graph");
#undef CREATE_PP_GAS
temperatureAxis->setTextVisible(false);
@ -527,6 +531,11 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
currentdc = fake_dc(currentdc);
}
if ((current_dc->dctype == CCR) && (prefs.show_ccr_setpoint))
o2SetpointGasItem->setVisible(true);
else
o2SetpointGasItem->setVisible(false);
/* This struct holds all the data that's about to be plotted.
* I'm not sure this is the best approach ( but since we are
* interpolating some points of the Dive, maybe it is... )
@ -883,6 +892,7 @@ void ProfileWidget2::setEmptyState()
tankItem->setVisible(false);
pn2GasItem->setVisible(false);
po2GasItem->setVisible(false);
o2SetpointGasItem->setVisible(false);
pheGasItem->setVisible(false);
ambPressureItem->setVisible(false);
gflineItem->setVisible(false);
@ -981,6 +991,7 @@ void ProfileWidget2::setProfileState()
}
pn2GasItem->setVisible(prefs.pp_graphs.pn2);
po2GasItem->setVisible(prefs.pp_graphs.po2);
o2SetpointGasItem->setVisible(true);
pheGasItem->setVisible(prefs.pp_graphs.phe);
timeAxis->setPos(itemPos.time.pos.on);