aboutsummaryrefslogtreecommitdiffstats
path: root/planner.h
AgeCommit message (Collapse)Author
2015-08-20Leftovers from introduction of in_planner() helper functionGravatar Robert C. Helling
I have no idea how these could have been left behind Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15Some unification between Buehlmann and VPM-BGravatar Robert C. Helling
This patch makes deco_allowed_depth() work both for Buehlmann as well as VPM-B (as long as the VPM-B internal variable total_gradient[] is valid). As a bonus, in VPM-B mode, in the planner, the ceilings are VPM-B ceilings and not Buehlmann GF. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05Add simple test for the dive plannerGravatar Dirk Hohndel
This sets up a standard dive scenario (30 minutes at 260ft/79m, EAN36 and Oxygen as deco gases, last stop at 20ft/6m) and calls the planner to set up a dive plan given certain standard gases. Instead of trying to verify the complete plans it checks that we switch to the deco gases at the right depth and the complete duration of the dive matches our expectation. The test intentionally fails right now for imperial as we have the wrong switch depth for Oxygen. See how useful tests are? On the downside, the test does NOT produce the same plan as Subsurface when I try to create a consistent setup for both - and I have not been able to figure out why. There must be some other parameters that I'm not setting, but I haven't identified them, yet. It's very small differences, for example in the metric case the stops at 21m, 9m, and 6m are each one minute shorter in the test than it what Subsurface calculates. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02Introduce recreational planner modeGravatar Robert C. Helling
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>
2014-08-19Planner: correctly free divedatapointsGravatar Dirk Hohndel
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>
2014-08-05Bail out of deco calculation after 48h or dive timeGravatar Robert C. Helling
With very low values of GFhigh and setting the last stop depth to 6m it is possible to create dives that need infintie decompression time. This ends deco after 48h and replaces the dive plan with an error message. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Convert get_gas_from_events to get_gas_at_timeGravatar Anton Lundin
This converts the get_gas_from_events to a get_gas_at_time function that actually maps our events to what cylinder and thus gas we are breathing at that time. [Dirk Hohndel: fixed to actually use the gas that was looked up (and make things compile)] Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Use more of our propper types in the plannerGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-04Disclaimer included in the printed diveplanGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-02Optionally strip diveplan to bare minimumGravatar Robert C. Helling
There are new check-boxes to modify the look of the diveplan in the notes. The old behaviour appears with "verbatim display", others are shorter, runtimes, stoplengths and transitions being optional. Also round to full meters and minutes to remove optical clutter. To be done: Remember these setting in the config. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01Use proper typesGravatar Dirk Hohndel
This is step one of many to use gasmix instead of int o2/he. Right now some of these changes look ridiculous because after changing a few lines we immediately go back to o2 = get_o2(gas). The reason is that I wanted to convert a hand full of functions at a time. So in this commit I only change validate_gas(), get_gas_from_events() and get_gasidx() to use a struct gasmix instead of int o2, int he. This state builds and survived some mild testing. Let's continue on top of that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-30Planner: don't do unnecessary work on empty dive plansGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Remove external declaration of non-existant global variableGravatar Dirk Hohndel
Just to slightly reduce possible confusion. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Put include guard to every headerGravatar Boris Barbulovski
* ensure include guard to every header * comment endif guard block Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19Add gas change event from profile context menuGravatar Dirk Hohndel
This allows to add missing gas change events to the currently shown dive computer. Only gases defined in the Equipment section are offered. Fixes: #250 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08Be consistent when passing around gas data in the plannerGravatar Dirk Hohndel
We need to make sure that the correct segment has the correct gas assigned to it - and that those gases are correctly tracked when editing a manually added dive as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Next round of code removal and header cleanupGravatar Dirk Hohndel
None of this is used anywhere Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Delete code and files that are no longer usedGravatar Dirk Hohndel
Most of this is Gtk related, some of it is helpers that we don't need anymore. I love the diffstat. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Trying to switch to Qt translationGravatar Dirk Hohndel
This compiles and looks about right, but it doesn't appear to work, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06First steps towards removing glib dependenciesGravatar Dirk Hohndel
- remove the build flags and libraries from the Makefile / Configure.mk - remove the glib types (gboolean, gchar, gint64, gint) - comment out / hack around gettext - replace the glib file helper functions - replace g_ascii_strtod - replace g_build_filename - use environment variables instead of g_get_home_dir() & g_get_user_name() - comment out GPS string parsing (uses glib utf8 macros) This needs massive cleanup, but it's a snapshot of what I have right now, in case people want to look at it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18Only calculate deco stops in planner modeGravatar Dirk Hohndel
In add dive mode simply bring the diver safely back to the surface (currently with a fixed ascent rate of 30ft/min (or 9m/min)). We should make that rate configurable (for the planner as well as the dive add function). Also, the dive add function should offer to automatically include a safety stop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-30Gas choices working, both directions ( Planner and Table )Gravatar Tomaz Canabrava
The gas choice now works and correctly ( I hope ) calculates the gas choosen to show on the planner. User can choose the gas from the list on the visual planner, and also on the table. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-03planning: Add option to have last stop at 6m/20ftGravatar Anton Lundin
When diving in areas where there are risk of boats passing above you, its common practise to do the last stop at 6m to better stay out of harms way. When doing o2-deco, it doesn't matter for the deco time if you are doing all the time at 6m, due to that you don't have any inert gas in your breathing gas. This code is a reintroduction of 0b8462bd lost somehow between a70a8898..8fae0031 Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-08Separate Gtk related code from core logic: plannerGravatar Dirk Hohndel
Relatively straight forward, just a handful of places where we call show_error() (a UI function) from the logic code. In the process I noticed a few places where error returns weren't dealt with correctly. Added a new planner.h files for the necessary declarations. This should make no difference to functionality. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>