diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-02-23 14:32:25 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-23 14:32:25 -0800 |
commit | 41abab72533a31affe7746568e3d6fc3d8f94981 (patch) | |
tree | d18a023b00753aaee60c6c8d30eca3591c58c41a | |
parent | 9712999e666bd0040625a6eb924432c265f748bc (diff) | |
download | subsurface-41abab72533a31affe7746568e3d6fc3d8f94981.tar.gz |
Calculate minimum and maximum heartrate
And setup the axis accordingly.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | display.h | 1 | ||||
-rw-r--r-- | profile.c | 10 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 12 |
3 files changed, 19 insertions, 4 deletions
@@ -19,6 +19,7 @@ struct plot_info { int maxtime; int meandepth, maxdepth; int minpressure, maxpressure; + int minhr, maxhr; int mintemp, maxtemp; double endtempcoord; double maxpp; @@ -736,6 +736,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer int maxdepth = dive->maxdepth.mm; int maxtime = 0; int maxpressure = 0, minpressure = INT_MAX; + int maxhr = 0, minhr = INT_MAX; int mintemp = dive->mintemp.mkelvin; int maxtemp = dive->maxtemp.mkelvin; int cyl; @@ -757,6 +758,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer int depth = s->depth.mm; int pressure = s->cylinderpressure.mbar; int temperature = s->temperature.mkelvin; + int heartbeat = s->heartbeat; if (!mintemp && temperature < mintemp) mintemp = temperature; @@ -767,6 +769,10 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer minpressure = pressure; if (pressure > maxpressure) maxpressure = pressure; + if (heartbeat > maxhr) + maxhr = heartbeat; + if (heartbeat < minhr) + minhr = heartbeat; if (depth > maxdepth) maxdepth = s->depth.mm; @@ -780,12 +786,16 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer if (minpressure > maxpressure) minpressure = 0; + if (minhr > maxhr) + minhr = 0; memset(&pi, 0, sizeof(pi)); pi.maxdepth = maxdepth; pi.maxtime = maxtime; pi.maxpressure = maxpressure; pi.minpressure = minpressure; + pi.minhr = minhr; + pi.maxhr = maxhr; pi.mintemp = mintemp; pi.maxtemp = maxtemp; return pi; diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 9152f1c76..a8f1e0e33 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -345,10 +345,14 @@ void ProfileWidget2::plotDives(QList<dive*> dives) temperatureAxis->setMinimum(pInfo.mintemp); temperatureAxis->setMaximum(pInfo.maxtemp); - heartBeatAxis->setMinimum(20); // FIXME: find minimum - heartBeatAxis->setMaximum(200); // FIXME: find maximum - heartBeatAxis->updateTicks(); // this shows the ticks - + if (pInfo.maxhr) { + heartBeatAxis->setMinimum(pInfo.minhr); + heartBeatAxis->setMaximum(pInfo.maxhr); + heartBeatAxis->updateTicks(); // this shows the ticks + heartBeatAxis->setVisible(true); + } else { + heartBeatAxis->setVisible(false); + } timeAxis->setMaximum(maxtime); int i, incr; |