Similarly to commit 062533d0a (CONTRIBUTING.md: use dashes instead of
hyphens, 2023-01-14), replace hyphens in prose of CODINGSTYLE.md with
dashes to make the rendered Markdown a bit nicer.
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
The `for` loop in the sample iterates over `serviceUuids`, but the only
other statement in the sample assigns variable named `l`. Fix the name
of the variable in the assignment to be the same as in the loop.
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Without an blank line, the pseudo-headers of list items are not
separated from the next paragraph. An example is rendered as:
* variable declarations In C code we really ...
instead of intended:
* variable declarations
In C code we really ...
Add missing blank lines between paragraphs inside list items and in
between list items to fix the intended rendering.
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Samples of code in CODINGSTYLE.md are wrapped in triple-backticks to
render them as blocks of code. For code blocks that are indented within
a list item, Markdown renderer of GitHub treats the leading tab as if it
was four spaces. Rendered code blocks are formatted in a way that
contradicts the code style written down in prose.
Replace leading tabs in indentation with spaces in blocks of sample code
to render them correctly in Markdown lists.
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
In order to support development of the open source firmware of the
OSTC4.
Requires changes in libdivecomputer.
Signed-off-by: Michael Keller <github@ike.ch>
Fix a bug causing the wrong units (m) to be shown on the Dive site
management view if imperial units are as the system default.
Signed-off-by: Michael Keller <github@ike.ch>
Disable the 'search dive computer' ([...]]) button in the 'Import from
dive computer' window if searching is not supported by the currently
selected vendor.
Signed-off-by: Michael Keller <github@ike.ch>
Fixes a bug reported in
https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E:
When planning a CCR dive with multiple segments, the textual dive plan
was showing a non-existent gas change with bogus data. The first part
of the fix is uncluttering of the message printed: Since this change is
_after_ the current diveplanpoint the data needs to come from `nextdp`
and not `dp`. The second part is that the message is not printed any
more if the current and the following segments have been manually added:
According to comments in the code the change should only be printed on
the segment _before_ the change if this segment is an ascent segment
that is followed by a manually entered segment.
Signed-off-by: Michael Keller <github@ike.ch>
Fix a bug that results in dive plans outside of the configured risk
profile being produced when planning a CCR dive with the first segment
set to open circuit.
`d->dc.divemode` is already set in `setRebreatherMode`, which is
sufficient, and congruent with the setting of other dive parameters,
like `diveplan.gflow`.
Signed-off-by: Michael Keller <github@ike.ch>
Merge upstream updates from Jef Driesen:
- Deepblu Cosmiq+ support has been merged upstream
- Oceans S1 support has been merged upstream
- Various new models supported: Cressi Donatello, Scubapro G2 TEK, new
Excursion v6+ firmware.
- misc core changes, most notably supporting a new annoying specialized
binary format for decomode, because Jef still can't deal with
strings.
- lots of small details
(all the work done by Linus - I'm just adding this to Surface)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With Qt-containers, this might be a small pessimization, because
it might lead to a deep copy. This can be "fixed" by
for (const Type &item: qAsConst(container))
But frankly, I don't care. Ultimately it is probably best to
replace the Qt containers by standard containers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The event names were registered in add_event(). However,
the undo system did not use that function, but add_event_to_dc(),
which takes an already allocated event.
That gave the following unfortunate situation:
Load a log without setpoint changes.
Add a setpoint change.
The setpoint change event type now was not registered and
therefore couldn't be hidden.
Admittedly, a subtle bug, but still a bug. Fix by registering
event names on event creation.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The eventname handling code was splattered all over the place.
Collect it in a single source file and use C++ idioms to avoid
nasty memory management. Provide a C-only interface, however.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
Fixes a bug reported in
https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E:
When planning a CCR dive with OC bailout, the diluent gas may be chosen
as the first OC bailout gas, despite being set up with a use type of
'diluent', and likely not being available for open circuit breathing.
`best_first_ascend_cylinder` is now initialised to an invalid value
(instead of the first cylinder, which may or may not be a diluent
cylinder), and its subsequent use is guarded by a validity check.
Signed-off-by: Michael Keller <github@ike.ch>
3629a87 changed the handling of cylinders in multi-dives edit.
Not only should the cylinders be the "same", but also at the
same position. The code did not check whether the edited dives
even had that many cylinders, leading to a null-pointer
dereference.
Check whether the cylinder exists before comparing it.
Fixes#3578.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Change the values supplied in the warning to be fractions. This is what
is actually reported by libdivecomputer. The currently used thousandths
are hard to interpret for users, as they are only used internally in
Subsurface.
Signed-off-by: Michael Keller <github@ike.ch>
Fix bug introduced in #3576: On CCR dives cylinders listed as open
circuit bailout by the dive computer need to be set to `OC_GAS`.
Signed-off-by: Michael Keller <github@ike.ch>
These were two weird and clearly wrong constructs of the
type "if (iter && iter + 1)", where iter is a pointer. This
is always true at best and undefined at worst. Another
instance was removed in 096de0efd0.
The original code probably wanted to check whether the
found character was the last character in the string.
But that likewise seems to make no particular sense in
this context. Therefore, just remove the second part of
the boolean expression.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Use the drop down for editing the tank use in the gas list in both the
equipment tab and the dive planner.
The tank use column is now available in the equipment tab for all dives
and not just CCR dives, as 'not used' is a valid entry in both cases.
However, if the current dive is an OC dive, only 'OC-gas' and 'not used' are
shown.
There still seems to be a problem that in some cases, when opening the
planner after selecting an existing CCR dive the drop down in the
planner does not list CCR gas uses - for some reason `displayed_dive`
does not seem to be updated correctly on opening of the planner. But I have not been able to
reproduce this consistently, and changing 'Dive mode' fixes this.
Signed-off-by: Michael Keller <github@ike.ch>
Clarified the message that is shown when a newer dive computer firmware
version is available, informing the user that
using an older firmware version may result in problems when using
Subsurface, as discussed in #3568.
This is currently only supported for Heinrichs-Weikamp dive computers.
Signed-off-by: Michael Keller <github@ike.ch>