1836 Commits

Author SHA1 Message Date
Jef Driesen
331bcbdaf7 Show the correct help message for the scan command 2021-12-13 08:46:09 +01:00
Jef Driesen
af03e39383 Add support for the Crest CR-4
The Crest CR-4 is compatible with the Deep Six Excursion.
2021-11-19 08:26:19 +01:00
Jef Driesen
b2040d9adb Add udev rule for the Suunto EON Steel Black 2021-11-16 14:04:45 +01:00
Jef Driesen
cadbffe416 Merge branch 'oceanic-ble-handshake' 2021-10-20 15:04:26 +02:00
Jef Driesen
cd0f42804a Ignore unsupported BLE handshake
For some BLE enabled models, like the Oceanic Pro Plus X, Aqualung
i750TC, Sherwood Sage and Sherwood Beacon, the BLE handshake command
is not supported and therefore disabled.

However, based on a bug report by a user with two Aqualung i770R dive
computers, this detection mechanism based on the dive computer model
number isn't sufficient. Allthough the two devices have the exact same
firmware version (2A), the handshake command only works on the newest
unit, and fails with a NAK response on the oldest unit.

Remove the model based detection and always try to send the handshake
command and rely on the NAK response to ignore the failure instead. An
additional advantage is that we no longer have to (manually) maintain a
list with the model numbers where the handshaking is known to fail.
2021-10-20 15:02:57 +02:00
Jef Driesen
ba4a119a4f Detect NAK response packets
When the dive computer receives a command it doesn't support, it sends
back a single byte NAK (0xA5) packet instead of the expected ACK byte
(0x5A) at the start of the packet. Retrying is pointless in this case,
because the next attempt will also fail. Instead, return immediately
with an appropriate error code, and let the upper layers handle the
unsupported command.

Note that the detection is currently only enabled for BLE communication.
2021-10-20 15:02:34 +02:00
Jef Driesen
9ff6e5caad Remove the initial gas switch
The Cressi Drake is a freedive computer and does not support gas
switches.
2021-10-13 11:06:26 +02:00
Jef Driesen
a8bcfb998b Restore the original standard gravity factor
The Uwatec/Scubapro dive computers are confirmed to internally use the
approximated standard gravity (10.0 m/s²) for the depth conversion.
Allthough this is technically wrong, users expect to get the same depth
values as their dive computer shows.

This partially reverts commit cfc9ddc380bdc5616893fc2af4e05204b5500ea2.
2021-10-03 11:37:59 +02:00
Jef Driesen
1c39c68203 Add support for the Mares Puck Pro +
The Mares Puck Pro + is compatible with the previous Puck Pro. Both
models can't even be distinguished because they share the same model
number and use the same product name in the version packet.
2021-09-28 12:14:10 +02:00
Jef Driesen
0a9b8b1318 Merge branch 'smartair-freedives' 2021-09-14 21:34:01 +02:00
Jef Driesen
7e075eb959 Add support for Mares Smart Air freedives
The Mares Smart Air supports a freedive mode, which uses a different
data format compared to the scuba dives.
2021-09-14 21:33:47 +02:00
Jef Driesen
e52468e0c3 Use a layout descriptor
Replace hardcoded constants with a layout descriptor. This reduces the
amount of model specific conditions, and makes it easier to add support
for new models.
2021-09-14 21:32:48 +02:00
Jef Driesen
1a4798792e Use the divetime stored in the header
There is no need to calculate the total time from the pseudo profile,
because the dive time is also stored in the header.
2021-09-14 21:32:48 +02:00
Jef Driesen
c4b694fdb1 Fix the salinity parsing
The parser->mode field is only initialized at the end of the function.
The result is that the current code always used the default value
(zero). Inside the function itself, the local variable should be used
instead.
2021-09-14 21:32:31 +02:00
Ryan Gardner
75f260a941 Add support for the Deep Six Excursion
Based on original work and code by Ryan Gardner, with some additional
improvements and integration into libdivecomputer by Jef Driesen.
2021-08-17 22:38:53 +02:00
Jef Driesen
e0409a9496 Add support for the Cressi Neon
The Cressi Neon appears to be compatible with the Goa and Cartesio, with
just a different model number.
2021-08-17 17:53:16 +02:00
Jef Driesen
70d3cdcc08 Use symbolic constant for invalid value 2021-08-16 15:26:45 +02:00
Jef Driesen
03974481b0 Remove duplicate macro definition 2021-08-09 10:04:17 +02:00
Jef Driesen
58d410b1a2 Add BLE support for the Aqualung i750TC
The Aqualung i750TC supports BLE, but the BLE handshaking fails and
needs to be disabled.
2021-08-08 20:34:49 +02:00
Jef Driesen
38bd51e63a Exclude the surface time from the dive time
Like most dive commputers, the Mares Genius uses a surface timeout to
detect the end of the dive. But since there is no explicit dive time
field stored, the total dive time is based on the number of samples,
which includes this surface time at the end of the dive. However, the
dive time displayed by the dive computer (and also the Mares
DiveOrganizer application) does not include this surface time.

