In the planner notes format the HTML for different sections with
div tags.
Put the table title for the ICD table outside the table because then the
alignment looks a little bit nicer.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Avoid the need for a char array for the "old_gas_name" by passing
two pointers to the gasmixes to the add_icd_entry function and
calling helper function gasname() there twice.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
If a gaschange happens at the beginning of a segment, currently the
wrong runtime (end of segment time) is printed in the ICD table.
This is corrected here.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Move the above function from plannernotes.c to dive.c so that
it is available to be called from the dive log part of the
software, and not only from the planner. The following was done:
1) Edit the comment above the code to make it more accurate
2) Move the structure icd_data to dive.h
3) Create an external reference in dive.h for the above function
4) Copy the body of isobaric_counterdiffusion() to dive.c
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This patch implements the calculation and printing of icd parameters
in the dive planner output. It does:
1) icd parameters are calculated following the rule-of-fifths for
OC trimix dives. For each gas change on the ascent that involves
helium, the change in gas composition as well as the change in
partial pressures are shown. If rule-of-fifths is exceeded, a
warning message is prinetd.
2) An independent function is provided that in principle enables
calculation of icd paramaters outside of the context of the
dive planner.
Further updates to icd calculations
These changes respond to #1047. Code style conventions have been
improved. The ICD table is now also printed when the planner is
set to verbatim mode. The code that created the html icd results
has been moved to a function. This does not make the code more
efficient (many parameters passed) but it makes the code more clean.
Free a new dynamic variable (old_gas_name)
Stylistic changes to new code in plannernotes.c
Changes in comments to explain some of the changes I made.
Preparation of comments and functioning of isobaric_counterdiffusion()
and its dependent data structure for possible transfer to dive.c
and dive.h after finalisation and merging of the present PR.
Smaller stylistic changes to conform to our coding rules.
The several comments and suggestions during github review
(@atdotde, @leolit123, @sfuchs79) are incorporated.
Fixed up mis-aligned comments and text descriptions by replacing
tab characters with space characters, thereby hard-forcing
alignment of indented lines of text.
Remove parameter *dive from function isobaric_counterdiffusion().
Improve a few constructs to conform to our style rules.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
The last 2 commits have now been squashed.
S Fuchs's comment on line 315 has been fixed
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This fixes a bug where if the user entered very high ascent (or less commonly
descent) rates such that the time to ascend (or descend) from one level to the
next was less than 10s, that leg would be skipped in the dive plan notes.
Reported-by: Alexander Maier <maieralex@me.com>
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Internal floating point (FP) calculations should be performed using double
unless there is a very good reason. This avoids headaches with conversions.
Indeed, the vast majority of FP calculations were already done using double.
This patch adapts most remaining calculations. Not converted where things
that were based on binary representations and variables which weren't used
anyway.
An analysis of all instances follows:
core/plannernotes.c, l.404:
This was a comparison between two floats. On the left side, first an integer
was cast to float then multiplied with and integer and divided by a constant
double. The right hand side was an integer cast to a float. Simply divide by
1000.0 first to convert to double and continue with calculations. On the right
hand side, remove the cast, because the integer will be implicitely cast to
double for comparison. This conversion actually emits less instructions,
because no conversion to double and back is performed.
core/planner.c, l.613:
Same analysis as previous case.
subsurface-desktop-main.cpp, l.155:
A local variable representing the version OpenGL version. Turn this into
integer logic. Not only does this avoid dreaded FP rounding issues, it also
works correctly for minor version > 10 (not that such a thing is to be
expected anytime soon).
abstractpreferenceswidget.[h/cpp]:
A widget where the position is described as a float. Turn into double.
desktop-widgets/divelogexportdialog.cpp, l.313:
total_weight is described as float. Use double arithmetics instead. This
instance fixes a truncation warning emitted by gcc.
Calculating variations when in recreational mode doesn't make sense, and can
prevent variations from being calculated when switching back to Buhlmann or
VPM-B modes.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
If we consumed 0l/0bar in total from a cylinder there is no need to also
state that we consumed 0l/0bar during ascend.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This string is substituted with the runtime increments derived of slight
variations in depth or bottom time in:
diveplannermodel.cpp:1058:
displayed_dive.notes = strdup(notes.replace("VARIATIONS", QString(buf)).toUtf8().data());
Translating it avoids substitution and we just get the translated
string.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
When changing the date/time of a dive in the planner the dive may end
up in a totaly new position in respect to date/time of other dives in
dive list table. It can be moved to the past or the future before or after
other existing dives. It also could overlap with an existing dive.
This change enables identification of a new "virtual" dive list position
and based on this starts looking for previous dives.
Then it (as before the change) does init the deco calculation with any
applicable previous dive and surface interval.
If some of these applicable dives overlap it returns a neg. surface time
which is then used in the planner notes to prohibit display of results.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Print the delta between the required minimum gas result and the cylinder
pressure at last bottom datapoint in results.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
...even when not showing transitions, this makes the
first stop look more like a stop (since it does not include
several minutes of ascent).
Signed-off-by: Robert C. Helling <helling@atdotde.de>