Add the option to only switch at required stop to the planner UI. This is not actually used yet.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add the option for a minimum gas switch duration to the planner UI. This is not actually used yet.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This got broken in a recent transition to more abstract models.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Still trying to make it easier for the Mobile Port:
This patch is a bit bigger than I hopped, but it was the smallest that I
could get.
A lot of TODO items where added where I broke the code because the current
implementation would break the QML implementtion on the designer. I'll
most probably fix those myself when I finish the transition to the models
to the new folder.
I only moved both models at once because there's an interdependency
between them (seems inevitable, tough, but I'll take a better look at it
later).
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
so it affect no longer the previous leg but all the following ones
with the same gas (i.e. until the next gaschange).
This makes the add dive/planner behaviour more consistent
with the rest of the program regarding gas changes.
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>
... but discard an old disclaimer and runtime table if present.
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>
This disables planner UI elements in recreational mode that have no function
in that mode.
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>
With the addition of gas reserves in recreational mode
we need to make sure that the first leg is short enough
that we have more gas left than the specified reserve
even when using small cylinders like LP72.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
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>
This adds to the prefs struct the variables last_stop, verbatim_plan,
display_runtime, display_duration, and display_transitions from the
planner so their values are saved from one session to the next.
The widgets for some of those settings had default values in
plannerSettings.ui; remove them since the new code in
subsurfacestartup.c takes care of initializing them.
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Non-static class member recalc is not initialized in the constructor
Signed-off-by: Marcos CARDINOT <mcardinot@gmail.com>
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>
This makes prefs.display_unused_tanks also relevant for the planner.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's now set up from the mainwindow.cpp file.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the last of the current dialogs to be ported to the
new widgets system. now we need to clean the mainwindow of the
old code.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We can end up having a divepoint that is outside the dive profile. In
this case, we used to crash, but this hack prevents the index out of
range issue.
Fixes#784
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I have no idea how the index ends up outside the range, but at least
this prevents a crash in this case.
See #784
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were updating the dive quite a lot of times, we really didn't need to.
This will help, but not fix, the issues with plan / add dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do the switching based on the index rather than the string (which is
translatable!).
Update set-points when turning on/off CCR mode (remeber: the rebreather
mode is stored in two places: the divemode and implicitly in the setpoitns.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update O2 metabolsim rate and adopt default gas switch depths to
pSCR oxygen drop.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This changes the code so we include all the cylinders from a previous
dive when we re-plain a dive.
Otherwise we would have a hole in the cylinders table when we plan a
dive based on a dive where we have unused cylinders, and it makes more
sense to copy all of them rather than not.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also fixes a bug in the diluent pressure interpolation
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>
ppO2 represented with 2 as subscript.
Special l symbol for litres.
Capitalisation to bring in line with existing style.
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When replannig a dive, offer another button that creates a new
dive rather than overwriting the old. This should help in creating
several versions of a planned dive (longer/shorter, deeper/shallower
etc). Note that this makes dives that start at the same time not
influcence each other's deco.
Also, only the first of a row of simultaneous dives contributes to
the tissue loadings of later dives.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is needed to get the correct maxdepth when replanning
leads to a shallower dive.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit a85a219df3 ("Add ability to replan a dive that we planned
before") I completely mishandled the saving of the replanned data.
How embarrassing.
Fixes#747
See #527
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also, generate the corresponding pixmap only once, and distribute it to
all models that need it.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
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>
We need to start out with valid SAC rates in the diveplan.
Thanks to Gaetan for finding this and suggesting a different fix - this
seems cleaner to me.
Reported-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to offer a simple way to remove a calculated deco, if Control is pressed
while clicking on the trash can in the dive plan, that point and all following are
removed. This way the user can Ctrl-click on the first calculated waypoint.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So far we only plan OC dives, so let's not confuse things by showing the
set point for the tank.
Fixes#261
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>
When doing this, all waypoints of the calculated ascent are now waypoints
in the plan - so the user has to remove the ascent part of the dive in
order to really replan the dive. That's a pain, but we don't keep the data
around that would tell us which waypoints are user input and which ones
were calculated.
Fixes#527
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's silly to carefully calculate our ascent for each new waypoint that we
add to the plan. Let's get them all in and THEN calculate an ascent.
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>
The old implementation was... let's call it creative.
This tries to actually get things right instead of using magic.
Don't pretend that double values are ints.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So far, the fields for the two SAC rates did not show a unit and were implictly l/min.
Now they respect the settings for volume units. This was harder than I thought for two reasons:
1) Imperial units for SAC are cuft/min but a typical value would be .70. So I made the point
the field prefix and what is entered is actually hundreth of cuft per minute.
2) I had to get the rounding right in order not to get effects like 20l/min become .70 cuft/min (19800 ml/min
internally) which would then become 19l/min when switching back.
While being at it, I gave the gradient factors '%'-signs as units.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While it's nice to have immediate response to gradient factor changes,
there is an oddity that very low GFHigh values can cause infinite
decompression if the last stop is at 6m.
Robert fixed this and now errors out of deco after 48 hours, but if the
user simply wants to edit their GFHigh from (for example) 75 to 70 and
deletes the '5', we really don't want to trigger a recalculation for
GFHigh of 7...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to change the displayed numeric value of the altitutde and not just the
unit suffix when changing unit systems.
Fixes#681
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>