For older firmware versions the value is hardcoded to 3 minutes, but
starting with the newer v01.02.00 firmware the value is configurable and
stored in the settings. To detect whether the setting is available, we
need to check the profile version instead of the header version. That's
because the header appears to be generated on-the-fly during the
download, and thus the header version also changes for dives recorded
prior to the firmware update.

For all other models, also take into account a hardcoded timeout of 3
minutes.
2021-07-26 17:20:16 +02:00
Jef Driesen
927362354d Some more fixes for the new Mares Genius firmware
The changes in commit 5cb527d53ca88ac692beb55288172fc1003975fa to
support the new Mares Genius firmware v01.02.00 were incomplete.

For dives recorded prior to the firmware upgrade, only the header
version changed from 0.0 to 1.1, while the profile version remained the
same. But for dives recorded after the firmware upgrade, the profile
version also changed from 0.2 to 1.0.

The known header and profile object versions (indicated as
type.major.minor) are now:

  Model   | Firmware | Header | Profile
  ========|==========|========|=========
  Genius  | 1.0.x    | 1.0.0  | 0.0.2
  Genius  | 1.2.0    | 1.1.1  | 0.1.0
  Horizon | 1.7.28   | 1.0.1  | 1.0.2

To simplify the object version check, all versions below a certain upper
limit are now considered supported.
2021-07-13 22:45:40 +02:00
Jef Driesen
5bb6257acb Implement the salinity field
The 4th bit of the settings byte contains the salinity setting (salt or
fresh water).
2021-07-13 00:00:26 +02:00
Jef Driesen
060c0b7215 Fix the sample rate parsing
The byte at offset 0x1A appears to be some settings byte, containing not
only the sample rate index, but also some other values in the higher
bits. Except for the 4th bit, which contains the salinity setting, the
meaning of those higher bits remains unknown. Since the sample rate is
limited to only 4 possible values, 2 bits are sufficient for encoding
the sample rate index. The 3th bit might contain some other setting, or
be reserved for future sample rates.
2021-07-12 23:52:56 +02:00
Jef Driesen
5cb527d53c Add support for the new Mares Genius firmware
The new Mares Genius firmware v01.02.00 has a header which is 10 bytes
larger. This difference is indicated with a change in the major version
from 0 to 1.
2021-07-06 17:43:41 +02:00
Jef Driesen
cfc9ddc380 Use the correct standard gravity factor
For manual depth calculations by divers, the standard gravity is
often approximated as 10.0 (e.g. 1 bar corresponds to 10 meter), but
libdivecomputer prefers to use the exact value of 9.80665 m/s².

For the McLean Extreme, it has been confirmed that the device also uses
the correct standard gravity internally for the conversion of the sample
depth.
2021-07-06 16:16:18 +02:00
Jef Driesen
cffda88ae8 Use SI units internally
Prefer SI units for internal constants (e.g. density) and calculations.
This results in more consistent conversion formulas across the different
backends.

For the Uwatec backend, this changes makes it also much more visible
that the unit for the depth is either 1 millibar (maximum depth) or 2
millibar (sample depth).
2021-07-06 16:16:18 +02:00
Jef Driesen
b186846a9e Fix negative depth values
The difference between two unsigned integers can be negative. To avoid
ending up with some very large positive values, an explicit cast to a
signed integer is required.

Depths are normally expected to be always positive, but near the surface
the pressure will be very close to the atmospheric pressure. Therefore
small negative values are not unusual.
2021-07-06 16:16:18 +02:00
Jef Driesen
da2446283a Move the unit conversion to the last moment
Processing the data in device units, and performing the unit conversion
only at the very last moment, avoids the need for intermediate floating
point math and thus possible rounding errors. In practice this is not
really an important issue, except for some case where a negative zero
value was returned.
2021-07-06 16:16:18 +02:00
Jef Driesen
6645b3f5e4 Implement the atmospheric pressure field 2021-07-06 16:16:18 +02:00
Jef Driesen
c8bd477c84 Always use the stored atmospheric pressure
The correct atmospheric pressure is measured and recorded by the dive
computer. There is no need to replace the correct value with some other
value.
2021-07-06 16:16:18 +02:00
Jef Driesen
c747dc7184 Add a CI job to build with Visual Studio
The migration to Visual Studio 2013 allows to build the Visual Studio
project in a Github Action.

Because some of the source files (e.g. the resource script and version
header) are normally auto-generated by the autotools build system, an
msys environment is setup to run the configure script. When building
from a distribution tarball, this extra step isn't necessary.
2021-07-02 17:30:58 +02:00
Jef Driesen
9307acbe4a Migrate to Visual Studio 2013 (or newer)
Starting with msvc 2013, the C compiler has much better C99 support. The
previous workaround to compile everything as C++ code is no longer
needed.

