Commit graph

19599 commits

Author SHA1 Message Date
Dirk Hohndel
41b5bbb226 add Launchpad PPA build
Could it be this easy? There's no way it's this easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
243d6bfd2b stop building our own libgit2 for Ubuntu
It's embarrassing that we kept doing this for so long. Debian and Ubuntu
have had new enough versions of libgit2 for a very long time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
8e212c0858 Fedora Rawhide builds fail without stdlib include
Implicit declarations of malloc, free, atoi, and others are considered an
error now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
8bf8f18962 trigger Fedora COPR build from GitHub
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Dirk Hohndel
8192379a84 update INSTALL for Debian Bookworm
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-12-04 12:55:10 -08:00
Micha WERLE
c612641517 fix: actually default bottom gas to air
If there are no gas mixes returned by libdivecomputer, we need to default to air. The previous commit would have defaulted to pure oxygen.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Micha WERLE
4842344bc1 feat: extend bottom gas instead of last mix
During code review, an argument was made to use the bottom gas mix as
the mix to fill additional tanks with instead of the last mix reported
by the dive computer.

This change implements `get_deeper_gasmix` which compares two gas mixes
and returns the one with the lower MOD. This comparison does not perform
actual MOD calculations but only performs a  relative oxygen and helium
content comparison.

Instead of saving the last gas mix and assigning it to additional tanks,
a `bottom_gas` mix is saved and assigned instead.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Micha WERLE
d0b95f9401 refactor: revert questionable optimisation
Reverted "optimisation" based on code feedback.

Firstly, it's implementation-defined whether or not a stack frame is created for sub-scopes, secondly any optimisation is questionable regardless, and thirdly it was felt that it makes the code harder to understand.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Micha WERLE
c7171179b3 Core: extend last gas mix instead of defaulting to air.
Instead of defaulting to air when we run out of gas mixes to assign to
cylinders, use the last gas mix provided by the dive computer.

If no gas mixes are provided at all, then default to air.

This prevents Subsurface from "inventing" gas mixes which are not
reported by the dive computer. It also works very nicely with a sidemount
configuration where the dive computer typically reports two cylinders but
only a single gas mix.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
2023-11-21 22:30:45 +13:00
Dark Dragon
5c2e4c395b Fix AppStream ID
See https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html\#tag-id-generic

Signed-off-by: Dark Dragon <darkdragon-001@web.de>
2023-11-07 08:50:28 +13:00
Dirk Hohndel
ede732418b build-system: use gcc 10 for MXE builds
It's unclear if this will be enough to use gcc 10 by default when building
Subsurface using this container.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-11-06 07:56:05 +13:00
Jef Driesen
1abf400c63 Return the actual libdivecomputer error code
The divecomputer_device_open() function tries all supported transports
one by one, and exits as soon as one is opened successfully. When the
end of the function is reached, the DC_STATUS_UNSUPPORTED error code is
returned.

The annoying side effect is that the actual error code returned by the
transport is ignored and changed into DC_STATUS_UNSUPPORTED. This is
very confusing while troubleshooting download problems.

Fixed by initializing the error code to DC_STATUS_UNSUPPORTED, in case
no transport is available for trying, and returning the last reported
error to caller.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-11-05 06:54:40 +13:00
Jef Driesen
2a3c0d981f Add BLE detection for the Aqualung i330R and Apeks DSX
Add the Aqualung i330R and Apeks DSX model numbers to the Pelagic
pattern table. These two models also use a new BLE service UUID.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-11-04 23:03:09 +13:00
Jef Driesen
0d69758cac Add support for the Divesoft BLE service
The UUID of the Divesoft BLE service needs to be added to the list of
known services. It's a 16-bit UUID that gets detected as a standard
service and is ignored otherwise.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-11-04 23:02:54 +13:00
Michael Keller
07a028b14d Desktop: Simplify the get_dive_gas() function.
Remove branches that are always taken or make no difference, as proposed in
https://github.com/subsurface/subsurface/pull/3974#pullrequestreview-1674178375.

