Commit graph

15 commits

Author SHA1 Message Date
Michael Keller
ab7b9329c0 Standardised how divedatapoints are created.
Changed the way dive data points for OC cylinders to be added to the
dive plan are created in `createTemporaryPlan()` in
`diveplannermodel.cpp`. This now uses `plan_add_segment()` like all
other places where dive data points are added, in particular the planner
tests.
This also allowed for `create_dp()` to be made static.

Signed-off-by: Michael Keller <github@ike.ch>
2023-02-17 10:53:04 +01:00
Berthold Stoeger
4bbe5646a5 cleanup: remove unused declarations in planner.h
Most of these declared non existing functions or pointers.
One [get_gas_idx()] was only used in one source file and
doesn't have to be globally accessible

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-11-01 12:12:19 +01:00
Berthold Stoeger
8ce7c4664a cleanup: move DECOTIMESTEP from dive.h to planner.h
Long-term project: reduce the size of dive.h

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
dd423bffb9 Cleanup: remove global disclaimer variable
That was used to store the disclaimer of the last plan. The
functionality was disfunctional for a long time, therefore
remove the variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10 21:31:21 +02:00
Berthold Stoeger
ee365b7341 Plan: introduce function that returns disclaimer
The setting of the disclaimer variable was removed inadvertently
some time ago, which removed the disclaimer from the printed plan.
Instead, introduce a function that returns the disclaimer with
the current deco mode. Use that function to generate the dive
notes and for printing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10 21:31:21 +02:00
Berthold Stoeger
4706b0f11a Planner: remove planner disclaimer from old notes
There used to be code to remove the old planner notes when replanning
a dive. It used a global variable and seemed rather brittle. Moreover,
the place that set the global variable was inadvertently removed.
Therefore has been effectively dead code.

Reimplement the functionality, but be more robust by considering
that the deco-type may have changed: Split the translated disclaimer
string in two parts, before and after the "%s" place-holder.
Search for these two parts. Remove the disclaimer and everything
after the disclaimer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10 21:31:21 +02:00
Berthold Stoeger
52e5d9c605 Cleanup: move planner/deco related declarations planner/deco.h
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08 16:26:31 -07:00
Berthold Stoeger
5514047b43 Cleanup: remove unused global variables plangflow and plangfhigh
The last user was removed in 1093d6235b.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19 13:11:10 -07:00
Berthold Stoeger
360f07e453 Cleanup: pass gasmix by value
In a previous commit, the get_gasmix_* functions were changed to
return by value. For consistency, also pass gasmix by value.

Note that on common 64-bit platforms struct gasmix is the size
of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the
same space on the stack. On 32-bit platforms, the stack use
is probably doubled, but in return a dereference is avoided.

Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an
invasive change that going back to pointers is probably the
least of our worries.

This commit is a step in const-ifying input parameters (passing
by value is the ultimate way of signaling that the input parameter
will not be changed [unless there are references to said parameter]).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23 05:16:38 -07:00
Berthold Stoeger
5c4569247a Cleanup: unify get_gas_at_time() and get_gasmix()
There were two functions for getting gas-mixes at a certain timestamp:
- get_gasmix() for repeated queries.
- get_gas_at_time() for a single query.
Since the latter is a special case of the former, simply call
the former in the latter. Moreover, rename to get_gasmix_at_time()
for consistency.

Replace on get_gasmix() call, which was outside of a loop by the
corresponding get_gasmix_at_time() call.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23 05:16:38 -07:00
Robert C. Helling
b1ccd2fc43 Move planner notes to separate file
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26 15:44:36 -07:00
Dirk Hohndel
6399eaf271 Add SPDX header to core C files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Robert C. Helling
eefa390e5f Handle notes in replan
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>
2017-03-28 13:31:45 -07:00
Rick Walsh
b1ed04a7f4 Have divedatapoint store cylinder id instead of gasmix
Determining the correct cylinder index from a known gas mix can be
complicated, but it is trivial to look up the gasmix from the cylinder_t
structure.

It makes sense to remember which cylinder is being used. This simplifies
handling changing a cylinder's gas mix, either directly by the user, or
indirectly in the planner. It also permits tracking of multiple cylinders of
the same mix, e.g. independent twins / sidemount.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:25 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Renamed from subsurface-core/planner.h (Browse further)