Some additional changes:

 - Add a 64bit build
 - Enable _CRT_SECURE_NO_WARNINGS to silence warnings
2021-07-02 17:29:27 +02:00
Jef Driesen
9106250a53 Emit events when downloading a memory dump 2021-06-25 17:17:20 +02:00
Jef Driesen
449b65cf1b Fix the depth decoding
With just 12 bits, the depth values are limited to at most 40.95m.
However for some deeper dives, this appears to be wrong. The next two
higher bits, which were previously unknown, are also part of the depth.
This increases the maximum depth to 163.83m.
2021-06-25 17:16:33 +02:00
Vincent Hagen
0bc7b195e5 Add library dependencies in windows build
Include libusb and hidapi when building for windows
these are also added to the artifact
2021-06-07 09:25:29 +02:00
Jef Driesen
fba5676b78 Fix the hwOS Sport firmware upgrade
Support for the S_BLOCK_WRITE2 command is only available since the hwOS
Tech firmware v3.09 and the hwOS Sport firmware v10.64. In commit
9e92381be48866f3f13a11e98d59962575bb5ad3 it was enabled for all firmware
versions newer than v3.09, causing the firmware upgrade to fail for
older hwOS Sport firmware versions.

Reported-by: Anton Lundin <glance@acc.umu.se>
2021-05-26 12:04:18 +02:00
Jef Driesen
14fd0296d4 Post release version bump to 0.8.0 2021-05-07 21:22:36 +02:00
Jef Driesen
47cbed5355 Release version 0.7.0 v0.7.0 2021-05-07 21:22:36 +02:00
Jef Driesen
2ccdc46561 Use the product name as the family name
The standard practice for the human-readable family name is to use the
product name and not vendor name.
2021-05-07 20:46:56 +02:00
Nick Shore
37c4203537 Add support for the Sherwood Amphos 2.0 2021-05-02 16:08:10 +02:00
Nick Shore
d85d8811f0 Add support for a new Suunto Zoop Novo variant 2021-04-20 09:58:20 +02:00
Nick Shore
76d225dcfc Add support for the EON Steel Black 2021-04-20 09:30:01 +02:00
Jef Driesen
6ef72ab420 Add support for the Sporasub SP2
The Sporasub SP2 uses a very simple communication protocol and memory
layout, but with some unusual aspects:

Dives are artifically limited to a maximum of 6000 samples.

Unlike all other dive computers, the dives are not stored in some kind
of ringbuffer structure. Once the memory is full, no new dives can be
recorded. The existing dives need to be erased first, and the dive
computer will start recording again at te start of the memory area. The
Sporasub application has an "Auto-clear watch memory after data
transfer" feature for this purpose.

I didn't implement a more efficient download algorithm because
downloading a full memory dumps takes less than 10 seconds.
2021-04-15 16:47:59 +02:00
Jef Driesen
1418766a1a Fix an overflow in the progress events
The maximum value for the progress events is based on the amount of the
flash memory available for storing the dives. But the 8 byte serial
number is not stored inside the dive data, and is added dynamically
during the data transfer. This extra data needs to be taken into account
to avoid overflowing the progress events and trigger an assert in the
code.
2021-04-08 17:27:43 +02:00
Jef Driesen
752a064bb3 Use a common sleep implementation
Implement a common sleep function to eliminate some conditional
compilation in the rest of the code.
2021-03-24 17:17:57 +01:00
Jef Driesen
a4d771956a Fix the clang compiler flag detection
The clang compiler accepts *any* compiler flags, and just reports
an annoying warning instead:

  warning: unknown warning option '-Wsomething' [-Wunknown-warning-option]

Use -Werror=unknown-warning-option to change this warning into an error,
and detect the unsupported flag. Since this is a clang specific option,
it can't be used unconditionally with other compilers. The option is
also only used for checking the compiler flags, and not for compiling
the code.
2021-03-11 16:41:53 +01:00
Jef Driesen
007a2bc835 Add Github Actions CI builds and releases
The new Github Actions offers similar functionality as the Travis CI
integration, but with some interesting extra features:

The build action is almost equivalent to the existing Travis build
configuration. But as an extra feature, the build artifacts are now
available for download.

The release action does automatically build a distribution tarball and
create a Github release, whenever a new version is tagged and pushed.
2021-03-09 22:49:08 +01:00
Jef Driesen
6b576da5ef Show a summary after configuration 2021-03-07 21:24:15 +01:00
Jef Driesen
6bb13a564f Extend the OS detection to non Windows platforms
At the moment, only the Windows platform needs some special handling,
but this can easily be extended to detect and handle other platforms as
well.
2021-03-07 21:23:44 +01:00
Jef Driesen
bf482f6025 Merge branch 'vtpro' 2021-03-04 12:47:20 +01:00