The more complex handling is no longer needed because:
- Keyboard tracking for gfhigh/low UI fields was switched off here:
030c094854
- GFhigh was limited to 40 here:
53fffe0ce3
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Simplify the sum up of the deco stop times for analysis of
the planner variations.
Plus rename define for deco stop variations debug output
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
We needed to prevent updates when we messed with the
diveplannerpointsmodel as those would trigger
starting planning from scratch causing infinite loops.
Now, the variations calculation operates on a copy of
the diveplan, so the model is no longer involved and
we should not block recalculations (as those might be
triggered by the UI).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This reenables the computation of plan variations but now in a separate
thread. Once finieshed, a signal is sent to update the notes.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Pass the planner state struct to the profile computation so it can use
deco_time and first ceiling to display VPM-B ceiling.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
For UI responsiveness, we need to be able to run the planner in the background. This needs the
planner state to be localized (and we need to pass a pointer around).
In order to not let too many lines overrun (and to save typing in the future)
I have renamed instances of struct deco_state to ds. Yes this should have gone
to a separate commit but I accidentally commit --amend'ed it.
Computing of planner variations is temporarily disabled.
Unlock the planner when returning early
So we don't deadlock in add dive and recreational mode (which
use the planner without actually planning).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Fix an indentation issue in qt-models/diveplannermodel.cpp.
An if was indented as if it were part of an outer if.
Correct indentation confirmed by Stefan Fuchs <sfuchs@gmx.de>.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is a amendment to 24bd5a8dce
Move the cylinder also to first position if first planner datapoint
cylinder change because a row is added or deleted to the dive datapoints.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
In the planner it is best practise to start the dive with the first
gas in the gaslist. Otherwise one would get a gaschange event at the
very beginning of a dive.
This change implements the following feature:
Automatically move a gas to position 0 in the gaslist if the user selects
this gas for the first dive data point.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
In the planner if one adds two or more cylinders with the same gasmix
(e.g. back gas and bottom stage 18/45) the drop down and data in the
used gas column of the planner points table will be filled with a more
verbose string mentioning also the cyl number and the cyl type
description.
Makes it easier in such a case to select the right cylinder.
Introduces also a helper function which tells you if there is another
cylinder with the same gasmix as the provided cylinder.
This also has an option if it should consider unused cylinders or not.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate
(1x) correctly so that the profile and calculation is updated immediately
after the value is changed (e.g. increased/decresed by 1) by clicking
the QSpinBox arrows.
Until now one had to click into the profile or change another planner
preference first before the change became effective.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Calculating dive.when + dive.duration doesn't always give the correct
endtime of a dive especially when a dive has surface interval(s) in
the middle.
Using the helper function dive_endtime() fixes this issue.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This option should have never been there. This is not how
gradient factors are supposed to work. It would only trick
users to use the wrong value..
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Print out partial derivatives of stop times with respect to
variation of depth and duratin of last manual segment.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
...rather than use a global variable and a macro.
This should be a no-op in preparation to allow planning
several versions of a dive.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
With current code when re-planning a dive the planner output in the
dive notes is always moved down by one line.
This fix avoids that this additional line break is added.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This is another attept at the problem if identifying a potentially
user supplied text in the dive notes upon replannig a dive.
It gets rid of the user visable position markers (*!* and ***) and
cirumvents problems with mark-up by first converting the old notes
to plan text (assuming that user only enters plain text in the notes
field as we do in other places as well). Then the automatically added
part is identified by locating the disclaimer in the text (if the user
edited/delted the disclaimer or changed langue in between it is her
problem to manually delete the old plan).
Everything from the disclaimer on is deleted and replaced by the new plan.
If the disclaimer is not found, the new plan is appended to the old notes.
This way we make sure no information gets automatically deleted.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When replanning a dive, the setpoint information from the profile waypoints
were reset to 0, resulting in a dive that has a dive mode of CCR, but only with
OC legs in the profile. This is just wrong, and is corrected here. Notice
that there is no averaging involved (in the reduction of a replanned real
dive that has more than 100 waypoints) as is done for depth. This is just
fine for setpoint data.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
New strategy to identify old planner output in notes when
replanning a dive: Text anchors ("*!*" and "***") added for planner output
For backwards compatibility: If there is no anchor but an old table
delete everything.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Don't add the last stop with addstop for correcting the lenght
of the dive if planner generated points can be removed when replanning.
Otherwise this will not be deleted when replanning a dive.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Upon replanning a dive, we want to delete the old
dive plan in the notes and replace it with the actual.
This fixes a problem when we failed to detect the old plan due
to the deco model name appearing in the disclaimer that was used
as a marker for the notes.
This patch also adds translation markers for the deco model name strings..
Fixes#285
Signed-off-by: Robert C. Helling <helling@atdotde.de>
... for consistency, while we are at it.
There are still some internal depth variables which are ints
somebody might take a go at those.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This is needed in the altitude pressure conversion as there
negative altitudes are possible (for diving in the netherlands
or the Dead Sea).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Add minimum gas calculation to planner output.
Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime.
Connect UI signals and slots for recalculation of diveplan.
Disable minimum gas calculation if there was already a warning before.
If minimum gas result is larger then cylinder start pressure give warning message instead of result.
Add line break before pO2 warnings but only if warnings exist.
Signed-off-by: Joachim Ritter <jritter@bitsenke.de>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>