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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>