732 Commits

Author SHA1 Message Date
Jef Driesen
1a3c919a82 Fix temperature and tank pressure for the Tusa Element II.
The Tusa Element II is a non air integrated model, and the temperature
is stored at a different location.
2013-05-11 23:00:32 +02:00
Jef Driesen
1572a91f62 Add support for yet another Oceanic OC1 variant.
The only difference with the two other Oceanic OC1 variants is the new
model number. I have absolutely no idea what's the purpose of such a
silly change.
2013-05-11 07:16:25 +02:00
Jef Driesen
c195404920 Add support for the Suunto DX.
The Suunto DX has support for 8 gas mixes (OC) and 3 diluents (CC).
Because it's still unknown how rebreather dives are stored, we simply
return all 11 gas mixes. For the rest, the DX data format is very
similar to that of the existing Suunto models, with only a few
different offsets here and there.
2013-05-11 07:00:51 +02:00
Jef Driesen
8f3eb48bfb Prevent an infinite loop.
When the number of parameters is zero, there are no sample values, and
the offset variable is never increased. The result is an infinite loop.
In practice this shouldn't happen because there should always be at
least one sample value (e.g. depth). But if a new data format is
available, which is not yet supported by the parser, we might be trying
to interpret the wrong byte.
2013-05-11 07:00:51 +02:00
Olivier Bussier
3ce237eee4 Fix the parsing of the gas mixes.
If the gas model flag is set to air, the individual gas mix definitions
are ignored, and a single mix with air is returned instead. For non-air
dives, only the gas mixes marked as active are returned.
2013-05-03 08:42:43 +02:00
Jef Driesen
c429947f25 Add a devinfo event containing the serial number. 2013-04-29 20:58:10 +02:00
Jef Driesen
9297e390a8 Flush the serial buffers after opening the port.
Sometimes there are garbage bytes present after opening the serial
port, which causes the communication to fail. Flushing the buffers
after a small delay is all it takes to get rid of those bytes.
2013-04-29 20:47:26 +02:00
Jef Driesen
20f813d5bc Fix a potential NULL pointer dereference. 2013-04-25 20:45:28 +02:00
Jef Driesen
f46e650a63 Add support for the Genesis React Pro White
The React Pro White appears to be a newer variant of the React Pro. For
the communication it uses the newer atom2 protocol, but the data format
remains (almost) the same as the older React Pro.
2013-04-25 20:43:56 +02:00
Jef Driesen
b185c1f62a Fix the temperature and year for the Genesis React Pro. 2013-04-23 21:42:06 +02:00
Jef Driesen
8a0efe2bfb Fix the sample rate for the Genesis React Pro.
This model doesn't support a 2 second sample rate. It appears the
possible sample rate values have been shifted by one to map the value
zero to a 15 second sample rate.

To avoid any trouble with possible out of range values, the index is
shifted in a circular way.
2013-04-23 21:42:06 +02:00
Jef Driesen
c7cc955b29 Use symbolic constants for the model numbers. 2013-04-23 21:42:06 +02:00
Jef Driesen
7529ab8d5b Add additional descriptors for Uwatec devices. 2013-04-20 09:41:04 +02:00
Dirk Hohndel
13950c0ca1 Fix time conversion for Shearwater computers
The time read from the Shearwater is already in localtime.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-03-26 18:41:57 +01:00
Jef Driesen
a9b7edfde3 Add support for the Mares Nemo Steel and Titanium.
These two models are simply a variant of the normal Mares Nemo with a
different material on the outside.
2013-03-19 21:59:40 +01:00
Jef Driesen
4adac6f5c9 Add support for the Oceanic Pro Plus 3. 2013-03-19 07:48:36 +01:00
Jef Driesen
276be51a65 Fix the decoding of negative temperatures.
Because temperatures can be negative, we should interpret the stored
value as a signed integer, even for the absolute values.
2013-03-17 08:45:33 +01:00
Jef Driesen
7323ba0f2d Re-order the decostop array to match the enum values.
The enum values have been re-ordered a while ago, but the array was not
updated to reflect those changes.
2013-03-10 20:57:19 +01:00
Jef Driesen
9fb5e1f566 Add support for the Aeris Atmos 2. 2013-03-03 23:45:27 +01:00
Jef Driesen
5bea3156fd Add support for the Aeris Elite. 2013-02-07 13:11:18 +01:00
Jef Driesen
5d28a32912 Post release version bump to 0.3.1. 2013-02-06 13:54:52 +01:00
Jef Driesen
82fadd89bf Release version 0.3.0. v0.3.0 2013-02-06 13:52:03 +01:00
Jef Driesen
e5fde4c57d Merge branch 'release-0.2'
Integrate the bugfixes from the stable branch.
2013-02-04 19:14:24 +01:00
Jef Driesen
0b20855d56 Add support for the Cressi Leonardo.
This is only a preliminary version. There is certainly some room for
improvement, but the basic functionality is already in place. That
should be sufficient for daily use, and possibles issues can always be
fixed when discovered.
2013-02-04 17:20:23 +01:00
Jef Driesen
1e4d051b1e Move the bin/hex conversion functions to a common file. 2013-02-04 16:51:30 +01:00
Jef Driesen
8fa25ea9f3 Fix the fingerprint offset for the Suunto D4i, D6i and D9tx.
When support for these models was introduced, I fixed the date/time
parsing, but forgot about the fingerprint offset.
2013-02-03 09:03:45 +01:00
Jef Driesen
a4d46b2477 Add support for the new D6i firmware.
After the new firmware upgrade, up to three gas mixes are available
instead of only two. This causes the parsing to fail because there is
now an extra 6 byte gasmix block in the header.

Unfortunately, we can't rely on the firmware version to detect whether
this extra gasmix is present or not. In theory the dive computer can
contain dives in both the old and the new format. Because the firmware
version is a property of the device, and not stored inside each dive,
using the firmware version would either cause the old or the new dives
to fail parsing. This appears to be the approach DM4 is using.

According to some sources on the internet, the logbook gets erased
during the firmware update. However, according to the memory dumps I
received, that appears to be incorrect. The old dives are still
present, and it seems it's only DM4 that fails to download them.

So we need an alternative solution. After a detailed analysis of all
the Suunto dives at my disposal, I noticed something interesting. The
first 5 bytes of each dive are almost static. There are only 5
different variations:

0061906216
0061A06216
0062909118
0062C07118
0063C07118

The interpretation of these bytes is currently unknown, but the second
byte might be some kind of data format version. Each model always has
the same value here, and for the D6i it changes after the firmware
update:

0x61: D4, D6, D9, Cobra 2, Cobra3, Vyper 2, Vyper Air
0x62: D4i, D6i (old firmware), D9tx, HelO2
0x63: D6i (new firmware)

This can't be coincidence, so we use this byte to detect the presence
of the extra gasmix.
2013-02-03 09:03:45 +01:00
Jef Driesen
038c603719 Simplify parsing the variable size gasmix section.
The HelO2, D4i, D6i and D9tx all use the same data format for the gas
mixes. The only difference is the number of gas mixes and the initial
byte offset. With this knowledge, we can easily use the same code for
all models. An additional advantage is that because the profile
configuration data is stored immediately after the gasmix section, we
can also replace the hardcoded offset with a simple calculation.
2013-02-03 09:03:45 +01:00
Jef Driesen
7c2d1e9ec9 Use absolute byte offsets for the Suunto HelO2.
Absolute byte offsets are a lot more convenient when using the code as
the reference documentation for interpreting the raw binary data.
2013-02-03 09:03:45 +01:00
Jef Driesen
90e20df936 Remove the obsolete SKIP macro.
This macro was used to compensate for the fact that the 4 bytes at the
start of each dive, containing the previous and next dive pointers, are
stripped. With the SKIP macro the byte offset remained the same as in
the documentation. Nowadays, this compatibility isn't necessary anymore
and it only makes interpreting the raw binary data more difficult.
2013-02-03 09:03:45 +01:00
Jef Driesen
1f8cefdedd Add support for the Seemann XP5. 2013-01-29 19:29:26 +01:00
Jef Driesen
d414da70a4 Add support for a second Aeris Elite T3 variant.
This second variant only seems to differ from the first variant in the
different model code and the version string.
2013-01-22 22:22:35 +01:00
Jef Driesen
154fc82da1 Fix the tank pressure decoding for the Hollis DG03. 2013-01-21 22:58:58 +01:00
Jef Driesen
7669157a6b Fix the unit conversion for the max depth.
The max depth is stored in imperial units (feet), and should be
converted into metric units (meter). But for some reason this unit
conversion was omitted.
2013-01-13 06:21:46 +01:00
Jef Driesen
173390ed05 Decode the serial number as a 32 bit number.
Apparantly there are also two different type of serial numbers present,
and their interpretation depends on the application. The Windows Dive
Organizer application shows both a serial number (byte offset 0x04) and
a warranty number (byte offset 0x0C). However, the Mac OS X Divers'
Diary application shows the number at byte offset 0x0C as the serial
number. Very confusing. For now, we just stick to the number at byte
offset 0x0C, because that's the number that is shown by the device
itself.
2013-01-13 06:21:13 +01:00
Jef Driesen
dbb6b1aa21 Fix the decoding of the Suunto serial numbers.
The serial numbers were not decoded at all. The raw bytes where simply
converted into an arbitrary 32 bit integer. Now the serial number
matches the real serial number as shown by the device.
2013-01-12 22:17:38 +01:00
Dirk Hohndel
9854097092 Deco and ndl support for the Atomic Aquatics Cobalt
The Cobalt tracks only the NDL time in the samples. There are however
two indications when the dive changes into a decompression dive, but
they don't always occur at the same time and may or may not appear in
the same sample. The first indication is that the NDL time goes to zero
and the other is the first occurrence of the "deco schedule computed"
bit (0x02) in the violation byte of the sample.

