mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 13:16:16 +00:00
Calculate minimum and maximum heartrate
And setup the axis accordingly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9712999e66
commit
41abab7253
3 changed files with 19 additions and 4 deletions
|
@ -19,6 +19,7 @@ struct plot_info {
|
||||||
int maxtime;
|
int maxtime;
|
||||||
int meandepth, maxdepth;
|
int meandepth, maxdepth;
|
||||||
int minpressure, maxpressure;
|
int minpressure, maxpressure;
|
||||||
|
int minhr, maxhr;
|
||||||
int mintemp, maxtemp;
|
int mintemp, maxtemp;
|
||||||
double endtempcoord;
|
double endtempcoord;
|
||||||
double maxpp;
|
double maxpp;
|
||||||
|
|
10
profile.c
10
profile.c
|
@ -736,6 +736,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
int maxdepth = dive->maxdepth.mm;
|
int maxdepth = dive->maxdepth.mm;
|
||||||
int maxtime = 0;
|
int maxtime = 0;
|
||||||
int maxpressure = 0, minpressure = INT_MAX;
|
int maxpressure = 0, minpressure = INT_MAX;
|
||||||
|
int maxhr = 0, minhr = INT_MAX;
|
||||||
int mintemp = dive->mintemp.mkelvin;
|
int mintemp = dive->mintemp.mkelvin;
|
||||||
int maxtemp = dive->maxtemp.mkelvin;
|
int maxtemp = dive->maxtemp.mkelvin;
|
||||||
int cyl;
|
int cyl;
|
||||||
|
@ -757,6 +758,7 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
int depth = s->depth.mm;
|
int depth = s->depth.mm;
|
||||||
int pressure = s->cylinderpressure.mbar;
|
int pressure = s->cylinderpressure.mbar;
|
||||||
int temperature = s->temperature.mkelvin;
|
int temperature = s->temperature.mkelvin;
|
||||||
|
int heartbeat = s->heartbeat;
|
||||||
|
|
||||||
if (!mintemp && temperature < mintemp)
|
if (!mintemp && temperature < mintemp)
|
||||||
mintemp = temperature;
|
mintemp = temperature;
|
||||||
|
@ -767,6 +769,10 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
minpressure = pressure;
|
minpressure = pressure;
|
||||||
if (pressure > maxpressure)
|
if (pressure > maxpressure)
|
||||||
maxpressure = pressure;
|
maxpressure = pressure;
|
||||||
|
if (heartbeat > maxhr)
|
||||||
|
maxhr = heartbeat;
|
||||||
|
if (heartbeat < minhr)
|
||||||
|
minhr = heartbeat;
|
||||||
|
|
||||||
if (depth > maxdepth)
|
if (depth > maxdepth)
|
||||||
maxdepth = s->depth.mm;
|
maxdepth = s->depth.mm;
|
||||||
|
@ -780,12 +786,16 @@ struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer
|
||||||
|
|
||||||
if (minpressure > maxpressure)
|
if (minpressure > maxpressure)
|
||||||
minpressure = 0;
|
minpressure = 0;
|
||||||
|
if (minhr > maxhr)
|
||||||
|
minhr = 0;
|
||||||
|
|
||||||
memset(&pi, 0, sizeof(pi));
|
memset(&pi, 0, sizeof(pi));
|
||||||
pi.maxdepth = maxdepth;
|
pi.maxdepth = maxdepth;
|
||||||
pi.maxtime = maxtime;
|
pi.maxtime = maxtime;
|
||||||
pi.maxpressure = maxpressure;
|
pi.maxpressure = maxpressure;
|
||||||
pi.minpressure = minpressure;
|
pi.minpressure = minpressure;
|
||||||
|
pi.minhr = minhr;
|
||||||
|
pi.maxhr = maxhr;
|
||||||
pi.mintemp = mintemp;
|
pi.mintemp = mintemp;
|
||||||
pi.maxtemp = maxtemp;
|
pi.maxtemp = maxtemp;
|
||||||
return pi;
|
return pi;
|
||||||
|
|
|
@ -345,10 +345,14 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
|
||||||
temperatureAxis->setMinimum(pInfo.mintemp);
|
temperatureAxis->setMinimum(pInfo.mintemp);
|
||||||
temperatureAxis->setMaximum(pInfo.maxtemp);
|
temperatureAxis->setMaximum(pInfo.maxtemp);
|
||||||
|
|
||||||
heartBeatAxis->setMinimum(20); // FIXME: find minimum
|
if (pInfo.maxhr) {
|
||||||
heartBeatAxis->setMaximum(200); // FIXME: find maximum
|
heartBeatAxis->setMinimum(pInfo.minhr);
|
||||||
|
heartBeatAxis->setMaximum(pInfo.maxhr);
|
||||||
heartBeatAxis->updateTicks(); // this shows the ticks
|
heartBeatAxis->updateTicks(); // this shows the ticks
|
||||||
|
heartBeatAxis->setVisible(true);
|
||||||
|
} else {
|
||||||
|
heartBeatAxis->setVisible(false);
|
||||||
|
}
|
||||||
timeAxis->setMaximum(maxtime);
|
timeAxis->setMaximum(maxtime);
|
||||||
|
|
||||||
int i, incr;
|
int i, incr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue