When option is enabled, if a stop is not otherwise required, a gas switch will be delayed until a stop is reached. This option is ignored if the current gas is hypoxic.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is required so they work in the test for /* do we want to skip this leg as it is devoid of anything useful? */
We were already trying to use gaschange_after (and previously gaschange), but it was duplicating an existing condition (now removed).
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Previously gaschange_after was never being set back to false. Now it will be.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The logic for when to output a gasmix in the notes table is more
complicated than it seems at first.
- On a descent leg, the gas is the gas used for descent
- At a stop (calculated or user defined), the gas is the gas used for that
stop
- But on an ascent leg (if displayed), the gas is the gas that is ABOUT TO
BE USED
- The gas should not be repeated if it's the same gas as used on the last
row of the table
- Ascent legs should only be displayed if the display transitions option
is selected, OR if there is a gas change without a stop (the user can
now set a minimum duration for a gaschange, but zero is still allowed).
The existing code tries to track what gas is being used/switched to at
each waypoint, and whether the gas should be printed or postponed to the
next leg. It works sometimes but not always.
This patch replaces the postponed gas logic with:
- Is this an ascent leg? (determines whether the applicable gas is the
preceding or following leg, and whether the leg should be displayed at
all if the transitions option isn't selected)
- Is it an ascent with a gaschange without a stop?
- Has the gas actually changed from the last output?
- Will the next leg be at the same level and same gas (in which case merge
them)?
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Free memory returned from parse_mkvi_value()
Free memory returned from printGPSCoords()
Free memory allocated in added_list and removed_list
Free memory allocated when adding suffix to dive site name
Free memory allocated in cache_deco_state()
Free memory allocated in build_filename()
Free memory allocated in get_utf8()
Free memory allocated in alloc_dive()
Free memory allocated as cache but never used
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change the timestep used to calculate tissue pressures and ascents from 3
seconds to 2 seconds. But whats wrong with using 3 seconds?
Deco stops are at 3 m (10') intervals, and our ascent rate is usually
9 m/min (30'/min), or at least multiples of 3 m/min (10'/min). Hence time
to ascend from one stop to the next stop is 20s (or any factor of 60).
Using 3s increments, we round our ascent interval up to 21 s, which leads
to messy durations and runtimes.
But what about me? I like SI units and whole decimals. Don't worry, 2s
timesteps fit nicely when using 10 m/min ascent rate (18 s between stops).
[Dirk Hohndel: edited the commit message to fix minute/second confusion]
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
--20cf303ddd3893b1500518e9204e
Content-Type: text/plain; charset=UTF-8
Use an adjusted timestep to calculate length of deco stops, so that they
always end at whole minutes of runtime. This makes for a cleaner ascent
profile.
<div dir="ltr">Use an adjusted timestep to calculate length of deco stops, so that they always end at whole minutes of runtime. This makes for a cleaner ascent profile.<br></div>
From 15e08450252f304fc7d46931e2aca5c991c2f3de Mon Sep 17 00:00:00 2001
From: Rick Walsh <rickmwalsh@gmail.com>
Date: Sat, 20 Jun 2015 11:36:07 +1000
Subject: [PATCH 2/2] Planner - end deco stops at whole minutes of runtime
Use an adjusted timestep to calculate length of deco stops, so that they always end at whole minutes of runtime. This makes for a cleaner ascent profile.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Enforce a minimum duration for gas switching in the planner.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Switch the column order of the planner notes table so that duration is displayed before runtime. This is consistent with:
- the verbatim output order, e.g. "Stay at 12.0 m for 3:00 min - runtime 32:48 on EAN50"
- MultiDeco, e.g. http://www.hhssoftware.com/multideco/view_multideco.html
- Planner on the Shearwater Petrel
- How I have been taught to write out my dive plan in my wetnotes
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes a "reproducable hang when using "edit dive in planner" on
non-planned dive".
Comparing unsigned and signed integers isn't a great idea.
Fixes#880
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
clang complais when converting (char *) to (unsigned char *), so tell
it it's fine.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There is no point in doing a stop at 5m if the last manual waypoint is shallower.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
...as this what comes in when the user selects this gas in the
add dive/dive planner contet menu.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As a side effect this changes the signature of plan(): Before it
returned an int that was supposed to be possibly an error but
we never bothered to check it. So now it's bool indicating if the
planner did add stops.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there are more than 100 samples, average some of them so we end up with no more than 100.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since most regulators have an intermediate pressure of 10bar
the minimum value is 10 while the max is 99.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Back in 5bf23381e we started storing planner settings in prefs.
We need to read those settings back when we start the planner.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there is valid gas information (cylinder size and starting pressure),
also ascent before gas runs out (taking a 40bar reserve into account).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adopts the planner to the needs of the recreational diver. Rather than immediately
starting to ascent doing deco stops this mode, this mode stays at the last manually
entered depth for the maximal time before mandantory stops appear (NDL). It does not
change gas but keeps using the last used cylinder.
TODO: * Grey out unused UI elements of the planner in this mode
* Start ascent before gas runs out (or into reserve)
* Do a 3min @ 5m safety stop.
Fixes#840
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When using gasmixes where the difference is less than 2% the planner can't
caclulate casconsumptions correctly. This sets the minimum gasdifference
to 1%.
Fixes#795
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As we now have the logic that there is always an explicit setpoint at
t=0sec for CCR dives, also the planner should honor that.
This fixes a bug that when planning a CCR dive we later add a
setpoint change this influenced the ceiling _before_ the
setpoint change.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The position of one curly brace was wrong. Bummer.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When planning a dive, the gas consumption is based on a user configured SAC.
Thus we should use that SAC and not try to recompute it from samples.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Forward the sample set-point setting as otherwise all ascents are
planned on OC.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In the decision if a dive segment should lead to a line in the
diveplan, we need to differentiate between the lastdepth (the
depth of the last dp to tell if we are currently stopping) and
the last depth that we printed a line for (needed for gaschange
lines). Without this patch, no stops without gas changes were
listed anymore in the diveplan.
Like the last patch for the diveplan: I hope this time I got this
logic right.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a pain. We plan with segments but the plan shows waypoints.
If after a constant depth segment the gaschange (or setpoint chenge
for that matter) appears, the _next_ line should get the info
about the new gas (i.e. change _after_ the constant depth segment).
If, however, the gas is changed after a transition, the final waypoint
of the transition gets the gas printed.
And all is different for a verbatim plan, where the gas change is
an event rather than part of a segment.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Depth is often mentioned in a length unit, but what we care about is
pressure. When diving in fresh water the pressure is lower than the same
depth in salt water. This adds support for using different salinities in
planning.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Calculations for passive semi-closed rebreathers are pretty much like OC
except the pO2 is lower bey a certain (SAC dependent) factor. This patch
introduces the corresponding calculations in case dctype == PSCR which is
so far never set and there is currently no UI for these calculations. As
pO2 is SAC dependent it takes a certain attempt at getting it and drops to
defaults from the prefs otherwise.
As there is no UI at this point and I also don't have any dives, this has
not received much testing, yet, but it compiles. At least.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The latest CCR patches had rendered the planner not usable for CCR dives.
This patch corrects this (and reenables the CCR set point column for
segments). The problem was that a new member setpoint of struct divepoint
had been introduced, but there was already po2 which had the same meaning.
This patch merges the two and renames them setpoint to prevent future
confusion.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes two typos found by lintian.
I guess a bunch of translations will need to be updated or something, I am not
sure how they work so I didn't touch them. I presume in the worst case they
will need to be re-translated at the next iteration
--
Salvo Tomaselli
"Io non mi sento obbligato a credere che lo stesso Dio che ci ha dotato di
senso, ragione ed intelletto intendesse che noi ne facessimo a meno."
-- Galileo Galilei
http://ltworf.github.io/ltworf/
From a0e5f48349557fcccd82ba8c7555043de140835c Mon Sep 17 00:00:00 2001
From: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Signed-off-by: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Date: Fri, 12 Sep 2014 18:25:20 +0200
Subject: [PATCH] Fix typos reported by lintian
Fixes two typos reported by lintian.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this information, when we re-plan a dive we can bring the user right
back to the point where they ended - they have the waypoints in the dive
pointes table and handles are shown on the right points in the profile -
and the rest of the dive is once again calculated by the planning
algorithm.
For now this state is lost when saving the dive file as we don't add this
flag in the sample to our saved files. So if we don't find any samples
marked as manually added we add ALL of the samples as way points on the
diveplan and the user has to manually remove the ones that were
calculated.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simply setting the pointer to NULL leaks memory.
And that C++ recursive two function implementation... oh boy.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Reading the code we should never be able to access breakcylinder without
having initialized it first, but this seems like a really cheap fix.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>