As soon as the NDL time goes to zero, an attempt is made to generate a
deco schedule. Depending upon the algorithm used, a schedule may or may
not have any stops, even though the NDL time is zero. If the schedule
does generate deco stops, the deco schedule computed bit is set in the
violation byte of the sample. This bit is set each time a non-zero
schedule is computed. But because this bit is immediately cleared after
the sample has been stored, and only set again at the completion of the
next schedule computation, not every sample will have this bit set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-12 21:30:43 +01:00
Jef Driesen
1e77d92307 Add support for the Mares Puck Pro. 2013-01-06 09:29:33 +01:00
Jef Driesen
59bfb0f318 Add support for the Mares Matrix.
The Matrix uses the same communication protocol as the Nemo Wide 2,
except that the sending the request packets with just a single write
operation doesn't seem to work. That's very surprising because it
caused no problems for the Nemo Wide 2 or the Icon HD!

The first two bytes of each request packet are probably some kind of
command type. These two bytes are answerred immediately with an ACK
byte (0xAA). Once this ACK byte has been received, the payload of the
command (if any) can be sent, and finally the response packet can be
received.

I suspect that when trying to send the entire command at once, the
device somehow doesn't receive the payload bytes correctly. Maybe it's
still busy processing those first two bytes, which causes the remainder
of the packet to get dropped? That might explain why the version
commands is not affected, because it doesn't have any payload bytes!
2013-01-05 23:32:57 +01:00
Jef Driesen
380eaadf83 Hardcode the delay between packets.
The application shouldn't have to deal with the delay between packets.
If the default value isn't good enough, that should be fixed internally
and not on the application side.
2013-01-05 10:12:04 +01:00
Jef Driesen
af1ca93fe8 Add support for trimix gas changes.
The second gas change event (type 0x06) contains both the oxygen and
helium percentages. These are now reported correctly with the new
GASCHANGE2 event.
2013-01-03 21:35:13 +01:00
Dirk Hohndel
89d731bc69 Add deco sample support for Suunto d9 based devices
The D9 family has begin and end of the deco event and we can therefore
convert this to the deco sample. For compatibility with existing software
we keep the events around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-03 21:35:13 +01:00
Jef Driesen
cab84fa2f8 Re-order the constants in the dc_deco_type_t enum.
The SAFETYSTOP is conceptually somewhere in between the NDL and the
DECOSTOP, so it makes sense to re-order the constants in the enum to
reflect this order.
2013-01-02 15:45:06 +01:00
Dirk Hohndel
10ae594b1f Add gas changes and violation events for Atomic Aquatics Cobalt
These are based on the documentation we have and have been tested and
verified against actual dive data (with the exception of the pO2 and
ascent speed violations).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-31 07:37:31 +01:00
Dirk Hohndel
1079bdc0b0 Fix gas handling for OSTC
Two issues:
- the OSTC counts its gases 1-based, not 0-based
- dives don't always start with the first gas. Simply create a gas change
event right after the first time sample that informs the application what
the first gas mix is

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-12-29 18:50:57 +01:00
Jef Driesen
0e0168f4d4 Log the date/time and version in the example applications. 2012-12-28 07:06:29 +01:00
Jef Driesen
f6df407699 Reverse the order of the include directories.
The version.h header file is generated by autoconf and therefore
located in the build directory and not the source directory. If
building out-of-tree, and a version.h header file is accidentally
present in the source tree, the wrong file will be picked up.

By reversing the order of the include directories, the build directory
is searched first, and the correct header file will be used.
2012-12-27 23:00:51 +01:00
Jef Driesen
e2a7d8bb45 Include the git commit SHA1 in the version number.
For bug reports it's very convenient to know the exact version. For
release builds, the standard version triplet (major.minor.micro) is
more than sufficient, but that's not the case for development builds.
Due to the post-release version increment, development builds already
have a version number that is distinct from previous releases, but
including the git commit SHA1 is even more accurate.

On Windows, the git commit SHA1 is also embedded in the version
resource.
2012-12-27 22:00:35 +01:00
Jef Driesen
56b7730773 Add a new vendor event.
The new vendor event provides a mechanism to deliver auxiliary data,
which is automatically retrieved during the data transfer, but not
accessible through the library interface otherwise. Possible examples
include handshake data and/or device identification data.

This event is mainly intended for diagnostic purposes, in combination
with the memory dumping support. Very few applications will actually
need it for anything else.
2012-12-27 12:10:45 +01:00
Jef Driesen
d0b7f2e584 Move the version string to the common device structure.
The version string can be shared by all three backends, which will make
it easier to use the version data directly from the common code.
2012-12-26 08:31:31 +01:00