Signed-off-by: Michael Keller <github@ike.ch>
2023-10-20 17:16:05 +02:00
Anton Lundin
8d3f2e4ca6 Add another test for formatDiveGasString
This adds a test for the bug just fixed, where we have a trimix gas and
nitrox/air with less o2 than the trimix.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
94164bb8fa Correctly update mino2
When we've already seen a trimix gas, of we after that see a nitrox gas
with less o2, it shouldn't update the mino2 state.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
5444a6b65d Remove unnecessary QString
I thought it would solve the unicode issues I had, but it was
unnecessary.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
a681ff3410 Add even more tests for formatDiveGasString
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
bba0da589b Add tests for formatDiveGasString
This adds tests for formatDiveGasString to ensure it produces the
expected results in some scenarios.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
725b70e64c Correctly find min o2 in get_dive_gas
When the import from a dive computer gives you 100% as the first gas,
the get_dive_gas never finds which gas had the lowest o2 percent.

This fixes the logic to find the lowest o2 percent in any dive cylinder
list.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
8f4b6cfcb9 Ignore not used cylinders in get_dive_gas
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
fea074986a Ignore oxygen cylinders in get_dive_gas
It looks kinda strange that all CCR dives have a dive gas ..100%, so
rather than showing it as the dive gas used, just ignore cylinders
with usage flagged as oxygen.

Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-18 21:34:56 +13:00
Anton Lundin
b6111714b3 Use horizontal mouse wheel for zoomed panning
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-13 21:41:41 +13:00
Anton Lundin
bfe61b2dff Add dive mode as possible column
Signed-off-by: Anton Lundin <glance@ac2.se>
2023-10-13 08:32:27 +13:00
Jef Driesen
c7b7c3f691 Add support for the new Ratio bluetooth name
The new Ratio iX3M 2 models use "RATIO-" as the prefix in the bluetooth
name instead of "IX5M".

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-10-07 23:30:27 +13:00
Richard Fuchs
3c5f22ac25 Fix certificate_check_cb() return value
libgit documents the return value of callbacks.certificate_check[0] as
0 for success and <0 as failure. Returning 1 for success (kind of)
works because some parts of libgit[1] check for <0 return values and
only treat those as errors, but the function actually calling the
callback (check_certificate) treats anything non-zero as error[2] and
ends up setting a spurious error message with a return value of 1.

[0] https://libgit2.org/libgit2/#HEAD/group/callback/git_transport_certificate_check_cb
[1] https://github.com/libgit2/libgit2/blob/maint/v1.5/src/libgit2/transports/httpclient.c#L1054
[2] https://github.com/libgit2/libgit2/blob/maint/v1.5/src/libgit2/transports/httpclient.c#L785

Signed-off-by: Richard Fuchs <dfx@dfx.at>
2023-10-06 11:58:36 +13:00
Dirk Hohndel
c5feae126b truly switch to focal as oldest supported Ubuntu release
Thanks to @mikeller for catching my oversight here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-09-26 21:13:05 -07:00
Dirk Hohndel
947c2e704f remove unsupported versions and add newer ones
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2023-09-26 21:13:05 -07:00
Michael Keller
7165660a45 Fix Invalid Action Version Specification in Check USNs Workflow.
Fix Invalid Action Version Specification in Check USNs Workflow.

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-27 07:42:49 +13:00
Michael Keller
aa9f3843eb Fix Deprecation Warnings in 'Check USNs' Workflow.
Fix deprecation warnings for actions using a deprecated version of node.
Also switch to a fixed version of the environment in order to avoid
future deprecation warnings.

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:17:09 +13:00
Michael Keller
c78c91fb66 Switch to the 'Unofficial Coverity Scan' Action.
Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:16:36 +13:00
Michael Keller
70aefd4db4 Fix coverity Scan Workflow.
Update the virtual machine to run on Ubuntu 22.04 ('latest' at the time
of writing).

Signed-off-by: Michael Keller <github@ike.ch>
2023-09-26 23:16:36 +13:00
Jef Driesen
97a76a6615 Report an error if enabling notifications fails
If enabling the notification fails, receiving data packets is not
possible. Instead of silently ignoring this fatal problem and trying to
continue, report the error back to the caller.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
2023-09-14 09:52:29 +12:00
Robert C. Helling
81f35c1ecf Properly handle the planner state
This does two independent things:

It sets the planner state early enough so the appropriate
default profile for the planner is created (without
safety stop).

Upon cancelling the planner, it resets the profile widget
to profile more (rather than planner) as otherwise upon
the next change into the planner the planner model is
not properly initialized.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-09-12 06:48:33 +02:00
Robert C. Helling
83e7f537fb Text versions of Subsurface icon
To be used on Subsurface merch, this introduces versions
of the Subsurface icon with the program's name and web
address.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2023-08-16 12:11:23 +02:00
Michael Werle
fae68b7a68 fix: merge_pressure does not calculate starting pressures correctly
The existing logic correctly calculates the minimum (ie, ending) pressure, but not the maximum
(ie starting) pressure.

