From 72175060729b87eb53bdc3faccc71a7d7a15c6a4 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Mon, 22 May 2023 22:05:43 +0200 Subject: [PATCH] profile: Use all sensors to scale the pressure graph It's possible for the first sensor to start with a pressure significantly lower than other sensors. Signed-off-by: Michael Andreen --- core/profile.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/profile.c b/core/profile.c index 184ad8590..06ff15a78 100644 --- a/core/profile.c +++ b/core/profile.c @@ -305,19 +305,22 @@ static void calculate_max_limits_new(const struct dive *dive, const struct divec while (--i >= 0) { int depth = s->depth.mm; - int pressure = s->pressure[0].mbar; int temperature = s->temperature.mkelvin; int heartbeat = s->heartbeat; + for (int sensor = 0; sensor < MAX_SENSORS; ++sensor) { + int pressure = s->pressure[sensor].mbar; + if (pressure && pressure < minpressure) + minpressure = pressure; + if (pressure > maxpressure) + maxpressure = pressure; + } + if (!mintemp && temperature < mintemp) mintemp = temperature; if (temperature > maxtemp) maxtemp = temperature; - if (pressure && pressure < minpressure) - minpressure = pressure; - if (pressure > maxpressure) - maxpressure = pressure; if (heartbeat > maxhr) maxhr = heartbeat; if (heartbeat && heartbeat < minhr)