The Divesoft Liberty has four O2 sensors. So far, we had a hard coded
limit of three sensors and crashed with a failed assert when we
encoutered more than three. This allows for up to
MAX_O2_SENSORS which is currently 6. The voting logic is adapted
accordingly: We sort the values and we keep deleting the values that
differ more than 20% by value from the closest. This follows what
Shearwater implements on their computers.
In some of the import/export functions the value is still hard
coded to 6 thanks to explicit field names.
Signed-off-by: Robert C. Helling <helling@lmu.de>
When events are hidden in the profile, only hide events with the same
name and the same severity (flags).
From discussion in https://github.com/subsurface/libdc/pull/54.
Signed-off-by: Michael Keller <github@ike.ch>
Fix how gases are marked as 'used' and kept from being deleted in the
equipment tab for CCR dives.
It does not make sense to treat the (arbitrary) first gas in the list
with a usage type of 'diluent' or 'oxygen' as 'used' and prevent the
user from deleting it. Dive computers report the initial diluent and
any other diluents used through a 'gaschange' event, so the actually
used diluents are already picked up as part of gaschange event based
logic.
Also clarify the selection of the first diluent used as a default if no
gaschange events exist.
Also fixed the test data - gases that have a pressure change should be
included in the profile if they do not have a gas change recorded
against them by other dive computers, even if they are oxygen.
A secondary problem shown by this is that the pressure change is not
applied to the profile - the pressure is currently shown as constant on
the start pressure. But this is for another pull request.
Signed-off-by: Michael Keller <github@ike.ch>
Include unused tanks in merges of multiple logs into a single dive if
the 'Show unused cylinders' preference is enabled.
Also rename the preference (in code) to `include_unused_tanks` to
reflect the fact that it is already used in more places than just the
display (exporting, cloning dives).
Simplified the cylinder model to make forced inclusion of unused tanks
dependent on use of the model in planner.
Leaving the persisted name of the preference as `display_unused_tanks`
to avoid resetting this for all users - is there a good way to migrate
preference names?
Signed-off-by: Michael Keller <github@ike.ch>
Mark gases that are reported as 'inactive' by the dive computer as 'not
used' in the Equipment tab.
Requires https://github.com/subsurface/libdc/pull/52.
Signed-off-by: Michael Keller <github@ike.ch>
The conversion between mbar and depth sometimes uses DC's salinity, sometimes user's salinity. By other hand, it uses surface pressure given by user in calculation.
This fix try to standartize this values, using them from same source.
Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
Today salinity combo is editable if one of these rules matches: The dive was manually entered or if salinity edition is allowed in preferences.
However we can have cases that dives were downloaded but its doesn't have salinity info.
This fix considers if there's a DC salinity info to decides combo edition and if salinity change indicator will be showed or not.
If DC doesn't have salinity, the UI behavior is the same of a manual dive
Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
Add a button that allows the user to hide the infobox with statistics
about the point in the dive under the mouse cursor in order to be able
to see the full dive profile unobstructed.
Signed-off-by: Michael Keller <github@ike.ch>
Use the dive computer / device information that was persisted when
previously downloading dives or configuring the dive computer in the
dive computer configuration dialog.
Also rename 'Connect with bluetooth' and 'Cancel' buttons in the dialog
to make them more consistent with what they do.
Signed-off-by: Michael Keller <github@ike.ch>
Rework of the XSLT used to generate the Summary CSV export:
- fixed a bug causing invalid CSV to be generated for double quotes
(`""`);
- changed quoting and escaping to be compliant with RFC 4180;
- changed output to contain information for all cylinders for all dives
(instead of limiting the number of cylinders to howevermany are used
for the last dive);
- added an index to the cylinder data headings;
- changed unit designators to use `[]` instead of `()`;
- some minor improvements to the XSLT.
Signed-off-by: Michael Keller <github@ike.ch>
Add support for tracking the gas usage across multiple tanks to the 'bar
used' and SAC values shown for the profile ruler.
The following rules are implemented:
- a tank is considered 'used' if at least one bar has been consumed;
- only used tanks are taken into account for calculations;
- 'bar used' is only shown if all tanks used have the same (or unknown)
volume;
- SAC is only shown if all tanks used have a known volume.
Fixes#3902.
Reported-by: @pabdakine
Signed-off-by: Michael Keller <github@ike.ch>
When editing a dive site in the 'Dive sites' view, add a context menu
entry to allow mergeing of the displayed dive site into the dive site
seleted in the 'Near dive sites' list.
This merge has the opposite direction of the existing 'Merge into
current site' function, which can simplify the workflow when maintaining
a large number of dive sites, as the facilities to sort dive sites in
the 'Dive sites' view does not have a way to sort by location or
proximity.
Signed-off-by: Michael Keller <github@ike.ch>
Change the output formato for the Export / 'CSV summary dive details'
from TSV to CSV, to make it consistent with the menu item name, and with
the other 'CSV' export function.
This was changed to TSV by @mturkia in
6c82578540,
but I could not find any discussion as to why.
Also removed replacement of the field separator in any fields, as,
according to the CSV RFC (https://datatracker.ietf.org/doc/html/rfc4180)
this is not required as long as the fields containing separators are
enclosed in quotes, and any quotes within the fields are doubled up.
Tested with a fairly large log file, and importing into Google Sheets is
working fine for the output produced.
Also made capitalisation of the Export menu items consistent.
Signed-off-by: Michael Keller <github@ike.ch>
Add an option for users to sync the dive computer time with the PC time
every time dives are downloaded.
Obviously this will only work on dive computers that have time
synchronisation support in libdivecomputer, for other computers a notice
is logged.
The selection for this option is persisted as a preference.
Signed-off-by: Michael Keller <github@ike.ch>
Strangely enough, half of the infrastructure was
already there, it just wasn't hooked up to a UI
element
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Some DCs only report water type, without salinity level. Subsurface
fixes most of these cases using default levels, but when the type of water
is Sea/Salt, this fix was not saved.
This causes a bit confusion, mainly if the user defines own salinity level.
Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
Fix a bug causing the bluetooth address not being used when downloading
from a 'remembered' dive computer if the device selection is populated.
This specifically excludes MacOS, as 'remembering' bluetooth connections
does not seem to be working there as per
https://github.com/subsurface/subsurface/pull/2158#issuecomment-508933672.
I am not super sure why we are _not_ trying to use the 'remembered'
device if the device selection is populated (`ui.device->currentIndex()
== -1`) - maybe this should be clarified in a comment?
Signed-off-by: Michael Keller <github@ike.ch>
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>
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>
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>
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>
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>
The Heinrichs Weikamp OSTC4 introduced an additional
'Cave' brightness level that is dimmer than all existing ones.
Signed-off-by: Michael Keller <github@ike.ch>
Instead of adding all gases read from a dive computer as part of a dive
log as 'OC-gas', add gases as 'diluent' if the dive has a dive mode of
'CCR'. This creates consistency with the ppO2 for CCR dives being
tracked as sensor readings or a fixed setpoint, and not as the ppO2 of
the current gas ad depth.
A follow up question from this is whether gas use in the cylinders list
on the Equipment tab should be user editable. This seems to be
inconsistent at the moment, with gas constituent percentages downloaded
from the dive computer being editable, but gas use not.
Signed-off-by: Michael Keller <github@ike.ch>
The code that calculates the bounds of the value axis was broken
when all items had the same value. In that case, increase the shown
range explicitly. It doesn't really matter how much the range
is increased, because all items will be at the center of the graph.
Also, don't overwrite the "decimal" value of the class. That was
just weird.
Fixes#3544.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When collecting the data for the infobox, we have
already computed the current partial pressures of the
breathing gas taking into accoutn the divemode. Use
those rather than fractions (which for CCR mode are
those of diluent) to compute the gas density.
Reported-by: Pietro Tranquillini <p.tranquillini@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
We must add one more entries than there are days, because the
entries describe the values between histograms.
The root cause of the problem here is that a histogram axis
is misused for a continuous day-axis.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This got broken in commit 7417f865cd ("cleanup: un-singletonize
ShiftTimesDialog") and no one ever noticed.
We need to intitialize the when variable and set up the initial texts in
order for the time shift dialog to show the correct information. Doing
this in the ButtonClicked member (right before the dialog is destroyed)
makes absolutely no sense.
Fixes#3535
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This used to be one of the tab-widgets, which was illogical
and caused confusion. Notably, erroneously clicking on the
tab header led to a reset of the dive selection.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Render a warning sign in front of the event string
in the infobox. This is done in rich text.
Note: This shows the warning sign for all events,
not just warnings.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When zoomed in, the profile position was moved by hovering with
the mouse. What a horrible user experience. This is especially
useless if we want to implement an interactive profile on mobile.
Instead, let the user start the panning with a mouse click. The
code is somewhat nasty, because the position is given as a
real in the [0,1] range, which represents all possible positions
from completely to the left to completely to the right.
This commit also removes the restriction that the planner handles
can only be moved when fully zoomed out. It is not completely
clear what the implications are. Let's see.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Also allow editing sensor on a cylinder with already attached sensor.
This will swap the sensor data with the cylinder that it is taking the
sensor data from, removing the need for adding an extra temporary
cylinder when swapping two sensors.
Signed-off-by: Michael Andreen <michael@andreen.dev>
This was added for Android a while ago, but now this works on iOS as well which
is a very welcome addition for the recipient of these support emails (i.e. me).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For Ratio dive computers we can't tell by the Bluetooth name which model it is.
There are BT only models and BLE only models. The failure case here was a user
on iOS (BLE only) with a BLE only dive computer which we didn't recognize
because previously we returned a BT only device (which isn't supported on an
iPhone), and the lookup won't return a valid descriptor if the transport needed
isn't available.
These days BLE is far more common, so return a BLE enabled name by default, but
try a BT only name just in case.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For some reason the flag to exclude . and .. breaks this functionality.
It works just fine without that flag, so let's just remove it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When a dive has both real dive computers as well as at
least a planned version (which is just another dive
computer with a special name), only use the data from
real dive computers for aggregate values like maxdepth,
dive time, average depth etc in order not to have
imagined data on the dive list, statistics etc.
Macro-magic-provided-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This is crazy: when view() is called, the dive-site-suggestion
popup (DiveLocationListView) clears its WA_InputMethodEnabled
flag. This makes key composition not work as long as the
popup is open.
Thus, when showing the popup, explicitly set the flag.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>