For example, 2 tanks A and B with manual pressures (same tank on subsequent dives, which were
then merged):
A: 205 - 84
B: 83 - 55

When merging the starting pressures, the call is : merge_pressure(205, 0, 83, 0, false)

The final comparison is:
  if(false && 205 < 83) return 205;
  else return 83;

-> So 83 is returned even though 205 should have been.

Signed-off-by: Michael Werle <micha@michaelwerle.com>
2023-08-09 14:35:32 +02:00
Michael Keller
26f20b805d Desktop: Consider Severity when Hiding Events.
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>
2023-08-04 01:11:12 +12:00
Michael Keller
b324849d0c Housekeeping: Update libdivecomputer Submodule.
Update `libdivecomputer` submodule to the latest version.

Signed-off-by: Michael Keller <github@ike.ch>
2023-08-03 00:08:59 +12:00
Michael Keller
8f0380fd05 Equipment: Fix 'used' Gas Selection for CCR Dives.
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>
2023-07-25 12:05:51 +12:00
Michael Keller
5fae7ce7a0 Equipment: Include Unused Tanks in Merge if Preference is Enabled.
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>
2023-07-25 11:19:03 +12:00
Michael Keller
cb6f768865 Equipment: Mark Gas Mixes Reported as 'inactive' as 'not used.
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>
2023-07-23 18:55:20 +02:00
Michael Keller
5e293689fd CI: Disable Broken Ubuntu bionic Build.
Disable the build, as this has not been working for some time, and is
creating a distraction.

Signed-off-by: Michael Keller <github@ike.ch>
2023-07-23 15:48:00 +12:00
Rafael M. Salvioni
8f8f901aa8 Check "hasDCSalinity" is null in updateWaterTypeWidget()
Signed-off-by: Rafael M. Salvioni <rafael.salvioni@gmail.com>
2023-07-14 19:47:34 +12:00
Michael Keller
5511cd13d7 Add forcedFirmwareUpgradeSupported to supportedDivecomputers.
Signed-off-by: Michael Keller <github@ike.ch>
2023-07-11 07:30:49 -07:00
Michael Keller
4ac27e3c71 Desktop: Load the Dive Computer List in 'Configure Dive Computer' Dynamically.
Load the dive computer list in the 'Change Settings on Dive Computer'
dialog dynamically.
Also incorporate suggestions from
https://github.com/subsurface/subsurface/pull/3925#issuecomment-1595784076.

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Michael Keller <github@ike.ch>
2023-07-11 07:30:49 -07:00
Rafael M. Salvioni
695c37499a Core: Fix bug salinity and pressure values in mbar <-> depth conversion
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>
2023-07-11 13:26:24 +12:00
Rafael M. Salvioni
1e082affdd Fix salinity combo/icon when DC doesnt have salinity info
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>
2023-07-09 20:36:46 +12:00
Michael Keller
90e5de8357 Mobile: Make Cloud Auto Synch Status Easier to Understand.
Add an explicit checkbox to the 'cloud auto synch' status toggle in the
mobile 'Dive Management' menu in order to make it more intuitive to
understand.
This isn't super pretty, but I think it will improve the usability. A
prettier way to achieve this will be to redesign the `ic_cloud_off.svg`
/ `ic_cloud_done.svg` in order to make them intuitively recognisable as
unchecked / checked checkboxes.
Example of a support request caused by confusion from the current
implementation: https://groups.google.com/g/subsurface-divelog/c/9X-hTt9NFlE/m/ZcqtdOOhBQAJ

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-26 07:54:48 -07:00
Michael Keller
e260780c9d Export: Fix Cylinder Pressures in CSV Export.
Fix the cylinder pressures in the CSV summary export. Only show
pressures derived from `pressure` attributes in samples for the first
cylinder. Add support for showing pressures derived from `pressure0` ...
`pressureX` attributes.
Also cleaned up unit conversions, and changed tabs to spaces.
From discussion in
https://github.com/subsurface/subsurface/pull/3906#issuecomment-1575980882.

Signed-off-by: Michael Keller <github@ike.ch>
2023-06-25 16:24:52 -07:00